mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-22 02:25:05 +00:00
78 lines
2.7 KiB
HTML
78 lines
2.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test GetCurrentProgram 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].getCurrentProgram().then(
|
|
function(aCurrentProgram) {
|
|
ok(aCurrentProgram, "Got the current program.");
|
|
ok(aCurrentProgram instanceof TVProgram, "The current program should be in the right type.")
|
|
ok('channel' in aCurrentProgram, "The current program should have a channel.");
|
|
ok('eventId' in aCurrentProgram, "The current program should have an event ID.");
|
|
ok('title' in aCurrentProgram, "The current program should have a title.");
|
|
ok('startTime' in aCurrentProgram, "The current program should have start time.");
|
|
ok('duration' in aCurrentProgram, "The current program should have duration.");
|
|
ok(aCurrentProgram.getAudioLanguages().length >= 0,
|
|
"The current program may have audio language(s).");
|
|
ok(aCurrentProgram.getSubtitleLanguages().length >= 0,
|
|
"The current program 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>
|