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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc022-entities.html

Issue 2050213003: Convert track-webvtt-tc[022, 023] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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-tc022-entities.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc022-entities.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc022-entities.html
index 1202e9ca2d159341ec546957a5ee8e4d6cfda443..82133b0e508219dffdc94d94e41f69641ecb8132 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc022-entities.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc022-entities.html
@@ -1,77 +1,37 @@
<!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();
- var expected =
- {
- length : 7,
- tests:
- [
- {
- property : "getCueAsHTML().textContent",
- values : ["This cue has an ampersand & character.",
- "This cue has a less than < character.",
- "This cue has a greater than > character.",
- "This cue has a Left-to-Right Mark \u200e.",
- "This cue has a Right-to-Left Mark \u200f.",
- "This cue has a non-breaking space \u00a0.",
- "This & is parsed to the same as &."],
- },
- ],
- };
- testCues(i, expected);
-
- allTestsEnded();
- }
-
- function testTrackError(i)
- {
- findMediaElement();
- var expected =
- {
- length : 2,
- tests:
- [
- {
- property : "getCueAsHTML().textContent",
- values : ["This cue has a less than ",
- "This cue has a greater than > character.\nSince it's not related to a < character,\nit's just interpreted as text."],
- },
- ],
- };
- testCues(i, expected);
-
- allTestsEnded();
- }
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests entities in the cue text.</p>
- <video>
- <track src="captions-webvtt/tc022-entities.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc022-entities-wrong.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+<title>Tests entities in the cue text.</title>
+<script src="track-helpers.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+// TODO(srirama.m): Rewrite the test in a better way.
+// See https://codereview.chromium.org/2030383002/ for details.
+check_cues_from_track("captions-webvtt/tc022-entities.vtt", function(track) {
+ var expected = [
+ { innerHTML: "This cue has an ampersand & character." },
+ { innerHTML: "This cue has a less than < character." },
+ { innerHTML: "This cue has a greater than > character." },
+ { innerHTML: "This cue has a Left-to-Right Mark \u200e." },
+ { innerHTML: "This cue has a Right-to-Left Mark \u200f." },
+ { innerHTML: "This cue has a non-breaking space \u00a0." },
+ { innerHTML: "This & is parsed to the same as &." }
+ ];
+
+ var cues = track.cues;
+ assert_equals(cues.length, expected.length);
+ for (var i = 0; i < cues.length; i++)
+ assert_equals(cues[i].getCueAsHTML().textContent, expected[i].innerHTML);
+});
+
+check_cues_from_track("captions-webvtt/tc022-entities-wrong.vtt", function(track) {
+ var expected = [
+ { innerHTML: "This cue has a less than ", },
+ { innerHTML: "This cue has a greater than > character.\nSince it's not related to a < character,\nit's just interpreted as text.", }
+ ];
+
+ var cues = track.cues;
+ assert_equals(cues.length, expected.length);
+ for (var i = 0; i < cues.length; i++)
+ assert_equals(cues[i].getCueAsHTML().textContent, expected[i].innerHTML);
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698