Index: third_party/WebKit/LayoutTests/media/track/track-default-attribute.html |
diff --git a/third_party/WebKit/LayoutTests/media/track/track-default-attribute.html b/third_party/WebKit/LayoutTests/media/track/track-default-attribute.html |
index 53600d8fa7d3398420328ea69090c7f8925468bb..1ff2ecd65d4c994cf95a2790baae83c0d4a8abff 100644 |
--- a/third_party/WebKit/LayoutTests/media/track/track-default-attribute.html |
+++ b/third_party/WebKit/LayoutTests/media/track/track-default-attribute.html |
@@ -1,36 +1,26 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <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 timer = null; |
- |
- function trackLoaded() |
- { |
- consoleWrite("EVENT(load)"); |
- testExpected("event.target.readyState", HTMLTrackElement.LOADED); |
- testExpected("event.target.id", "default"); |
- testExpected("event.target.default", true); |
- consoleWrite(""); |
- |
- // End the test after a brief pause so we allow other tracks to load if they will. |
- if (timer) |
- clearTimeout(timer); |
- timer = setTimeout(function() { endTest() }, 200); |
- } |
- |
- </script> |
- </head> |
- <body> |
- <p>Tests that a track with the 'default' attribute loads automatically.</p> |
- <video> |
- <track kind="captions" src="captions-webvtt/tc005-default-styles.vtt" onload="trackLoaded()"> |
- <track kind="captions" src="captions-webvtt/tc005-metadata-area.vtt" onload="trackLoaded()"> |
- <track default kind="captions" src="captions-webvtt/tc004-webvtt-file.vtt" onload="trackLoaded()" id="default" > |
- </video> |
- </body> |
-</html> |
+<title>Tests that a track with the "default" attribute loads automatically.</title> |
+<video> |
+ <track kind="captions" src="captions-webvtt/tc005-default-styles.vtt"> |
+ <track kind="captions" src="captions-webvtt/tc005-metadata-area.vtt"> |
+ <track default kind="captions" src="captions-webvtt/tc004-webvtt-file.vtt" id="default"> |
+</video> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<script> |
+async_test(function(t) { |
+ var timer = null; |
+ var tracks = document.querySelectorAll("track"); |
+ for (var track of tracks) { |
+ track.onload = t.step_func(function() { |
+ assert_equals(event.target.readyState, HTMLTrackElement.LOADED); |
+ assert_equals(event.target.id, "default"); |
+ assert_true(event.target.default); |
+ // End the test after a brief pause so we allow other tracks to load if they will. |
+ if (timer) |
+ clearTimeout(timer); |
+ timer = setTimeout(function() { t.done(); }, 200); |
+ }); |
+ } |
+}); |
+</script> |