mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-06 09:29:35 +00:00
82 lines
2.8 KiB
HTML
82 lines
2.8 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test GetPrograms for TV API</title>
|
|
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
</head>
|
|
<body>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none"></div>
|
|
<pre id="test">
|
|
<script type="application/javascript" src="./head.js"></script>
|
|
<script type="application/javascript">
|
|
|
|
function runTest() {
|
|
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.");
|
|
|
|
aChannels[0].getPrograms().then(
|
|
function(aPrograms) {
|
|
ok(aPrograms.length > 0, "Got at least 1 program.");
|
|
|
|
for (var i = 0; i < aPrograms.length; i++) {
|
|
var program = aPrograms[i];
|
|
ok(program instanceof TVProgram, "Program " + i + " should be in the right type.")
|
|
ok('channel' in program, "Program " + i + " should have a channel.");
|
|
ok('eventId' in program, "Program " + i + " should have an event ID.");
|
|
ok('title' in program, "Program " + i + " should have a title.");
|
|
ok('startTime' in program, "Program " + i + " should have start time.");
|
|
ok('duration' in program, "Program " + i + " should have duration.");
|
|
ok(program.getAudioLanguages().length >= 0,
|
|
"Program " + i + " may have audio language(s).");
|
|
ok(program.getSubtitleLanguages().length >= 0,
|
|
"Program " + i + " may have subtitle language(s).");
|
|
}
|
|
|
|
SimpleTest.finish();
|
|
},
|
|
function(aError) {
|
|
ok(false, "Error occurred when getting programs: " + aError);
|
|
SimpleTest.finish();
|
|
}
|
|
);
|
|
},
|
|
function(aError) {
|
|
ok(false, "Error occurred when getting channels: " + aError);
|
|
SimpleTest.finish();
|
|
}
|
|
);
|
|
},
|
|
function(aError) {
|
|
ok(false, "Error occurred when getting sources: " + aError);
|
|
SimpleTest.finish();
|
|
}
|
|
);
|
|
},
|
|
function(aError) {
|
|
ok(false, "Error occurred when getting tuners: " + aError);
|
|
SimpleTest.finish();
|
|
}
|
|
);
|
|
}
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
prepareTest(runTest);
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|