Chromium Code Reviews| Index: third_party/WebKit/LayoutTests/media/audio-play-event.html |
| diff --git a/third_party/WebKit/LayoutTests/media/audio-play-event.html b/third_party/WebKit/LayoutTests/media/audio-play-event.html |
| index d20c9086c498ab8d35d89665820c949664477e05..41b9e9a09d8404d7b55161ca5f9df2a7fa1a6975 100644 |
| --- a/third_party/WebKit/LayoutTests/media/audio-play-event.html |
| +++ b/third_party/WebKit/LayoutTests/media/audio-play-event.html |
| @@ -1,28 +1,26 @@ |
| -<html> |
| - <head> |
| - <title>'play' event</title> |
| - <script src=media-file.js></script> |
| - <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 |
| - (Please avoid writing new tests using video-test.js) --> |
| - <script src=video-test.js></script> |
| - |
| - <script> |
| - function start() |
| - { |
| - mediaElement = new Audio(); |
| - waitForEvent('error'); |
| - waitForEvent('loadedmetadata'); |
| - waitForEvent('canplay'); |
| - waitForEvent('play'); |
| - waitForEvent('playing', function() { endTest(); }); |
| - run("mediaElement.src = findMediaFile('audio', 'content/test')"); |
| - run("mediaElement.volume = 1"); |
| - run("mediaElement.play()"); |
| - } |
| - </script> |
| - </head> |
| - |
| - <body onload="start()"> |
| - <p>Test that a 'play' event listener is triggered when fired by a new audio element.</p> |
| - </body> |
| -</html> |
| +<!DOCTYPE HTML> |
| +<title>Test that a 'play' event is fired by a new audio element on playing.</title> |
| +<script src="media-file.js"></script> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| +<script> |
| +async_test(function(t) { |
| + var eventCount = 0; |
| + var audio = new Audio(); |
| + audio.onplay = t.step_func(function() { |
| + eventCount++; |
|
Srirama
2016/05/26 17:39:32
Should i reset each event to null so that it won't
fs
2016/05/26 18:29:21
If there were risk of seeing the same event twice
Srirama
2016/05/26 18:54:29
Done.
|
| + }); |
| + audio.onloadedmetadata = t.step_func(function() { |
| + eventCount++; |
| + }); |
| + audio.oncanplay = t.step_func(function() { |
| + eventCount++; |
| + }); |
| + audio.onplaying = t.step_func_done(function() { |
| + assert_equals(eventCount, 3); |
| + }); |
| + audio.onerror = t.unreached_func("Should not fire 'error' event"); |
| + audio.src = findMediaFile("audio", "content/test"); |
| + audio.play(); |
| +}); |
| +</script> |