mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-18 21:02:52 +00:00
Bug 1349097 P4 - add a mochitest; r=jwwang
MozReview-Commit-ID: A71wl09i0eq --HG-- extra : rebase_source : 2ddd0504a94c7bbca2c6a127c23a6764b885ef21 extra : source : 1b8111b8d82a7745c4aaf5dd82512ffecea52cb7
This commit is contained in:
parent
d894ae1293
commit
7ab8b4bb1f
@ -1161,6 +1161,9 @@ tags = suspend
|
||||
[test_background_video_drawimage_with_suspended_video.html]
|
||||
skip-if = toolkit == 'android' # bug 1346705
|
||||
tags = suspend
|
||||
[test_background_video_ended_event.html]
|
||||
skip-if = toolkit == 'android' # bug 1346705
|
||||
tags = suspend
|
||||
|
||||
[test_temporary_file_blob_video_plays.html]
|
||||
skip-if = toolkit == 'android' # android(bug 1232305)
|
||||
|
48
dom/media/test/test_background_video_ended_event.html
Normal file
48
dom/media/test/test_background_video_ended_event.html
Normal file
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset="utf-8">
|
||||
<title>Test Background Video Suspends</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="manifest.js"></script>
|
||||
<script src="background_video.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="text/javascript">
|
||||
"use strict";
|
||||
|
||||
var manager = new MediaTestManager;
|
||||
|
||||
startTest({
|
||||
desc: "Test background video doesn't fire the 'ended' event twice.",
|
||||
prefs: [
|
||||
[ "media.test.video-suspend", true ],
|
||||
[ "media.suspend-bkgnd-video.enabled", true ],
|
||||
[ "media.suspend-bkgnd-video.delay-ms", 100 ]
|
||||
],
|
||||
tests: gDecodeSuspendTests,
|
||||
runTest: (test, token) => {
|
||||
let v = appendVideoToDoc(test.name, token);
|
||||
manager.started(token);
|
||||
|
||||
let count = 0;
|
||||
v.addEventListener("ended", function() {
|
||||
is(++count, 1, `${token} should get only one 'ended' event.`);
|
||||
});
|
||||
|
||||
/*
|
||||
* This test checks that, after a video element had finished its playback,
|
||||
* resuming video decoder doesn't dispatch 2nd ended event.
|
||||
* This issue was found in bug 1349097.
|
||||
*/
|
||||
waitUntilPlaying(v)
|
||||
.then(() => testVideoSuspendsWhenHidden(v))
|
||||
.then(() => waitUntilEnded(v))
|
||||
.then(() => testVideoResumesWhenShown(v))
|
||||
.then(() => {
|
||||
// Wait for a while and finish the test. We should get only one 'ended' event.
|
||||
setTimeout(function() {
|
||||
removeNodeAndSource(v);
|
||||
manager.finished(token);
|
||||
}, 3000);
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user