Layout Test media/click-volume-bar-not-pausing.html is flaky
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2013 06:12:55 +0000 (06:12 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 1 Oct 2013 06:12:55 +0000 (06:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122126

Reviewed by Darin Adler.

Speculative partial fix.

I'm not sure if it's possible to make this test completely controlled without
DOMFrameContentLoaded support - we need to do work when the <video> element is
already present, but playback hasn't started yet. As media documents use autoplay,
there is a race between load and playing events.

* media/click-volume-bar-not-pausing-expected.txt:
* media/click-volume-bar-not-pausing.html:
  - Add video URL after initial content fully loads to avoid races with that.
  - Added some state logging for clarity.
  - Only listen for "playing" event once. If playback already started, we have a
  playing event already queued, and would add another one with pause()/play().

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

LayoutTests/ChangeLog
LayoutTests/media/click-volume-bar-not-pausing-expected.txt
LayoutTests/media/click-volume-bar-not-pausing.html

index 497850f..81b62d6 100644 (file)
@@ -1,3 +1,24 @@
+2013-09-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Layout Test media/click-volume-bar-not-pausing.html is flaky
+        https://bugs.webkit.org/show_bug.cgi?id=122126
+
+        Reviewed by Darin Adler.
+
+        Speculative partial fix.
+
+        I'm not sure if it's possible to make this test completely controlled without
+        DOMFrameContentLoaded support - we need to do work when the <video> element is
+        already present, but playback hasn't started yet. As media documents use autoplay,
+        there is a race between load and playing events.
+
+        * media/click-volume-bar-not-pausing-expected.txt:
+        * media/click-volume-bar-not-pausing.html:
+          - Add video URL after initial content fully loads to avoid races with that.
+          - Added some state logging for clarity.
+          - Only listen for "playing" event once. If playback already started, we have a
+          playing event already queued, and would add another one with pause()/play().
+
 2013-09-30  Sam White  <samuel_white@apple.com>
 
         AX: Expose ARIA Busy Notifications
index 39be75d..32c99bc 100644 (file)
@@ -1,6 +1,7 @@
 Click on volume bar on a MediaDocument does not pause.
 
 
+Video frame loaded.
 EVENT(playing)
 EXPECTED (mediaElement.volume == '1') OK
 EXPECTED (mediaElement.paused == 'false') OK
index 14ba92f..952e7a5 100644 (file)
@@ -8,7 +8,6 @@
         <script src="media-controls.js"></script>
         <script type="text/javascript">
             var mediaElement;
-            var skipOnFirstEmptyLoad = 0;
 
             function calculateElementCoordinates(id)
             {
@@ -31,8 +30,8 @@
             function clickVolumeSlider()
             {
                 if (!window.eventSender) {
-                    consoleWrite("ERROR: no event sender.");
-                    failTest();
+                    failTest("ERROR: no event sender.");
+                    return;
                 }
 
                 var muteButtonCoordinates;
 
             function frameLoaded()
             {
-                if (++skipOnFirstEmptyLoad == 1)
-                    return;
+                consoleWrite("Video frame loaded.");
 
                 var standaloneMediaDocument = document.getElementById("videoframe").contentDocument;
                 mediaElement = standaloneMediaDocument.querySelector("video");
+                if (!mediaElement) {
+                    failTest("ERROR: Video element was not found in frameLoaded().");
+                    return;
+                }
 
                 waitForEventAndFail("error");
-                waitForEvent('playing', playing);
+                waitForEventOnce('playing', playing);
 
                 mediaElement.pause();
                 mediaElement.play();
     </head>
     <body>
         <p>Click on volume bar on a MediaDocument does not pause.</p>
-        <iframe id="videoframe" width=380 height=330 onload="frameLoaded()"></iframe>
+        <iframe id="videoframe" width=380 height=330"></iframe>
         <script type="text/javascript">
-            document.getElementById("videoframe").src = findMediaFile("video", "content/test");
+            onload = function() {
+                var videoframe = document.getElementById("videoframe");
+                videoframe.onload = frameLoaded;
+                videoframe.src = findMediaFile("video", "content/test");
+            }
         </script>
     </body>
 </html>