Index: third_party/WebKit/LayoutTests/media/track/track-change-event.html |
diff --git a/third_party/WebKit/LayoutTests/media/track/track-change-event.html b/third_party/WebKit/LayoutTests/media/track/track-change-event.html |
index 8ebe732641b398125efd8a3aa1cbe3431ffb2688..f08f6ef16224b6b1781a5c8a766fb17123269352 100644 |
--- a/third_party/WebKit/LayoutTests/media/track/track-change-event.html |
+++ b/third_party/WebKit/LayoutTests/media/track/track-change-event.html |
@@ -1,48 +1,21 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
- |
- <script src=../media-file.js></script> |
- <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956 |
- (Please avoid writing new tests using video-test.js) --> |
- <script src=../video-test.js></script> |
- <script> |
- |
- var track; |
- |
- function changed() |
- { |
- consoleWrite("EVENT(" + event.type + ")"); |
- |
- testExpected("event.target", video.textTracks); |
- testExpected("event instanceof window.Event", true); |
- testExpected("event.track", undefined); |
- |
- consoleWrite(""); |
- endTest(); |
- } |
- |
- function start() |
- { |
- findMediaElement(); |
- |
- consoleWrite("** Test a TextTrack created with addTextTrack()."); |
- run("track = video.addTextTrack('subtitles', 'test', 'en')"); |
- |
- /* addTextTrack() defaults to "hidden", so "showing" should trigger |
- * a "change" event. */ |
- run("track.mode = 'showing'"); |
- testExpected("video.textTracks.length", 1); |
- |
- video.textTracks.addEventListener("change", changed); |
- } |
- |
- </script> |
- </head> |
- <body onload="start()"> |
- <p>Tests that the 'change' event is fired when a TextTrack's mode changes.</p> |
- <video> |
- </video> |
- </body> |
-</html> |
+<title>Tests that the 'change' event is fired when a TextTrack's mode changes.</title> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+async_test(function(t) { |
+ var video = document.createElement('video'); |
+ var track = video.addTextTrack('subtitles', 'test', 'en'); |
+ |
+ // addTextTrack() defaults to "hidden", so "showing" |
+ // should trigger a "change" event. |
+ track.mode = 'showing'; |
+ assert_equals(video.textTracks.length, 1); |
+ |
+ video.textTracks.onchange = t.step_func_done(function() { |
+ assert_equals(event.target, video.textTracks); |
+ assert_true(event instanceof Event, 'instanceof'); |
+ assert_equals(event.track, undefined); |
+ }); |
+}); |
+</script> |