Changeset 79949 in webkit
- Timestamp:
- Feb 28, 2011 5:31:35 PM (13 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r79944 r79949 1 2011-02-28 Tony Gentilcore <tonyg@chromium.org> 2 3 Reviewed by Darin Adler. 4 5 Fix race condition in 4 media tests 6 https://bugs.webkit.org/show_bug.cgi?id=55414 7 8 The parser may yield and give events a chance to dispatch between any two tokens. So 9 it is possible that the loadstart event fires immediately after the video tag is 10 inserted into the document but before the subsequent script is parsed. This is very 11 rare in the layout test environment since these small files are loaded from disk. 12 13 This patch eliminates that race condition by allowing waitForEvent to register for 14 events that bubble up to the document from any element. Then the registration can 15 happen before before the element is inserted into the document. 16 17 * media/video-source-media.html: 18 * media/video-source-none-supported.html: 19 * media/video-source-type-params.html: 20 * media/video-source-type.html: 21 * media/video-test.js: 22 (waitForEvent): 23 (waitForEventAndTest): 24 1 25 2011-02-28 Tony Gentilcore <tonyg@chromium.org> 2 26 -
trunk/LayoutTests/media/video-source-media.html
r79630 r79949 1 1 <body> 2 2 <script src=video-test.js></script> 3 <script> 4 waitForEvent('loadstart', function () { 5 video = mediaElement = document.getElementsByTagName('video')[0]; 6 testExpected("relativeURL(video.currentSrc)", "content/test.mp4"); 7 endTest(); 8 } ); 9 </script> 3 10 <video controls> 4 11 <source src=content/error.mpeg media="print"> … … 6 13 <source src=content/test.mp4 media="screen and (min-device-width: 100px)"> 7 14 </video> 8 <script>9 video = mediaElement = document.getElementsByTagName('video')[0];10 waitForEvent('loadstart', function () {11 testExpected("relativeURL(video.currentSrc)", "content/test.mp4");12 endTest();13 } );14 15 </script> -
trunk/LayoutTests/media/video-source-none-supported.html
r79630 r79949 5 5 <script src=video-test.js></script> 6 6 <script> 7 8 function setup() 9 { 10 findMediaElement(); 11 document.addEventListener("error", errorEvent, true); 12 } 7 document.addEventListener("error", errorEvent, true); 13 8 14 9 function errorEvent(evt) 15 10 { 11 findMediaElement(); 16 12 consoleWrite("++ ERROR, src = " + relativeURL(event.target.src) + ", type = \"" + event.target.type + "\""); 17 13 testExpected("event.target.tagName", "SOURCE", "=="); … … 49 45 <p>1. Test that no usable <source> element leaves the media element with 50 46 networkState == NETWORK_NO_SOURCE</p> 51 52 <script>setup();</script>53 47 </body> 54 48 </html> -
trunk/LayoutTests/media/video-source-type-params.html
r79630 r79949 2 2 <script src=media-file.js></script> 3 3 <script src=video-test.js></script> 4 <script> 5 waitForEvent('loadstart', function () { 6 video = mediaElement = document.getElementsByTagName('video')[0]; 7 testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(findMediaFile("video", "content/test"))); 8 endTest(); 9 } ); 10 </script> 4 11 <video controls> 5 12 <source src=content/bogus.mpeg type="video/blahblah"> … … 8 15 <source src=content/error2.mpeg type=video/mpeg> 9 16 </video> 10 <script>11 video = mediaElement = document.getElementsByTagName('video')[0];12 waitForEvent('loadstart', function () {13 testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(findMediaFile("video", "content/test")));14 endTest();15 } );16 </script> -
trunk/LayoutTests/media/video-source-type.html
r79630 r79949 7 7 <script src=video-test.js></script> 8 8 <script> 9 function setup() 10 { 9 waitForEvent("loadstart", function () { 11 10 video = mediaElement = document.getElementsByTagName('video')[0]; 12 13 waitForEvent("loadstart", function () { 14 testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(findMediaFile("video", "content/test"))); 15 endTest(); 16 }); 17 } 11 testExpected("stripExtension(relativeURL(video.currentSrc))", stripExtension(findMediaFile("video", "content/test"))); 12 endTest(); 13 }); 18 14 </script> 19 15 </head> … … 27 23 <source src=content/error2.mpeg type=video/mpeg> 28 24 </video> 29 <script>setup();</script>30 25 </body> 31 26 </html> -
trunk/LayoutTests/media/video-test.js
r79630 r79949 1 1 2 2 var video = null; 3 var mediaElement = null;3 var mediaElement = document; // If not set, an event from any element will trigger a waitForEvent() callback. 4 4 var console = null; 5 5 var printFullTestDetails = true; // This is optionaly switched of by test whose tested values can differ. (see disableFullTestDetailsPrinting()) … … 141 141 } 142 142 143 mediaElement.addEventListener(eventName, _eventCallback );143 mediaElement.addEventListener(eventName, _eventCallback, true); 144 144 } 145 145 … … 163 163 } 164 164 165 mediaElement.addEventListener(eventName, _eventCallback );165 mediaElement.addEventListener(eventName, _eventCallback, true); 166 166 } 167 167
Note: See TracChangeset
for help on using the changeset viewer.