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

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-texttracks.html

Issue 1952893004: Convert track-text-track* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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-texttracks.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-texttracks.html b/third_party/WebKit/LayoutTests/media/track/track-texttracks.html
index b86887d77c84198a0efd40f239b95e1d1c4362cd..45d3e6c70d8f071215c89a51222219905da4b90c 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-texttracks.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-texttracks.html
@@ -1,60 +1,42 @@
<!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>
-
- var trackElement;
-
- function start()
- {
- findMediaElement();
-
- consoleWrite("** Add a track with video.addTextTrack().");
- run("video.addTextTrack('descriptions', 'Descriptions Track', 'en')");
-
- consoleWrite("<br>** Add a &lt;track&gt; element with DOM API.");
- run("trackElement = document.createElement('track')");
- run("trackElement.setAttribute('kind', 'chapters')");
- run("video.appendChild(trackElement)");
-
- consoleWrite("<br>** Verify track order.");
- testExpected("video.textTracks.length", 3);
- testExpected("video.textTracks[0].kind", "captions");
- testExpected("video.textTracks[1].kind", "chapters");
- testExpected("video.textTracks[2].kind", "descriptions");
-
- consoleWrite("<br>** Verify the default parameters of the text track object returned by addTextTrack(). **");
- testExpected("video.textTracks[2].mode == 'hidden'", true);
- testExpected("video.textTracks[2].cues != null", true);
- testExpected("video.textTracks[2].cues.length == 0", true);
-
- consoleWrite("<br>** Add another &lt;track&gt; element, is should insert before the addTextTrack() track.");
- run("trackElement = document.createElement('track')");
- run("trackElement.setAttribute('kind', 'metadata')");
- run("video.appendChild(trackElement)");
-
- testExpected("video.textTracks.length", 4);
- testExpected("video.textTracks[0].kind", "captions");
- testExpected("video.textTracks[1].kind", "chapters");
- testExpected("video.textTracks[2].kind", "metadata");
- testExpected("video.textTracks[3].kind", "descriptions");
-
- consoleWrite("");
- endTest();
- }
-
- </script>
- </head>
- <body onload="start()">
- <p>Tests that TextTracks in a TextTrackList are kept in the correct order.</p>
- <video>
- <track id="track_1" kind="captions" src="captions-webvtt/tc004-webvtt-file.vtt" >
- </video>
- </body>
-</html>
+<title>Tests that TextTracks in a TextTrackList are kept in the correct order.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<video>
+ <track kind="captions" src="captions-webvtt/tc004-webvtt-file.vtt" >
+</video>
+<script>
+test(function() {
+ var video = document.querySelector("video");
+
+ // Add a track with video.addTextTrack().
+ video.addTextTrack("descriptions", "Descriptions Track", "en");
+
+ // Add a track element with DOM API.
+ var trackElement = document.createElement("track");
+ trackElement.setAttribute("kind", "chapters");
+ video.appendChild(trackElement);
+
+ // Verify track order.
+ assert_equals(video.textTracks.length, 3);
+ assert_equals(video.textTracks[0].kind, "captions");
+ assert_equals(video.textTracks[1].kind, "chapters");
+ assert_equals(video.textTracks[2].kind, "descriptions");
+
+ // Verify the default parameters of the text track object returned by addTextTrack().
+ assert_equals(video.textTracks[2].mode, "hidden");
+ assert_not_equals(video.textTracks[2].cues, null);
+ assert_equals(video.textTracks[2].cues.length, 0);
+
+ // Add another track element, it should insert before the addTextTrack() track.
+ trackElement = document.createElement("track");
+ trackElement.setAttribute("kind", "metadata");
+ video.appendChild(trackElement);
+
+ assert_equals(video.textTracks.length, 4);
+ assert_equals(video.textTracks[0].kind, "captions");
+ assert_equals(video.textTracks[1].kind, "chapters");
+ assert_equals(video.textTracks[2].kind, "metadata");
+ assert_equals(video.textTracks[3].kind, "descriptions");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698