diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/media/test/test_bug654550.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/media/test/test_bug654550.html')
-rw-r--r-- | dom/media/test/test_bug654550.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/dom/media/test/test_bug654550.html b/dom/media/test/test_bug654550.html new file mode 100644 index 000000000..07922874d --- /dev/null +++ b/dom/media/test/test_bug654550.html @@ -0,0 +1,84 @@ +<!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 */ + + // 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(); + 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"); + } + + } + + function ontimeupdate_statsEnabled(event) { + var v = event.target; + v.removeEventListener('timeupdate', ontimeupdate_statsEnabled, false); + checkStats(v, true); + SpecialPowers.popPrefEnv( + function() { + v.addEventListener("timeupdate", ontimeupdate_statsDisabled); + }); + } + + function ontimeupdate_statsDisabled(event) { + var v = event.target; + v.removeEventListener('timeupdate', ontimeupdate_statsDisabled, false); + checkStats(v, false); + removeNodeAndSource(v); + manager.finished(v.token); + } + + function startTest(test, token) { + var v = document.createElement('video'); + v.token = token; + v.src = test.name; + // playback may reach the end before pref is changed for the duration is short + // set 'loop' to true to keep playing so that we won't miss 'timeupdate' events + v.loop = true; + manager.started(token); + SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", true]]}, + function() { + v.play(); + v.addEventListener("timeupdate", ontimeupdate_statsEnabled); + }); + } + + SpecialPowers.pushPrefEnv({"set": [["media.video_stats.enabled", false]]}, + function() { + manager.runTests(gVideoTests, startTest); + }); + +</script> +</pre> +</body> +</html> |