OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that removing a media element from the tree pauses playback but does
not unload the media.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <script src=media-file.js></script> | 4 <script src="../resources/testharnessreport.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <script src="media-file.js"></script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <video autoplay></video> |
7 <script src=video-test.js></script> | 7 <script> |
8 <script type="text/javascript" charset="utf-8"> | 8 async_test(function(t) { |
9 function doSetup() | 9 var video = document.querySelector("video"); |
10 { | 10 video.src = findMediaFile("video", "content/test"); |
11 video = document.getElementsByTagName('video')[0]; | |
12 video.src = findMediaFile("video", "content/test"); | |
13 } | |
14 | 11 |
15 function doTest () | 12 video.oncanplaythrough = t.step_func_done(function() { |
16 { | 13 assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY); |
17 consoleWrite("EVENT(canplaythrough)"); | 14 assert_false(video.paused); |
18 testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY, "
!="); | |
19 testExpected("video.paused", false); | |
20 | 15 |
21 run("document.body.removeChild(video)"); | 16 document.body.removeChild(video); |
22 | 17 |
23 testExpected("video.networkState", HTMLMediaElement.NETWORK_EMPTY, "
!="); | 18 assert_not_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY); |
24 testExpected("video.paused", true); | 19 assert_true(video.paused); |
25 | 20 }); |
26 document.body.offsetTop; | 21 }); |
27 endTest(); | 22 </script> |
28 } | |
29 | |
30 window.addEventListener('load', doSetup, false); | |
31 </script> | |
32 </head> | |
33 <body> | |
34 <p>Test that removing a media element from the tree pauses playback but does
not unload the media.</p> | |
35 <video controls autoplay oncanplaythrough="doTest()"></video> | |
36 </body> | |
37 </html> | |
OLD | NEW |