Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-crash.html |
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-crash.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-crash.html |
index e2193a8a1be913c818ea9a6ffb7a27352a9245d6..d3dfbdab5e58d29cff478596bd1d7b24d0167794 100644 |
--- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-crash.html |
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-sourcebufferlist-crash.html |
@@ -1,42 +1,23 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <script src="/js-test-resources/js-test.js"></script> |
- <!-- 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> |
- <script type="text/javascript"> |
- function onSourceOpen(e) |
- { |
- consoleWrite("Calling addSourceBuffer()"); |
- e.target.addSourceBuffer('video/webm;codecs="vp8"'); |
+<title>Verify that we don't crash on close if the MediaSource.sourceBuffers holds the last reference to its SourceBuffer objects.</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.createElement("video"); |
+ var mediaSource = new MediaSource(); |
- consoleWrite("Running garbage collector to cleanup the SourceBuffer reference returned by addSourceBuffer()"); |
- gc(); |
+ mediaSource.addEventListener('sourceopen', function() { |
+ mediaSource.addSourceBuffer('video/webm;codecs="vp8"'); |
- document.querySelector('#v').src = ""; |
- } |
+ // Running garbage collector to cleanup the SourceBuffer reference returned by addSourceBuffer(). |
+ gc(); |
- function onSourceClose(e) |
- { |
- consoleWrite("onSourceClose"); |
- endTest(); |
- } |
+ video.src = ""; |
+ }); |
- function main() |
- { |
- var video = document.querySelector('#v'); |
- var mediaSource = new MediaSource(); |
- |
- mediaSource.addEventListener('sourceopen', onSourceOpen); |
- mediaSource.addEventListener('sourceclose', onSourceClose); |
- |
- video.src = URL.createObjectURL(mediaSource); |
- } |
- </script> |
- </head> |
- <body onload="main()"> |
- <video id="v"></video> |
- <p>Verify that we don't crash on close if the MediaSource.sourceBuffers holds the last reference to its SourceBuffer objects.</p> |
- </body> |
-</html> |
+ mediaSource.onsourceclose = t.step_func_done(); |
+ video.src = URL.createObjectURL(mediaSource); |
+}); |
+</script> |