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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <title>Tests that the MediaSource keeps the HTMLMediaElement alive.</title>
3 <head> 3 <script src="/w3c/resources/testharness.js"></script>
4 <script src="/js-test-resources/js-test.js"></script> 4 <script src="/w3c/resources/testharnessreport.js"></script>
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 5 <script>
6 (Please avoid writing new tests using video-test.js) --> 6 async_test(function(test) {
7 <script src="/media-resources/video-test.js"></script> 7 var video = document.createElement("video");
8 <script src="/w3c/resources/testharness.js"></script> 8 var mediaSource = new MediaSource();
9 <script src="/w3c/resources/testharnessreport.js"></script>
10 <script src="mediasource-util.js"></script>
11 </head>
12 <body>
13 <div id="log"></div>
14 <script>
15 window.jsTestIsAsync = true;
16 9
17 async_test(function(test) 10 mediaSource.onsourceopen = test.step_func(function() {
18 { 11 // sourceOpened called.
19 var video = document.createElement("video"); 12 var buffer = mediaSource.addSourceBuffer('video/webm; codecs="vorbis,vp8 "');
20 var ms = new MediaSource();
21 13
22 function sourceOpened() 14 // Running the garbage collector.
23 { 15 video = null;
24 consoleWrite("sourceOpened called."); 16 gc();
25 var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp 8"');
26 17
27 consoleWrite("Running the garbage collector."); 18 setTimeout(test.step_func(function() {
28 video = null; 19 assert_equals(mediaSource.readyState, "open", "MediaSource object is open.");
29 asyncGC(test.step_func(function() 20 // Setting MediaSource duration.
30 { 21 mediaSource.duration = 100;
31 assert_equals(ms.readyState, "open", "MediaSource object i s open."); 22 }), 0);
23 });
32 24
33 consoleWrite("Setting MediaSource duration."); 25 video.ondurationchange = test.step_func_done();
34 ms.duration = 100; 26 video.src = URL.createObjectURL(mediaSource);
35 })); 27 });
36 } 28 </script>
37
38 function durationChanged()
39 {
40 consoleWrite("durationChanged called.");
41 test.done();
42 }
43
44 ms.addEventListener("sourceopen", test.step_func(sourceOpened));
45 video.addEventListener("durationchange", test.step_func(durationCh anged));
46 video.src = window.URL.createObjectURL(ms);
47 }, "Tests that the MediaSource keeps the HTMLMediaElement alive.");
48 </script>
49 </body>
50 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698