[Modern Media Controls] http/tests/media/modern-media-controls/skip-back-support...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Oct 2016 17:43:47 +0000 (17:43 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 26 Oct 2016 17:43:47 +0000 (17:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=164013

Unreviewed.

Make the test more robust by only responding to "canplaythrough" once, since it might have fired again
after seeking, and registering for "seeked" events only after we've reached "canplaythrough", and accounting
for the first seek to 50s.

Patch by Antoine Quint <graouts@apple.com> on 2016-10-26

* http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt:
* http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html:
* platform/mac-yosemite/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207902 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt
LayoutTests/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html
LayoutTests/platform/mac-yosemite/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt [new file with mode: 0644]

index a1f2460..004cf50 100644 (file)
@@ -1,3 +1,18 @@
+2016-10-26  Antoine Quint  <graouts@apple.com>
+
+        [Modern Media Controls] http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=164013
+
+        Unreviewed.
+
+        Make the test more robust by only responding to "canplaythrough" once, since it might have fired again
+        after seeking, and registering for "seeked" events only after we've reached "canplaythrough", and accounting
+        for the first seek to 50s.
+
+        * http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt:
+        * http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click.html:
+        * platform/mac-yosemite/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt: Added.
+
 2016-10-26  Youenn Fablet  <youenn@apple.com>
 
         Enable SDPProcessor for Mac bots
 2016-10-26  Youenn Fablet  <youenn@apple.com>
 
         Enable SDPProcessor for Mac bots
index a88e265..6836771 100644 (file)
@@ -3,16 +3,13 @@ Testing the SkipBackSupport behavior by clicking on the mute button.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+Media seeked to currentTime = 50
 
 Dispatching click event to the skip back button
 
 Dispatching click event to the skip back button
-
-seeked event was dispatched
-PASS media.currentTime is 20
+Media seeked to currentTime = 20
 
 Dispatching click event to the skip back button
 
 Dispatching click event to the skip back button
-
-seeked event was dispatched
-PASS media.currentTime is within 0.1 of 0
+Media seeked to currentTime = 0
 
 PASS successfullyParsed is true
 
 
 PASS successfullyParsed is true
 
index 872ad54..7c3ea8b 100644 (file)
@@ -46,37 +46,34 @@ const shadowRoot = document.querySelector("div#shadow").attachShadow({ mode: "op
 const media = document.querySelector("video");
 const mediaController = createControls(shadowRoot, media, null);
 
 const media = document.querySelector("video");
 const mediaController = createControls(shadowRoot, media, null);
 
-media.addEventListener("canplaythrough", event => {
-    media.currentTime = 50;
-    clickSkipBackButton();
-});
-
 let numberOfEvents = 0;
 let numberOfEvents = 0;
-media.addEventListener("seeked", function() {
-    debug("");
-    debug("seeked event was dispatched");
+function mediaDidSeek()
+{
+    debug("Media seeked to currentTime = " + media.currentTime);
 
     numberOfEvents++;
 
     numberOfEvents++;
-
-    if (numberOfEvents == 1) {
-        shouldBe("media.currentTime", "20");
-        clickSkipBackButton();
-    } else if (numberOfEvents == 2) {
-        shouldBeCloseTo("media.currentTime", 0, 0.1);
+    if (numberOfEvents == 3) {
         debug("");
         shadowRoot.host.remove();
         media.remove();
         finishJSTest();
         debug("");
         shadowRoot.host.remove();
         media.remove();
         finishJSTest();
+        return;
     }
     }
-});
 
 
-function clickSkipBackButton()
-{
     debug("");
     debug("Dispatching click event to the skip back button");
     mediaController.controls.skipBackButton.element.click();
 }
 
     debug("");
     debug("Dispatching click event to the skip back button");
     mediaController.controls.skipBackButton.element.click();
 }
 
+function mediaCanPlay()
+{
+    media.removeEventListener("canplaythrough", mediaCanPlay);
+    media.addEventListener("seeked", mediaDidSeek);
+    media.currentTime = 50;
+}
+
+media.addEventListener("canplaythrough", mediaCanPlay);
+
 </script>
 <script src="../../../../../resources/js-test-post.js"></script>
 </body>
 </script>
 <script src="../../../../../resources/js-test-post.js"></script>
 </body>
diff --git a/LayoutTests/platform/mac-yosemite/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt b/LayoutTests/platform/mac-yosemite/http/tests/media/modern-media-controls/skip-back-support/skip-back-support-button-click-expected.txt
new file mode 100644 (file)
index 0000000..342c51a
--- /dev/null
@@ -0,0 +1,17 @@
+Testing the SkipBackSupport behavior by clicking on the mute button.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Media seeked to currentTime = 50
+
+Dispatching click event to the skip back button
+Media seeked to currentTime = 20
+
+Dispatching click event to the skip back button
+Media seeked to currentTime = 0.04789115646258504
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+