Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html |
index 9832e42d09983063c8ec35c7a1fdf45d0e655214..d2e1390fe7b1265568cf5306c69fb2ffc8e148b5 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html |
@@ -1,50 +1,25 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src="/media-resources/video-test.js"></script> |
- </head> |
- <body> |
- <video autoplay controls="controls" id='vid'></video> |
- <p>Tests that sourceopen event fires even if garbage collection happens between setting video.src & the sourceopen event.</p> |
- <script type="text/javascript"> |
- var sourceOpened = false; |
+<title>Tests that "sourceopen" event fires even if garbage collection happens between setting "video.src" and the "sourceopen" event.</title> |
+<script src="/w3c/resources/testharness.js"></script> |
+<script src="/w3c/resources/testharnessreport.js"></script> |
+<video></video> |
+<script> |
+async_test(function(t) { |
+ var video = document.querySelector('video'); |
+ video.onstalled = t.unreached_func(); |
- function createMediaSourceURL() |
- { |
- var mediaSource = new MediaSource(); |
- var onSourceOpen = function (e) |
- { |
- sourceOpened = true; |
- consoleWrite("onSourceOpen called."); |
- endTest(); |
- }; |
- consoleWrite("Setting sourceopen event listener."); |
- mediaSource.addEventListener('sourceopen', onSourceOpen); |
- return window.URL.createObjectURL(mediaSource); |
- } |
+ var url = createMediaSourceURL(); |
+ // Running garbage collector. |
+ gc(); |
- function start() |
- { |
- var video = document.getElementById('vid'); |
- var onStalled = function (e) |
- { |
- if (sourceOpened) |
- return; |
+ // Setting video.src to object URL. |
+ video.src = url; |
- failTest('stalled event fired before sourceopen'); |
- }; |
- video.addEventListener('stalled', onStalled); |
- |
- var url = createMediaSourceURL(); |
- consoleWrite("Running garbage collector."); |
- gc(); |
- |
- consoleWrite("Setting video.src to object URL."); |
- video.src = url; |
- } |
- start(); |
- </script> |
- </body> |
-</html> |
+ function createMediaSourceURL() { |
+ var mediaSource = new MediaSource(); |
+ // Setting sourceopen event listener. |
+ mediaSource.onsourceopen = t.step_func_done(); |
+ return URL.createObjectURL(mediaSource); |
+ } |
+}); |
+</script> |