Title: [213342] trunk/LayoutTests
Revision
213342
Author
commit-qu...@webkit.org
Date
2017-03-02 19:28:32 -0800 (Thu, 02 Mar 2017)

Log Message

LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=167396

Patch by Antoine Quint <grao...@apple.com> on 2017-03-02
Reviewed by Simon Fraser.

Since timing is hard to test accurately, simplify the test to only check that we're transitioning
from one state to another and use the asynchronous, polling-based assertions to check that we will
be transitioning between those two states (visible and faded).

* media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter-expected.txt:
* media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html:
* platform/mac/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (213341 => 213342)


--- trunk/LayoutTests/ChangeLog	2017-03-03 03:17:35 UTC (rev 213341)
+++ trunk/LayoutTests/ChangeLog	2017-03-03 03:28:32 UTC (rev 213342)
@@ -1,5 +1,20 @@
 2017-03-02  Antoine Quint  <grao...@apple.com>
 
+        LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html is a flaky failure
+        https://bugs.webkit.org/show_bug.cgi?id=167396
+
+        Reviewed by Simon Fraser.
+
+        Since timing is hard to test accurately, simplify the test to only check that we're transitioning
+        from one state to another and use the asynchronous, polling-based assertions to check that we will
+        be transitioning between those two states (visible and faded).
+
+        * media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter-expected.txt:
+        * media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html:
+        * platform/mac/TestExpectations:
+
+2017-03-02  Antoine Quint  <grao...@apple.com>
+
         LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-enter-and-mouse-leave.html is a flaky failure
         https://bugs.webkit.org/show_bug.cgi?id=167348
         <rdar://problem/30822186>

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter-expected.txt (213341 => 213342)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter-expected.txt	2017-03-03 03:17:35 UTC (rev 213341)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter-expected.txt	2017-03-03 03:28:32 UTC (rev 213342)
@@ -3,18 +3,20 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-Video started playing, controls bar is visible by default.
-PASS controlsBar.classList.contains('faded') is false
+PASS !!shadowRoot.querySelector('.controls-bar') became true
 
-Auto-hide timer has elapsed, controls bar should be faded.
-PASS controlsBar.classList.contains('faded') is true
+Video started playing, controls bar should become visible by default.
+PASS shadowRoot.querySelector('.controls-bar').classList.contains('faded') became false
 
-Mouse moved over the media, controls bar should be visible.
-PASS controlsBar.classList.contains('faded') is false
+Controls bar should fade when the auto-hide timer has elapsed.
+PASS shadowRoot.querySelector('.controls-bar').classList.contains('faded') became true
 
-Auto-hide timer has elapsed, controls bar should be faded.
-PASS controlsBar.classList.contains('faded') is true
+Mouse moved over the media, controls bar should become visible.
+PASS shadowRoot.querySelector('.controls-bar').classList.contains('faded') became false
 
+Controls bar should fade when the auto-hide timer has elapsed.
+PASS shadowRoot.querySelector('.controls-bar').classList.contains('faded') became true
+
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html (213341 => 213342)


--- trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html	2017-03-03 03:17:35 UTC (rev 213341)
+++ trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html	2017-03-03 03:28:32 UTC (rev 213342)
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <script src=""
 <body>
-<video src="" style="position: absolute; left: 0; top: 0; width: 320px; height: 240px;" controls autoplay data-auto-hide-delay="250"></video>
+<video src="" style="position: absolute; left: 0; top: 0; width: 320px; height: 240px;" controls autoplay data-auto-hide-delay="1000"></video>
 <script type="text/_javascript_">
 
 window.jsTestIsAsync = true;
@@ -8,38 +8,31 @@
 
 description("Testing the controls bar reappears when the mouse enters the media.");
 
-let controlsBar;
+const media = document.querySelector("video");
+const shadowRoot = window.internals.shadowRoot(media);
 
-document.querySelector("video").addEventListener("play", (event) => {
-    window.requestAnimationFrame(() => {
-        const media = event.target;
-        controlsBar = window.internals.shadowRoot(media).querySelector(".controls-bar");
-
-        debug("Video started playing, controls bar is visible by default.");
-        shouldBeFalse("controlsBar.classList.contains('faded')");
-
-        setTimeout(() => {
+media.addEventListener("play", (event) => {
+    shouldBecomeEqual("!!shadowRoot.querySelector('.controls-bar')", "true", () => {
+        debug("");
+        debug("Video started playing, controls bar should become visible by default.");
+        shouldBecomeEqual("shadowRoot.querySelector('.controls-bar').classList.contains('faded')", "false", () => {
             debug("");
-            debug("Auto-hide timer has elapsed, controls bar should be faded.");
-            shouldBeTrue("controlsBar.classList.contains('faded')");
-
-            eventSender.mouseMoveTo(100, 100);
-            window.requestAnimationFrame(() => {
+            debug("Controls bar should fade when the auto-hide timer has elapsed.");
+            shouldBecomeEqual("shadowRoot.querySelector('.controls-bar').classList.contains('faded')", "true", () => {
+                eventSender.mouseMoveTo(100, 100);
                 debug("");
-                debug("Mouse moved over the media, controls bar should be visible.");
-                shouldBeFalse("controlsBar.classList.contains('faded')");
+                debug("Mouse moved over the media, controls bar should become visible.");
+                shouldBecomeEqual("shadowRoot.querySelector('.controls-bar').classList.contains('faded')", "false", () => {
+                    debug("");
+                    debug("Controls bar should fade when the auto-hide timer has elapsed.");
+                    shouldBecomeEqual("shadowRoot.querySelector('.controls-bar').classList.contains('faded')", "true", () => {
+                        debug("");
+                        media.remove();
+                        finishJSTest();
+                    });
+                });
             });
-
-            setTimeout(() => {
-                debug("");
-                debug("Auto-hide timer has elapsed, controls bar should be faded.");
-                shouldBeTrue("controlsBar.classList.contains('faded')");
-
-                debug("");
-                media.remove();
-                finishJSTest();
-            }, 300);
-        }, 300);
+        });
     });
 });
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (213341 => 213342)


--- trunk/LayoutTests/platform/mac/TestExpectations	2017-03-03 03:17:35 UTC (rev 213341)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2017-03-03 03:28:32 UTC (rev 213342)
@@ -1487,8 +1487,6 @@
 
 webkit.org/b/167373 media/modern-media-controls/tracks-support/tracks-support-show-panel-fullscreen.html [ Pass Failure ]
 
-webkit.org/b/167396 media/modern-media-controls/media-controller/media-controller-auto-hide-rewind-with-mouse-enter.html [ Pass Failure ]
-
 webkit.org/b/165874 streams/pipe-to.html [ Pass Failure ]
 
 # New Encrypted Media API not enabled on Mac
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to