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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc025-class-markup.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-tc025-class-markup.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc025-class-markup.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc025-class-markup.html
index d69943d6c51996257438199fd3af3804495b0a5f..aa46bed6adc79ef10bcf3078eb03a01b9af26a4f 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc025-class-markup.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc025-class-markup.html
@@ -1,100 +1,55 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <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>
-
- var numberOfTrackTests = 2;
-
- function trackLoaded()
- {
- numberOfTracksLoaded++;
- if (numberOfTracksLoaded == numberOfTrackTests) {
- testTrack(0);
- testTrackError(1);
- }
- }
-
- function testTrack(i)
- {
- findMediaElement();
- testExpected("video.textTracks[" + i + "].cues.length", "3");
-
- var fragment = document.createDocumentFragment();
- var cspan = document.createElement("span");
- cspan.className = "black";
- cspan.appendChild(document.createTextNode("Bear is Coming!!!!!"));
- fragment.appendChild(cspan);
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
-
- fragment = document.createDocumentFragment();
- cspan = document.createElement("span");
- cspan.className = "green";
- cspan.appendChild(document.createTextNode("I said Bear is coming!!!!"));
- fragment.appendChild(cspan);
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
-
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said "));
- cspan = document.createElement("span");
- cspan.className = "red uppercase";
- cspan.appendChild(document.createTextNode("Bear is coming now"));
- fragment.appendChild(cspan);
- fragment.appendChild(document.createTextNode("!!!!"));
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
-
- allTestsEnded();
- }
-
- function testTrackError(i)
- {
- findMediaElement();
- testExpected("video.textTracks[" + i + "].cues.length", "3");
-
- var fragment = document.createDocumentFragment();
- var cspan = document.createElement("span");
- cspan.appendChild(document.createTextNode("Bear is Coming!!!!!"));
- fragment.appendChild(cspan);
- fragment.appendChild(document.createTextNode("\nThe space signified an annotation start."));
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
-
- fragment = document.createDocumentFragment();
- cspan = document.createElement("span");
- cspan.className = "red&large";
- cspan.appendChild(document.createTextNode("I said Bear is coming!!!!"));
- fragment.appendChild(cspan);
- fragment.appendChild(document.createTextNode("\nProbably should only allow characters that CSS allows in class names."));
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
-
- fragment = document.createDocumentFragment();
- fragment.appendChild(document.createTextNode("I said "));
- cspan = document.createElement("span");
- cspan.className = "9red upper+case";
- cspan.appendChild(document.createTextNode("Bear is coming now"));
- fragment.appendChild(cspan);
- fragment.appendChild(document.createTextNode("!!!!\nProbably should only allow characters that CSS allows in class names."));
-
- testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
-
- allTestsEnded();
- }
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests cues with class markup &lt;c&gt;.</p>
- <video>
- <track src="captions-webvtt/tc025-class.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc025-class-bad.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+<title>Tests cues with class markup &lt;c&gt;.</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/tc025-class.vtt", function(track) {
+ assert_equals(track.cues.length, 3);
+
+ var children = [
+ { type: "span", style: { className: "black" },
+ value: [ { type: "text", value: "Bear is Coming!!!!!" } ] }
+ ];
+ assert_cue_fragment(track.cues[0], children);
+
+ children = [
+ { type: "span", style: { className: "green" },
+ value: [ { type: "text", value: "I said Bear is coming!!!!" } ] }
+ ];
+ assert_cue_fragment(track.cues[1], children);
+
+ children = [
+ { type: "text", value: "I said " },
+ { type: "span", style: { className: "red uppercase" },
+ value: [ { type: "text", value: "Bear is coming now" } ] },
+ { type: "text", value: "!!!!" }
+ ];
+ assert_cue_fragment(track.cues[2], children);
+});
+
+check_cues_from_track("captions-webvtt/tc025-class-bad.vtt", function(track) {
+ assert_equals(track.cues.length, 3);
+
+ var children = [
+ { type: "span", value: [ { type: "text", value: "Bear is Coming!!!!!" } ] },
+ { type: "text", value: "\nThe space signified an annotation start." }
+ ];
+ assert_cue_fragment(track.cues[0], children);
+
+ children = [
+ { type: "span", style: { className: "red&large" },
+ value: [ { type: "text", value: "I said Bear is coming!!!!" } ] },
+ { type: "text", value: "\nProbably should only allow characters that CSS allows in class names." }
+ ];
+ assert_cue_fragment(track.cues[1], children);
+
+ children = [
+ { type: "text", value: "I said " },
+ { type: "span", style: { className: "9red upper+case" },
+ value: [ { type: "text", value: "Bear is coming now" } ] },
+ { type: "text", value: "!!!!\nProbably should only allow characters that CSS allows in class names." }
+ ];
+ assert_cue_fragment(track.cues[2], children);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698