mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-06 09:29:35 +00:00
59 lines
1.8 KiB
HTML
59 lines
1.8 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Test GetSources 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.");
|
|
for (var i = 0; i < aSources.length; i++) {
|
|
var source = aSources[i];
|
|
ok(source instanceof TVSource, "Source " + i + " should be in the right type.");
|
|
ok('tuner' in source, "Source " + i + " should have a tuner.");
|
|
ok('type' in source, "Source " + i + " should have a type.");
|
|
ok('isScanning' in source, "Source " + i + " should have isScanning.");
|
|
ok(!source.isScanning,
|
|
"Source " + i + " should not be scanning by default.");
|
|
ok(!source.currentChannel,
|
|
"Source " + i + " should have no current channel by default.");
|
|
}
|
|
|
|
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>
|