Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html

Issue 2051233004: Convert track-webvtt-tc[024-026] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html
index d45fee55331c3d8dc85973ae93137f81922d041a..f41448a68432b47f03f2755a7595e1a699919cc6 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc024-timestamp.html
@@ -1,80 +1,36 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Tests cues with &lt;timestamps&gt; tags.</title>
+<script src="track-helpers.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+check_cues_from_track("captions-webvtt/tc024-timestamp.vtt", function(track) {
+ assert_equals(track.cues.length, 3);
- <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>
+ // TODO(srirama.m): Timestamps are handled as ProcessingInstructions,
+ // but because ProcessingInstructions are used in XML and not HTML,
+ // they are ignored here. This should later be tested with oncuechange events.
- var numberOfTrackTests = 2;
+ var children = [ { type: "text", value: "This cue is painted on." } ];
+ assert_cue_fragment_as_textcontent(track.cues[0], children);
- function trackLoaded()
- {
- numberOfTracksLoaded++;
- if (numberOfTracksLoaded == numberOfTrackTests) {
- testTrack(0);
- testTrackError(1);
- }
- }
+ children = [ { type: "text", value: "I said Bear is coming!!!!" } ];
+ assert_cue_fragment_as_textcontent(track.cues[1], children);
- function testTrack(i)
- {
- findMediaElement();
- testExpected("video.textTracks[" + i + "].cues.length", "3");
+ children = [ { type: "text", value: "I said Bear is coming now!!!!" } ];
+ assert_cue_fragment_as_textcontent(track.cues[2], children);
+});
- // Note: Timestamps are handled as ProcessingInstructions, but because ProcessingInstructions
- // are used in XML and not HTML, they are ignored here.
- // This should later be tested with oncuechange events.
- var fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("This cue is painted on."));
+check_cues_from_track("captions-webvtt/tc024-timestamp-bad.vtt", function(track) {
+ assert_equals(track.cues.length, 3);
- testExpected("video.textTracks[" + i + "].cues[0].getCueAsHTML().textContent", fragment.textContent);
+ var children = [ { type: "text", value: "This cue is painted on.\nBut since the last two timestamps are out of order, they are ignored." } ];
+ assert_cue_fragment_as_textcontent(track.cues[0], children);
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said Bear is coming!!!!"));
+ children = [ { type: "text", value: "I said Bear is coming!!!!\nAll of these timestamps are before the start of the cue, so get ignored." } ];
+ assert_cue_fragment_as_textcontent(track.cues[1], children);
- testExpected("video.textTracks[" + i + "].cues[1].getCueAsHTML().textContent", fragment.textContent);
-
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said Bear is coming now!!!!"));
-
- testExpected("video.textTracks[" + i + "].cues[2].getCueAsHTML().textContent", fragment.textContent);
-
- allTestsEnded();
- }
-
- function testTrackError(i)
- {
- findMediaElement();
- testExpected("video.textTracks[" + i + "].cues.length", "3");
-
- var fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("This cue is painted on.\nBut since the last two timestamps are out of order, they are ignored."));
-
- testExpected("video.textTracks[" + i + "].cues[0].getCueAsHTML().textContent", fragment.textContent);
-
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said Bear is coming!!!!\nAll of these timestamps are before the start of the cue, so get ignored."));
-
- testExpected("video.textTracks[" + i + "].cues[1].getCueAsHTML().textContent", fragment.textContent);
-
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said Bear is coming now!!!!\nAll of these timestamps are after the end of the cue, so get ignored."));
-
- testExpected("video.textTracks[" + i + "].cues[2].getCueAsHTML().textContent", fragment.textContent);
-
- allTestsEnded();
- }
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests cues with &lt;timestamps&gt; tags.</p>
- <video>
- <track src="captions-webvtt/tc024-timestamp.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc024-timestamp-bad.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+ children = [ { type: "text", value: "I said Bear is coming now!!!!\nAll of these timestamps are after the end of the cue, so get ignored." } ];
+ assert_cue_fragment_as_textcontent(track.cues[2], children);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698