Chromium Code Reviews| 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..4cae7336a0366bf72d743dd6922b8602ec13e2ea 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,21 @@ |
| <!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() |
|
fs
2016/07/28 17:18:03
It may be reasonable to keep this helper, to avoid
Srirama
2016/07/29 10:21:28
Done.
|
| - { |
| - 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 mediaSource = new MediaSource(); |
| + // Setting sourceopen event listener. |
| + mediaSource.onsourceopen = t.step_func_done(); |
| + var url = URL.createObjectURL(mediaSource); |
| + // Running garbage collector. |
| + gc(); |
| - function start() |
| - { |
| - var video = document.getElementById('vid'); |
| - var onStalled = function (e) |
| - { |
| - if (sourceOpened) |
| - return; |
| - |
| - 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> |
| + // Setting video.src to object URL. |
| + video.src = url; |
| +}); |
| +</script> |