| Index: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc023-markup.html
|
| diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc023-markup.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc023-markup.html
|
| index abd2b65e3e097c2fa99d6f3ca7b5211b2a3d21bf..5c3de442e86ad145ea3404a0fee3d919706ea7cc 100644
|
| --- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc023-markup.html
|
| +++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc023-markup.html
|
| @@ -1,118 +1,90 @@
|
| <!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);
|
| +<title>Tests cues with <b>, <i>, <u>, <rt> and <ruby> 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/tc023-markup.vtt", function(track) {
|
| + assert_equals(track.cues.length, 4);
|
| +
|
| + var children = [
|
| + { type: "text", value: "The following bear is bold:\n" },
|
| + { type: "b", value: [ { type: "text", value: "Bear" } ] },
|
| + { type: "text", value: " is Coming!!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[0], children);
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is in italics and has a class of \"larger\":\n" },
|
| + { type: "i", value: [ { type: "text", value: "Bear" } ] },
|
| + { type: "text", value: " is Coming!!!!!" }
|
| + ];
|
| +
|
| + var fragment = createFragment(children);
|
| + fragment.querySelector("i").className = "larger";
|
| + assert_true(fragment.isEqualNode(track.cues[1].getCueAsHTML()));
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is underlined even though the element has a blank:\nI said " },
|
| + { type: "u", value: [ { type: "text", value: "Bear" } ] },
|
| + { type: "text", value: " is coming!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[2], children);
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is ruby annotated:\nI said " },
|
| + {
|
| + type: "ruby",
|
| + value: [
|
| + { type: "text", value: "Bear" },
|
| + {
|
| + type: "rt",
|
| + value: [ { type: "text", value: "bear with me" } ]
|
| }
|
| - }
|
| -
|
| - function testTrack(i)
|
| - {
|
| - findMediaElement();
|
| - testExpected("video.textTracks[" + i + "].cues.length", "4");
|
| -
|
| - var fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is bold:\n"));
|
| - var bold = document.createElement("b");
|
| - bold.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(bold);
|
| - fragment.appendChild(document.createTextNode(" is Coming!!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is in italics and has a class of \"larger\":\n"));
|
| - var italics = document.createElement("i");
|
| - italics.className = "larger";
|
| - italics.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(italics);
|
| - fragment.appendChild(document.createTextNode(" is Coming!!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is underlined even though the element has a blank:\nI said "));
|
| - var underline = document.createElement("u");
|
| - underline.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(underline);
|
| - fragment.appendChild(document.createTextNode(" is coming!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is ruby annotated:\nI said "));
|
| - var ruby = document.createElement("ruby");
|
| - ruby.appendChild(document.createTextNode("Bear"));
|
| - var rt = document.createElement("rt");
|
| - rt.appendChild(document.createTextNode("bear with me"));
|
| - ruby.appendChild(rt);
|
| - fragment.appendChild(ruby);
|
| - fragment.appendChild(document.createTextNode(" is coming!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[3].getCueAsHTML()), true);
|
| -
|
| - allTestsEnded();
|
| - }
|
| -
|
| - function testTrackError(i)
|
| - {
|
| - findMediaElement();
|
| - testExpected("video.textTracks[" + i + "].cues.length", "4");
|
| -
|
| - var fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear starts bold but end is broken:\n"));
|
| - var bold = document.createElement("b");
|
| - bold.appendChild(document.createTextNode("Bear"));
|
| - bold.appendChild(document.createTextNode(" is Coming!!!!!"));
|
| - fragment.appendChild(bold);
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[0].getCueAsHTML()), true);
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is not in italics but the markup is removed:\n"));
|
| - fragment.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(document.createTextNode(" is Coming!!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[1].getCueAsHTML()), true);
|
| -
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is not underlined and markup is removed:\nI said "));
|
| - fragment.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(document.createTextNode(" is coming!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[2].getCueAsHTML()), true);
|
| -
|
| - fragment = document.createDocumentFragment();
|
| - fragment.appendChild(document.createTextNode("The following bear is not ruby annotated and markup is removed:\nI said "));
|
| - fragment.appendChild(document.createTextNode("Bear"));
|
| - fragment.appendChild(document.createTextNode("bear with me"));
|
| - fragment.appendChild(document.createTextNode(" is coming!!!!"));
|
| -
|
| - testExpected(fragment.isEqualNode(video.textTracks[i].cues[3].getCueAsHTML()), true);
|
| -
|
| - allTestsEnded();
|
| - }
|
| - </script>
|
| - </head>
|
| - <body onload="enableAllTextTracks()">
|
| - <p>Tests cues with <b>, <i>, <u>, <rt> and <ruby> tags.</p>
|
| - <video>
|
| - <track src="captions-webvtt/tc023-markup.vtt" onload="trackLoaded()">
|
| - <track src="captions-webvtt/tc023-markup-bad.vtt" onload="trackLoaded()">
|
| - </video>
|
| - </body>
|
| -</html>
|
| + ]
|
| + },
|
| + { type: "text", value: " is coming!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[3], children);
|
| +});
|
| +
|
| +check_cues_from_track("captions-webvtt/tc023-markup-bad.vtt", function(track) {
|
| + assert_equals(track.cues.length, 4);
|
| +
|
| + var children = [
|
| + { type: "text", value: "The following bear starts bold but end is broken:\n" },
|
| + {
|
| + type: "b",
|
| + value:
|
| + [
|
| + { type: "text", value: "Bear" },
|
| + { type: "text", value: " is Coming!!!!!" }
|
| + ]
|
| + }
|
| + ];
|
| + assert_cue_fragment(track.cues[0], children);
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is not in italics but the markup is removed:\n" },
|
| + { type: "text", value: "Bear" },
|
| + { type: "text", value: " is Coming!!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[1], children);
|
| +
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is not underlined and markup is removed:\nI said " },
|
| + { type: "text", value : "Bear" },
|
| + { type: "text", value : " is coming!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[2], children);
|
| +
|
| + children = [
|
| + { type: "text", value: "The following bear is not ruby annotated and markup is removed:\nI said " },
|
| + { type: "text", value: "Bear" },
|
| + { type: "text", value: "bear with me" },
|
| + { type: "text", value: " is coming!!!!" }
|
| + ];
|
| + assert_cue_fragment(track.cues[3], children);
|
| +});
|
| +</script>
|
|
|