Index: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.html |
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.html |
index 8508619f73650b71af152d9f4b85179db78ffe4a..773c1d3cb919e1fbb49d6ed9e56c03ec61b20a81 100644 |
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.html |
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc008-timings-no-hours.html |
@@ -1,76 +1,67 @@ |
<!DOCTYPE html> |
-<html> |
- <head> |
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
+<title>Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.</title> |
+<script src="track-helpers.js"></script> |
+<script src="../../resources/testharness.js"></script> |
+<script src="../../resources/testharnessreport.js"></script> |
+<video> |
+ <track src="captions-webvtt/tc008-timings-no-hour.vtt"> |
+ <track src="captions-webvtt/tc008-timings-no-hour-errors.vtt"> |
+</video> |
+<script> |
+async_test(function(t) { |
+ var video = document.querySelector("video"); |
- <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 trackElements = document.querySelectorAll("track"); |
+ for (var i = 0; i < video.textTracks.length; i++) |
+ trackElements[i].onload = t.step_func(trackLoaded); |
- numberOfTrackTests = 2; |
+ enableAllTextTracks(video.textTracks); |
- function trackLoaded() |
- { |
- numberOfTracksLoaded++; |
- if (numberOfTracksLoaded == numberOfTrackTests) { |
- testTrack0(); |
- testTrack1(); |
- } |
- } |
+ var numberOfTracksLoaded = 0; |
+ function trackLoaded() { |
+ numberOfTracksLoaded++; |
+ if (numberOfTracksLoaded != 2) |
+ return; |
- function testTrack0() |
- { |
- findMediaElement(); |
- var expected = |
- { |
- length : 4, |
- tests: |
- [ |
- { |
- property : "id", |
- values : ["1", "2", "3", "4"], |
- }, |
- { |
- property : "startTime", |
- values : [0.0, 31.0, 61.0, 121.0], |
- }, |
- { |
- property : "endTime", |
- values : [30.5, 60.5, 120.5, 180.5], |
- }, |
- { |
- property : "text", |
- values : ["Bear is Coming!!!!!", "I said Bear is coming!!!!", "I said Bear is coming now!!!!", "tab separators"], |
- }, |
- ], |
- }; |
- testCues(0, expected); |
+ testTrack0(); |
+ testTrack1(); |
+ t.done(); |
+ } |
- allTestsEnded(); |
+ function testTrack0() { |
+ var expected = [ |
+ { |
+ id : "1", |
+ startTime : 0, |
+ endTime : 30.5, |
+ text : "Bear is Coming!!!!!" |
+ }, |
+ { |
+ id : "2", |
+ startTime : 31, |
+ endTime : 60.5, |
+ text : "I said Bear is coming!!!!" |
+ }, |
+ { |
+ id : "3", |
+ startTime : 61, |
+ endTime : 120.5, |
+ text : "I said Bear is coming now!!!!" |
+ }, |
+ { |
+ id : "4", |
+ startTime : 121, |
+ endTime : 180.5, |
+ text : "tab separators" |
} |
+ ]; |
- function testTrack1() |
- { |
- findMediaElement(); |
- var expected = |
- { |
- length : 0, |
- tests: |
- [], |
- }; |
- testCues(1, expected); |
+ assert_cues_equal(video.textTracks[0].cues, expected); |
+ } |
- allTestsEnded(); |
- } |
- </script> |
- </head> |
- <body onload="enableAllTextTracks()"> |
- <p>Tests cue timings that do not contain hours (they are optional), and tests various syntax errors in timings without hours.</p> |
- <video> |
- <track src="captions-webvtt/tc008-timings-no-hour.vtt" onload="trackLoaded()"> |
- <track src="captions-webvtt/tc008-timings-no-hour-errors.vtt" onload="trackLoaded()"> |
- </video> |
- </body> |
-</html> |
+ function testTrack1() { |
+ // Test that all the cues are ignored. |
+ assert_cues_equal(video.textTracks[1].cues, []); |
+ } |
+}); |
+</script> |