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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-webvtt-tc001-utf8.html

Issue 1956213002: Convert track-webvtt-tc[000-002] tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 7 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-tc001-utf8.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc001-utf8.html b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc001-utf8.html
index 4794cad941aca5aa04bdd39daa9d9ab23de1b20c..11bf2217f28144b915804e1d00b37d88df95f1e2 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc001-utf8.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-webvtt-tc001-utf8.html
@@ -1,77 +1,57 @@
<!DOCTYPE html>
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-
- <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>
-
- numberOfTrackTests = 2;
-
- function trackLoaded()
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as a WebVTT file (we do allow it, it just looks ugly).</title>
+<video>
+ <track src="captions-webvtt/tc001-utf8.vtt">
+ <track src="captions-webvtt/tc001-iso2022jp3.vtt">
+</video>
+<script src="track-helpers.js"></script>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+async_test(function(t) {
+ var video = document.querySelector("video");
+
+ var trackElements = document.querySelectorAll("track");
+ for (var i = 0; i < video.textTracks.length; i++)
+ trackElements[i].onload = t.step_func(trackLoaded);
+
+ enableAllTextTracks(video.textTracks);
+
+ var numberOfTracksLoaded = 0;
+ function trackLoaded() {
+ numberOfTracksLoaded++;
+ if (numberOfTracksLoaded != 2)
+ return;
+
+ testTrack0();
+ testTrack1();
+ t.done();
+ }
+
+ function testTrack0() {
+ var expected = [
{
- numberOfTracksLoaded++;
- if (numberOfTracksLoaded == numberOfTrackTests) {
- testTrack0();
- testTrack1();
- }
- }
-
- function testTrack0()
+ id : "1",
+ startTime : 0,
+ endTime : 30.5,
+ text : "景気判断"
+ },
{
- findMediaElement();
- var expected =
- {
- length : 2,
- tests:
- [
- {
- property : "id",
- values : [1, 2],
- },
- {
- property : "startTime",
- values : [0.0, 31.0],
- },
- {
- property : "endTime",
- values : [30.5, 1200.5],
- },
- {
- property : "text",
- values : ["景気判断", "電力不足"],
- },
- ],
- };
- testCues(0, expected);
-
- allTestsEnded();
+ id : "2",
+ startTime : 31,
+ endTime : 1200.5,
+ text : "電力不足"
}
-
- function testTrack1()
- {
- findMediaElement();
- var expected =
- {
- length : 2,
- tests:
- [],
- };
- testCues(1, expected);
-
- allTestsEnded();
- }
-
- </script>
- </head>
- <body onload="enableAllTextTracks()">
- <p>Tests that UTF-8 encoded characters are recognized properly and that different encodings (iconv) are not recognized as a WebVTT file (we do allow it, it just looks ugly).</p>
- <video>
- <track src="captions-webvtt/tc001-utf8.vtt" onload="trackLoaded()">
- <track src="captions-webvtt/tc001-iso2022jp3.vtt" onload="trackLoaded()">
- </video>
- </body>
-</html>
+ ];
+
+ var cues = video.textTracks[0].cues;
+ assert_equals(cues.length, 2);
+ assert_cues_equal(cues, expected);
+ }
+
+ function testTrack1() {
+ assert_equals(video.textTracks[1].cues.length, 2);
+ }
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698