Bug 1499903 - part2 : add test. r=chunmin
authoralwu <alwu@mozilla.com>
Fri, 23 Nov 2018 05:06:47 +0000
changeset 504217 7b73044f0618cd59277967b5201fb529d58caea3
parent 504216 55b9e352f46dd27c4bc820b70906d91ef88e83a0
child 504218 0f223b4c9a71630afc580efe5c0b1894309b92fd
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschunmin
bugs1499903
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1499903 - part2 : add test. r=chunmin Differential Revision: https://phabricator.services.mozilla.com/D9641
dom/media/test/mochitest.ini
dom/media/test/test_looping_eventsOrder.html
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -877,16 +877,17 @@ fail-if = android_version == '22' # andr
 [test_load_candidates.html]
 skip-if = toolkit == 'android' # android(bug 1232305)
 [test_load_same_resource.html]
 skip-if = toolkit == 'android' # bug 1274802, android(bug 1232305)
 [test_load_source.html]
 skip-if = toolkit == 'android' # android(bug 1232305)
 [test_loop.html]
 skip-if = toolkit == 'android' # bug 1242112, android(bug 1232305)
+[test_looping_eventsOrder.html]
 [test_media_selection.html]
 [test_media_sniffer.html]
 skip-if = android_version == '17' # android(bug 1232305)
 [test_mediarecorder_avoid_recursion.html]
 skip-if = (os == 'win' && !debug) || (android_version == '17') # bug 1228605, android(bug 1232305)
 tags=msg
 [test_mediarecorder_bitrate.html]
 skip-if = toolkit == 'android' # bug 1297432, android(bug 1232305)
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_looping_eventsOrder.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <title>Looping events order</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>
+<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>