OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test that Audio() sets "preload" attribute.</title> |
3 <script src=media-file.js></script> | 3 <script src="media-file.js"></script> |
4 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharness.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="../resources/testharnessreport.js"></script> |
6 <script src=video-test.js></script> | 6 <script> |
| 7 async_test(function(t) { |
| 8 var audio = new Audio(); |
7 | 9 |
8 <script> | 10 // Test initial attribute value. |
| 11 assert_equals(audio.getAttribute("preload"), "auto"); |
| 12 assert_equals(audio.preload, "auto"); |
9 | 13 |
10 function canplaythrough() | 14 audio.oncanplaythrough = t.step_func_done(function() { |
11 { | 15 assert_equals(audio.getAttribute("preload"), "auto"); |
12 consoleWrite("++ Test after 'canplaythrough' event"); | 16 assert_equals(audio.preload, "auto"); |
13 testExpected("mediaElement.getAttribute('preload')", "auto"); | 17 }); |
14 testExpected("mediaElement.preload", "auto"); | |
15 endTest(); | |
16 } | |
17 | 18 |
18 function start() | 19 audio.src = findMediaFile("audio", "content/test"); |
19 { | 20 audio.load(); |
20 run("mediaElement = new Audio()"); | 21 }); |
21 consoleWrite(""); | 22 </script> |
22 | |
23 consoleWrite("++ Test initial attribute value"); | |
24 testExpected("mediaElement.getAttribute('preload')", "auto"); | |
25 testExpected("mediaElement.preload", "auto"); | |
26 consoleWrite(""); | |
27 | |
28 mediaElement.addEventListener("canplaythrough", canplaythrough); | |
29 run("mediaElement.src = '" + findMediaFile("audio", "content/tes
t") + "'"); | |
30 run("mediaElement.load()"); | |
31 | |
32 consoleWrite(""); | |
33 } | |
34 | |
35 </script> | |
36 </head> | |
37 | |
38 <body onload="start()"> | |
39 <p>Test that Audio() sets 'preload' attribute.</p> | |
40 </body> | |
41 </html> | |
OLD | NEW |