gecko-dev/dom/media/test/test_looping_eventsOrder.html
Brian Grinstead 0d460e3432 Bug 1544322 - Part 2.2 - Remove the [type] attribute for one-liner <script> tags loading files in /tests/SimpleTest/ in dom/ r=bzbarsky
This is split from the previous changeset since if we include dom/ the file size is too
large for phabricator to handle.

This is an autogenerated commit to handle scripts loading mochitest harness files, in
the simple case where the script src is on the same line as the tag.

This was generated with https://bug1544322.bmoattachments.org/attachment.cgi?id=9058170
using the `--part 2` argument.

Differential Revision: https://phabricator.services.mozilla.com/D27457

--HG--
extra : moz-landing-system : lando
2019-04-16 03:53:28 +00:00

53 lines
1.4 KiB
HTML

<!DOCTYPE HTML>
<html>
<head>
<title>Looping events order</title>
<script 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>
<script type="text/javascript">
/**
* This test is used to ensure the events order when media is looping back to
* the start position. We should see events in following order.
* 'seeking' -> 'timeupdate' -> 'seeked'.
*/
SimpleTest.waitForExplicitFinish();
var tests = [
{ name:"small-shot.ogg", type:"audio/ogg" },
{ name:"seek-short.webm", type:"video/webm" }
];
async function testTimeupdateChanged({name, type}) {
info(`- start testPlay for name=${name} -`);
const element = document.createElement(getMajorMimeType(type));
element.src = name;
element.loop = true;
await once(element, "canplay");
ok(await element.play().then(() => true, () => false), `start playing ${name}`);
let gotTimeUpdated = false;
await once(element, "seeking");
element.addEventListener("timeupdate", function() {
gotTimeUpdated = true;
}, {once: true});
await once(element, "seeked");
ok(gotTimeUpdated, "Got timeupdate between seeking and seeked.");
removeNodeAndSource(element);
}
(async function startTest() {
for (let test of tests) {
await testTimeupdateChanged(test);
}
SimpleTest.finish();
})();
</script>
</pre>
</body>
</html>