2013-06-11 08:23:13 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=654550
|
|
|
|
-->
|
|
|
|
|
|
|
|
<head>
|
|
|
|
<title>Test for Bug 654550</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
|
|
|
<script type="text/javascript" src="manifest.js"></script>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=654550">Mozilla Bug 654550</a>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/* Test for Bug 654550 */
|
|
|
|
|
2014-01-16 21:58:48 -08:00
|
|
|
// Parallel test must be disabled for media.video_stats.enabled is a global setting
|
|
|
|
// to prevent the setting from changing unexpectedly in the middle of the test.
|
|
|
|
PARALLEL_TESTS = 1;
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2013-06-11 08:23:13 -07:00
|
|
|
var manager = new MediaTestManager;
|
|
|
|
|
|
|
|
function checkStats(v, aShouldBeEnabled) {
|
|
|
|
if (aShouldBeEnabled) {
|
|
|
|
ok(v.mozParsedFrames != 0,
|
|
|
|
"At least one value should be different from 0 if stats are enabled");
|
|
|
|
} else {
|
|
|
|
ok(!v.mozParsedFrames,
|
|
|
|
"mozParsedFrames should be 0 if stats are disabled");
|
|
|
|
ok(!v.mozDecodedFrames,
|
|
|
|
"mozDecodedFrames should be 0 if stats are disabled");
|
|
|
|
ok(!v.mozPresentedFrames,
|
|
|
|
"mozPresentedFrames should be 0 if stats are disabled");
|
|
|
|
ok(!v.mozPaintedFrames,
|
|
|
|
"mozPaintedFrames should be 0 if stats are disabled");
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-02-06 00:27:35 -08:00
|
|
|
function ontimeupdate_statsEnabled(event) {
|
2013-06-11 08:23:13 -07:00
|
|
|
var v = event.target;
|
2014-02-06 00:27:35 -08:00
|
|
|
v.removeEventListener('timeupdate', ontimeupdate_statsEnabled, false);
|
|
|
|
checkStats(v, true);
|
|
|
|
SpecialPowers.popPrefEnv(
|
|
|
|
function() {
|
|
|
|
v.addEventListener("timeupdate", ontimeupdate_statsDisabled);
|
|
|
|
});
|
2013-06-11 08:23:13 -07:00
|
|
|
}
|
|
|
|
|
2014-02-06 00:27:35 -08:00
|
|
|
function ontimeupdate_statsDisabled(event) {
|
|
|
|
var v = event.target;
|
|
|
|
v.removeEventListener('timeupdate', ontimeupdate_statsDisabled, false);
|
|
|
|
checkStats(v, false);
|
|
|
|
removeNodeAndSource(v);
|
|
|
|
manager.finished(v.token);
|
|
|
|
}
|
2013-06-11 08:23:13 -07:00
|
|
|
|
|
|
|
function startTest(test, token) {
|
|
|
|
var v = document.createElement('video');
|
|
|
|
v.token = token;
|
|
|
|
v.src = test.name;
|
|
|
|
manager.started(token);
|
2014-02-06 00:27:35 -08:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", true]]},
|
|
|
|
function() {
|
|
|
|
v.play();
|
|
|
|
v.addEventListener("timeupdate", ontimeupdate_statsEnabled);
|
|
|
|
});
|
2013-06-11 08:23:13 -07:00
|
|
|
}
|
|
|
|
|
2014-02-06 00:27:35 -08:00
|
|
|
SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]},
|
|
|
|
function() {
|
|
|
|
manager.runTests(gVideoTests, startTest);
|
|
|
|
});
|
2013-06-11 08:23:13 -07:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|