Title: [99751] trunk/LayoutTests
Revision
99751
Author
[email protected]
Date
2011-11-09 12:28:24 -0800 (Wed, 09 Nov 2011)

Log Message

Tests depending on video-paint-test.js can run non-deterministically
https://bugs.webkit.org/show_bug.cgi?id=71878

Reviewed by Darin Adler.

* media/video-frame-accurate-seek.html: changed init() to initAndSeeked()
* media/video-paint-test.js:

Modified Paths

Property Changed

Diff

Modified: trunk/LayoutTests/ChangeLog (99750 => 99751)


--- trunk/LayoutTests/ChangeLog	2011-11-09 20:22:42 UTC (rev 99750)
+++ trunk/LayoutTests/ChangeLog	2011-11-09 20:28:24 UTC (rev 99751)
@@ -1,3 +1,13 @@
+2011-11-08  Andrew Scherkus  <[email protected]>
+
+        Tests depending on video-paint-test.js can run non-deterministically
+        https://bugs.webkit.org/show_bug.cgi?id=71878
+
+        Reviewed by Darin Adler.
+
+        * media/video-frame-accurate-seek.html: changed init() to initAndSeeked()
+        * media/video-paint-test.js:
+
 2011-11-09  Antti Koivisto  <[email protected]>
 
         Eliminate CSSMutableValue
Property changes on: trunk/LayoutTests/ChangeLog
___________________________________________________________________

Deleted: svn:executable

Modified: trunk/LayoutTests/media/video-frame-accurate-seek.html (99750 => 99751)


--- trunk/LayoutTests/media/video-frame-accurate-seek.html	2011-11-09 20:22:42 UTC (rev 99750)
+++ trunk/LayoutTests/media/video-frame-accurate-seek.html	2011-11-09 20:28:24 UTC (rev 99751)
@@ -4,7 +4,7 @@
         <script src=""
         <script src=""
     </head>
-    <body _onload_="setSrcByTagName('video', findMediaFile('video', 'content/test-25fps')); init()">
+    <body _onload_="setSrcByTagName('video', findMediaFile('video', 'content/test-25fps')); initAndSeeked()">
         <p>Test that setting currentTime is frame-accurate. The three videos below should be showing frames 12, 13, and 14.</p>
         <video _oncanplaythrough_='event.target.currentTime=(12/25)'></video>
         <video _oncanplaythrough_='event.target.currentTime=(13/25)'></video>

Modified: trunk/LayoutTests/media/video-paint-test.js (99750 => 99751)


--- trunk/LayoutTests/media/video-paint-test.js	2011-11-09 20:22:42 UTC (rev 99750)
+++ trunk/LayoutTests/media/video-paint-test.js	2011-11-09 20:28:24 UTC (rev 99751)
@@ -1,22 +1,30 @@
+function waitForMultipleEvents(name, times, func) {
+    var count = 0;
+    document.addEventListener(name, function() {
+        if (++count == times) {
+            func();
+        }
+    }, true);
+}
+
 function init()
 {
-    var totalCount = document.getElementsByTagName('video').length;
-    var count = totalCount;
-    document.addEventListener("canplaythrough", function () {
-        if (!--count) {
-            var video = document.getElementsByTagName('video')[0];
-            video.play();
-            video.addEventListener("playing", function() {
-                video.pause();
-                video.currentTime = 0;
-                video.addEventListener("seeked", function() {
-                    if (window.layoutTestController)
-                        layoutTestController.notifyDone();
-                });
+    var videos = document.getElementsByTagName('video');
+
+    waitForMultipleEvents("canplaythrough", videos.length, function() {
+        for (var i = 0; i < videos.length; ++i) {
+            videos[i].play();
+            videos[i].addEventListener("playing", function(event) {
+                event.target.pause();
+                event.target.currentTime = 0;
             });
-            document.body.offsetLeft;
         }
-    }, true);
+
+        waitForMultipleEvents("seeked", videos.length, function() {
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        });
+    });
 }
 
 if (window.layoutTestController) {
@@ -30,20 +38,30 @@
 
 function initAndPause()
 {
-    var totalCount = document.getElementsByTagName('video').length;
-    var count = totalCount;
-    document.addEventListener("canplaythrough", function () {
-        if (!--count) {
-            var video = document.getElementsByTagName('video')[0];
-            video.play();
-            video.addEventListener("playing", function() {
-                video.pause();
-                video.addEventListener("pause", function() {
-                    if (window.layoutTestController)
-                        layoutTestController.notifyDone();
-                });
+    var videos = document.getElementsByTagName('video');
+
+    waitForMultipleEvents("canplaythrough", videos.length, function() {
+        for (var i = 0; i < videos.length; ++i) {
+            videos[i].play();
+            videos[i].addEventListener("playing", function(event) {
+                event.target.pause();
             });
         }
-    }, true);
+
+        waitForMultipleEvents("pause", videos.length, function() {
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+        });
+    });
+
 }
 
+function initAndSeeked()
+{
+    var videos = document.getElementsByTagName('video');
+
+    waitForMultipleEvents("seeked", videos.length, function() {
+        if (window.layoutTestController)
+            layoutTestController.notifyDone();
+    });
+}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to