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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.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
Index: third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
index 7d9792f77ebf9844014da7a6e81ec0c51aff3d2c..7b7ea337fb06c28d0e643dd56176d4682375dce3 100644
--- a/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
+++ b/third_party/WebKit/LayoutTests/http/tests/media/media-source/mediasource-htmlmediaelement-lifetime.html
@@ -1,50 +1,28 @@
<!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 src="/w3c/resources/testharness.js"></script>
- <script src="/w3c/resources/testharnessreport.js"></script>
- <script src="mediasource-util.js"></script>
- </head>
- <body>
- <div id="log"></div>
- <script>
- window.jsTestIsAsync = true;
+<title>Tests that the MediaSource keeps the HTMLMediaElement alive.</title>
+<script src="/w3c/resources/testharness.js"></script>
+<script src="/w3c/resources/testharnessreport.js"></script>
+<script>
+async_test(function(test) {
+ var video = document.createElement("video");
+ var mediaSource = new MediaSource();
- async_test(function(test)
- {
- var video = document.createElement("video");
- var ms = new MediaSource();
+ mediaSource.onsourceopen = test.step_func(function() {
+ // sourceOpened called.
+ var buffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
- function sourceOpened()
- {
- consoleWrite("sourceOpened called.");
- var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"');
+ // Running the garbage collector.
+ video = null;
+ gc();
- consoleWrite("Running the garbage collector.");
- video = null;
- asyncGC(test.step_func(function()
- {
- assert_equals(ms.readyState, "open", "MediaSource object is open.");
+ setTimeout(test.step_func(function() {
+ assert_equals(mediaSource.readyState, "open", "MediaSource object is open.");
+ // Setting MediaSource duration.
+ mediaSource.duration = 100;
+ }), 0);
+ });
- consoleWrite("Setting MediaSource duration.");
- ms.duration = 100;
- }));
- }
-
- function durationChanged()
- {
- consoleWrite("durationChanged called.");
- test.done();
- }
-
- ms.addEventListener("sourceopen", test.step_func(sourceOpened));
- video.addEventListener("durationchange", test.step_func(durationChanged));
- video.src = window.URL.createObjectURL(ms);
- }, "Tests that the MediaSource keeps the HTMLMediaElement alive.");
- </script>
- </body>
-</html>
+ video.ondurationchange = test.step_func_done();
+ video.src = URL.createObjectURL(mediaSource);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698