OLD | NEW |
1 <body> | 1 <!DOCTYPE html> |
2 <p>Test that Audio() object loads the resource after src attribute is set and lo
ad() is called.</p> | 2 <title>Test that Audio() object loads the resource after src attribute is set an
d load() is called.</title> |
| 3 <script src="media-file.js"></script> |
| 4 <script src="../resources/testharness.js"></script> |
| 5 <script src="../resources/testharnessreport.js"></script> |
| 6 <script> |
| 7 async_test(function(t) { |
| 8 var audio = new Audio(); |
3 | 9 |
4 <script src=media-file.js></script> | 10 var audioFile = findMediaFile("audio", "content/test"); |
5 <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 | 11 audio.src = audioFile; |
6 (Please avoid writing new tests using video-test.js) --> | 12 audio.onloadstart = t.step_func(function () { |
7 <script src=video-test.js></script> | 13 var url = audio.currentSrc; |
| 14 assert_equals(url.substr(url.lastIndexOf("/media/")+7), audioFile); |
| 15 }); |
8 | 16 |
9 <script> | 17 audio.oncanplaythrough = t.step_func_done(); |
10 var audio = new Audio(); | |
11 mediaElement = audio; | |
12 | 18 |
13 testExpected("audio instanceof HTMLAudioElement", true); | 19 audio.load(); |
14 | 20 }); |
15 var mediaFile = findMediaFile("audio", "content/test"); | 21 </script> |
16 waitForEvent("loadstart", function () { testExpected("relativeURL(audio.curr
entSrc)", mediaFile); }); | |
17 | |
18 waitForEventAndEnd("canplaythrough"); | |
19 | |
20 audio.src = mediaFile; | |
21 run("audio.load()"); | |
22 </script> | |
OLD | NEW |