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="/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 <script> |
| 13 window.jsTestIsAsync = true; |
| 14 |
| 15 async_test(function(test) |
| 16 { |
| 17 var video = document.createElement("video"); |
| 18 var ms = new MediaSource(); |
| 19 |
| 20 function sourceOpened() |
| 21 { |
| 22 consoleWrite("sourceOpened called."); |
| 23 var buffer = ms.addSourceBuffer('video/webm; codecs="vorbis,vp
8"'); |
| 24 |
| 25 consoleWrite("Running the garbage collector."); |
| 26 video = null; |
| 27 asyncGC(test.step_func(function() |
| 28 { |
| 29 assert_equals(ms.readyState, "open", "MediaSource object i
s open."); |
| 30 |
| 31 consoleWrite("Setting MediaSource duration."); |
| 32 ms.duration = 100; |
| 33 })); |
| 34 } |
| 35 |
| 36 function durationChanged() |
| 37 { |
| 38 consoleWrite("durationChanged called."); |
| 39 test.done(); |
| 40 } |
| 41 |
| 42 ms.addEventListener("sourceopen", test.step_func(sourceOpened)); |
| 43 video.addEventListener("durationchange", test.step_func(durationCh
anged)); |
| 44 video.src = window.URL.createObjectURL(ms); |
| 45 }, "Tests that the MediaSource keeps the HTMLMediaElement alive."); |
| 46 </script> |
| 47 </body> |
| 48 </html> |
OLD | NEW |