Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(683)

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen.html

Issue 2192713003: Convert mediasource http tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comment Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 &amp; 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>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-garbage-collection-before-sourceopen-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698