OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test that an explicit load() to a media element whose preload is set to "
none" still loads the video.</title> |
3 <script src="media-file.js"></script> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-file.js"></script> |
6 <script src="video-test.js"></script> | 6 <video preload="none"></video> |
7 <script> | 7 <script> |
8 function start() | 8 async_test(function(t) { |
9 { | 9 var video = document.querySelector("video"); |
10 findMediaElement(); | |
11 video.src = findMediaFile("video", "content/test"); | |
12 | 10 |
13 testExpected("video.preload", "none"); | 11 assert_equals(video.preload, "none"); |
14 testExpected("video.readyState", HTMLMediaElement.HAVE_NOTHING); | 12 assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING); |
15 waitForEventAndEnd('loadedmetadata'); | 13 video.onloadedmetadata = t.unreached_func(); |
16 | 14 |
17 // Wait 250ms before load()ing to make sure setting src does not
kick off the load | 15 // Wait 500ms before load()ing to make sure setting src does not |
18 // (i.e. preload=none should still be respected). | 16 // kick off the load (i.e. preload=none should still be respected). |
19 setTimeout(load, 250); | 17 setTimeout(function() { |
20 } | 18 assert_equals(video.readyState, HTMLMediaElement.HAVE_NOTHING); |
21 function load() | 19 video.onloadedmetadata = t.step_func_done(); |
22 { | 20 video.load(); |
23 testExpected("video.readyState", HTMLMediaElement.HAVE_NOTHING); | 21 }, 300); |
24 run("video.load()"); | |
25 } | |
26 </script> | |
27 </head> | |
28 | 22 |
29 <body> | 23 video.src = findMediaFile("video", "content/test"); |
30 <video preload="none"></video> | 24 }); |
31 <p>Test that an explicit load() to a media element whose preload is set
to "none" still loads the video.</p> | 25 </script> |
32 <script>start();</script> | |
33 </body> | |
34 </html> | |
OLD | NEW |