Bug 1128357 patch 3: test for video playback with dormant r=cpearce
☠☠ backed out by d8d89cea541e ☠ ☠
authorSotaro Ikeda <sikeda@mozilla.com>
Wed, 04 Mar 2015 06:37:31 -0800
changeset 231876 fa440c623c4de53a07fd1b3d833fe1cbf5ba3d2b
parent 231875 36b8feee431e7a1be12e3f61103e46d1d1880207
child 231877 da4499b5210574bd4053d9240fc723cf9b4d30e4
push id28362
push userryanvm@gmail.com
push dateWed, 04 Mar 2015 21:35:51 +0000
treeherdermozilla-central@56492f7244a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1128357
milestone39.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 1128357 patch 3: test for video playback with dormant r=cpearce
dom/media/test/mochitest.ini
dom/media/test/test_dormant_playback.html
--- a/dom/media/test/mochitest.ini
+++ b/dom/media/test/mochitest.ini
@@ -359,16 +359,18 @@ skip-if = (toolkit == 'android' && proce
 [test_contentDuration7.html]
 [test_controls.html]
 [test_currentTime.html]
 [test_decode_error.html]
 [test_decoder_disable.html]
 [test_defaultMuted.html]
 [test_delay_load.html]
 skip-if = buildapp == 'b2g' && toolkit != 'gonk' # bug 1082984
+[test_dormant_playback.html]
+skip-if = (os == 'win' && os_version == '5.1') || (os != 'win' && toolkit != 'gonk')
 [test_eme_access_control.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 [test_eme_canvas_blocked.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 [test_eme_non_fragmented.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
 [test_eme_obs_notification.html]
 skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s # bug 1043403, bug 1057908
new file mode 100644
--- /dev/null
+++ b/dom/media/test/test_dormant_playback.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset='utf-8'>
+  <title>Media test: Test resuming from dormant does not emit seek related events</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+var gNeedInit = false;
+var gLoadedEvent = false;
+var gSeekEvent = false;
+var v1 = null;
+
+function startVideoPlayback() {
+  v1.play()
+}
+
+function setVideoVisible() {
+  document.body.appendChild(v1);
+  setTimeout(startVideoPlayback, 0);
+}
+
+function checkResult() {
+  ok(!gLoadedEvent, "loadedmetadata event should not happen");
+  ok(!gSeekEvent, "seek event should not happen");
+  SimpleTest.finish();
+}
+
+function loadedMetadata(e) {
+  if (gNeedInit) {
+    v1.currentTime = 0;
+    return;
+  }
+  gLoadedEvent = true;
+}
+
+function playbackEnded(e) {
+  checkResult();
+}
+
+function seekEnded(e) {
+  if (gNeedInit) {
+    gNeedInit = false;
+    gLoadedEvent = false;
+    gSeekEvent = false;
+    document.body.removeChild(v1);
+    setTimeout(setVideoVisible, 0);
+    return;
+  }
+  gSeekEvent = true;
+}
+
+function seeking(e) {
+  gSeekEvent = true;
+}
+
+function runTest() {
+  gNeedInit = true;
+
+  v1 = document.createElement('video');
+  document.body.appendChild(v1);
+  v1.preload = "metadata";
+  v1.src = "gizmo.mp4"
+  v1.addEventListener("loadedmetadata", loadedMetadata, false);
+  v1.addEventListener("ended", playbackEnded, false);
+  v1.addEventListener("seeked", seekEnded, false);
+  v1.addEventListener("seeking", seeking, false);
+}
+
+addLoadEvent(runTest);
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+</body>
+</html>