OLD | NEW |
| (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="webkitmediasource-util.js"></script> | |
7 | |
8 <script> | |
9 window.jsTestIsAsync = true; | |
10 | |
11 var ms = new WebKitMediaSource(); | |
12 | |
13 function sourceOpened() | |
14 { | |
15 consoleWrite("sourceOpened called."); | |
16 var vid = document.getElementById('vid'); | |
17 var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp8"')
; | |
18 | |
19 MediaSourceTest.expectSourceState(ms, "open"); | |
20 | |
21 consoleWrite("Removing video element from DOM."); | |
22 vid.parentNode.removeChild(vid); | |
23 vid = null; | |
24 | |
25 consoleWrite("Running the garbage collector."); | |
26 asyncGC(function() { | |
27 MediaSourceTest.expectSourceState(ms, "closed"); | |
28 | |
29 try { | |
30 buffer.timestampOffset = 42; | |
31 failTest("Expected an exception"); | |
32 } catch (e) { | |
33 consoleWrite("Setting timestampOffset failed as expected:
" + e.name); | |
34 } | |
35 | |
36 endTest(); | |
37 }); | |
38 } | |
39 | |
40 function sourceClosed() | |
41 { | |
42 consoleWrite("sourceClosed called."); | |
43 } | |
44 | |
45 function onLoad() | |
46 { | |
47 waitForEventAndFail('error'); | |
48 | |
49 ms.addEventListener('webkitsourceopen', sourceOpened); | |
50 ms.addEventListener('webkitsourceclose', sourceClosed); | |
51 | |
52 document.getElementById('vid').src = window.URL.createObjectURL(ms
); | |
53 } | |
54 </script> | |
55 </head> | |
56 <body onload="onLoad()"> | |
57 <video id="vid"></video> | |
58 <p>Tests that the MediaSource is closed when the HTMLMediaElement is destr
oyed.</p> | |
59 </body> | |
60 </html> | |
OLD | NEW |