OLD | NEW |
1 <html> | 1 <!DOCTYPE HTML> |
2 <head> | 2 <title>Test that a 'play' event is fired by a new audio element on playing.</tit
le> |
3 <title>'play' event</title> | 3 <script src="media-file.js"></script> |
4 <script src=media-file.js></script> | 4 <script src="../resources/testharness.js"></script> |
5 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 5 <script src="../resources/testharnessreport.js"></script> |
6 (Please avoid writing new tests using video-test.js) --> | 6 <script> |
7 <script src=video-test.js></script> | 7 async_test(function(t) { |
8 | 8 var audio = new Audio(); |
9 <script> | 9 audio.onplay = t.step_func(function() {}); |
10 function start() | 10 audio.onloadedmetadata = t.step_func(function() {}); |
11 { | 11 audio.oncanplay = t.step_func(function() {}); |
12 mediaElement = new Audio(); | 12 audio.onplaying = t.step_func_done(); |
13 waitForEvent('error'); | 13 audio.onerror = t.unreached_func("Should not fire 'error' event"); |
14 waitForEvent('loadedmetadata'); | 14 audio.src = findMediaFile("audio", "content/test"); |
15 waitForEvent('canplay'); | 15 audio.play(); |
16 waitForEvent('play'); | 16 }); |
17 waitForEvent('playing', function() { endTest(); }); | 17 </script> |
18 run("mediaElement.src = findMediaFile('audio', 'content/test')")
; | |
19 run("mediaElement.volume = 1"); | |
20 run("mediaElement.play()"); | |
21 } | |
22 </script> | |
23 </head> | |
24 | |
25 <body onload="start()"> | |
26 <p>Test that a 'play' event listener is triggered when fired by a new audio
element.</p> | |
27 </body> | |
28 </html> | |
OLD | NEW |