tenfourfox/dom/tv/test/mochitest/test_tv_set_current_channel_during_scanning.html
Cameron Kaiser c9b2922b70 hello FPR
2017-04-19 00:56:45 -07:00

68 lines
2.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Test an error case for SetCurrentChannel during scanning 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.");
var source = aSources[0];
// TODO Bug 1088818 - Modify the behavior of channel scanning.
source.startScanning({}).then(
function() {
source.setCurrentChannel("1").then(
function() {
ok(false, "Setting current channel during scanning should get error.");
SimpleTest.finish();
},
function(aError) {
is(aError.name, "InvalidStateError",
"InvalidStateError should be expected.");
SimpleTest.finish();
}
);
},
function(aError) {
ok(false, "Error occurred when starting scanning: " + 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>