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

Side by Side Diff: LayoutTests/http/tests/media/media-source/mediasource-closed-on-htmlmediaelement-destruction.html

Issue 245893002: Improve unprefixed MediaSource test coverage. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="/js-test-resources/js-test.js"></script>
5 <script src="/media-resources/video-test.js"></script>
6 <script src="/w3c/resources/testharness.js"></script>
7 <script src="/w3c/resources/testharnessreport.js"></script>
8 <script src="mediasource-util.js"></script>
9 </head>
10 <body>
11 <div id="log"></div>
12 <video id="vid"></video>
13 <script>
14 window.jsTestIsAsync = true;
15
16 async_test(function(test)
17 {
18 var ms = new MediaSource();
19
20 function sourceOpened()
21 {
22 consoleWrite("sourceOpened called.");
23 var vid = document.getElementById('vid');
24 var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp 8"');
25
26 consoleWrite("Removing video element from DOM.");
27 vid.parentNode.removeChild(vid);
28 vid = null;
29
30 consoleWrite("Running the garbage collector.");
31 asyncGC(test.step_func(function()
32 {
33 assert_equals(ms.readyState, "closed", "MediaSource object is closed.");
34
35 assert_throws( { name: "InvalidStateError"} ,
36 function() { buffer.timestampOffset = 42; },
37 "buffer.timestampOffset threw an exception as expected in the 'closed' state.");
38
39 test.done();
40 }));
41 }
42
43 function sourceClosed()
44 {
45 consoleWrite("sourceClosed called.");
46 }
47
48 ms.addEventListener('sourceopen', test.step_func(sourceOpened));
49 ms.addEventListener('sourceclose', test.step_func(sourceClosed));
50 document.getElementById('vid').src = window.URL.createObjectURL(ms );
51 }, "Tests that the MediaSource is closed when the HTMLMediaElement is destroyed.");
52 </script>
53 </body>
54 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698