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

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

Issue 1873093003: Convert track tests from video-test.js to testharness.js based (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 8 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-addtrack-kind.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-addtrack-kind.html b/third_party/WebKit/LayoutTests/media/track/track-addtrack-kind.html
index 14408f6a8c2574c94dfe67320c8aea0650170ee8..3fc890178b770272d146705e8ca54fb39e56c6ec 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-addtrack-kind.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-addtrack-kind.html
@@ -1,48 +1,25 @@
<!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 trackCount = 0;
-
- function addTrack(type)
- {
- run("video.addTextTrack('" + type + "')");
- testExpected("video.textTracks.length", ++trackCount);
- }
-
- function start()
- {
- findMediaElement();
-
- consoleWrite("<em>++ Test invalid 'kind'.</em>");
- testExpected("video.textTracks.length", 0);
- testException("video.addTextTrack('kaptions')", '"TypeError: Failed to execute \'addTextTrack\' on \'HTMLMediaElement\': parameter 1 (\'kaptions\') is not a valid enum value."');
- testExpected("video.textTracks.length", 0);
- consoleWrite("");
-
- consoleWrite("<em>++ Test all valid 'kind' keywords.</em>");
- addTrack("subtitles");
- addTrack("captions");
- addTrack("descriptions");
- addTrack("chapters");
- addTrack("metadata");
-
- consoleWrite("");
- endTest();
- }
-
- </script>
- </head>
- <body onload="start()">
- <p>Tests that the addTextTrack() only accepts known 'kind' values.</p>
- <video>
- </video>
- </body>
-</html>
+<title>Tests that the addTextTrack() only accepts known "kind" values.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script>
+test(function() {
+ var trackCount = 0;
+
+ function addTrack(type) {
+ video.addTextTrack(type);
+ assert_equals(video.textTracks.length, ++trackCount);
+ }
+
+ var video = document.createElement("video");
+ assert_equals(video.textTracks.length, 0);
+ assert_throws(new TypeError(), function() { video.addTextTrack("kaptions"); });
+ assert_equals(video.textTracks.length, 0);
+
+ addTrack("subtitles");
+ addTrack("captions");
+ addTrack("descriptions");
+ addTrack("chapters");
+ addTrack("metadata");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698