gecko/dom/tv/test/mochitest/file_tv_get_channels.html
Sean Lin a79f77fa4f Bug 1088310 - [Stingray] Add more tests to TV Manager API. r=ehsan
--HG--
rename : dom/tv/test/file_app.sjs => dom/tv/test/mochitest/file_app.sjs
rename : dom/tv/test/file_app.template.webapp => dom/tv/test/mochitest/file_app.template.webapp
rename : dom/tv/test/file_tv_non_permitted_app.html => dom/tv/test/mochitest/file_tv_non_permitted_app.html
rename : dom/tv/test/mochitest.ini => dom/tv/test/mochitest/mochitest.ini
rename : dom/tv/test/test_tv_non_permitted_app.html => dom/tv/test/mochitest/test_tv_non_permitted_app.html
2014-10-22 23:15:24 +08:00

61 lines
2.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test GetChannels for TV API</title>
</head>
<body>
<div id="content"></div>
<script type="application/javascript" src="./test_helpers.js"></script>
<script type="application/javascript;version=1.7">
ok('tv' in navigator, "navigator.tv should exist.");
navigator.tv.getTuners().then(
function(aTuners) {
ok(aTuners.length > 0, "Got at least 1 tuner.");
aTuners[0].getSources().then(
function(aSources) {
ok(aSources.length > 0, "Got at least 1 source.");
aSources[0].getChannels().then(
function(aChannels) {
ok(aChannels.length > 0, "Got at least 1 channel.");
for (var i = 0; i < aChannels.length; i++) {
var channel = aChannels[i];
ok(channel instanceof TVChannel, "Channel " + i + " should be in right type.")
ok('source' in channel, "Channel " + i + " should have a source.");
ok('networkId' in channel, "Channel " + i + " should have a network ID.");
ok('transportStreamId' in channel, "Channel " + i + " should have a transport stream ID.");
ok('serviceId' in channel, "Channel " + i + " should have a service ID.");
ok('type' in channel, "Channel " + i + " should have a type.");
ok('name' in channel, "Channel " + i + " should have a name.");
ok('number' in channel, "Channel " + i + " should have a number.");
}
finish();
},
function(aError) {
ok(false, "Error occurred when getting channels: " + aError);
finish();
}
);
},
function(aError) {
ok(false, "Error occurred when getting sources: " + aError);
finish();
}
);
},
function(aError) {
ok(false, "Error occurred when getting tuners: " + aError);
finish();
}
);
</script>
</body>
</html>