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

Unified Diff: third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-multiple-tracks.html

Issue 2123003003: Convert text-track-selection* tests to testharness.js (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/text-track-selection-menu-multiple-tracks.html
diff --git a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-multiple-tracks.html b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-multiple-tracks.html
index 9773602ba849d578d25af61ef1a98c3bc459d766..d153d885f60fe342066e1b47cbc8b416c4f8e3d8 100644
--- a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-multiple-tracks.html
+++ b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-multiple-tracks.html
@@ -1,53 +1,36 @@
<!DOCTYPE html>
+<title>Test that we can add multiple tracks and select between them from the track selection menu.</title>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
<script src="../media-file.js"></script>
-<!-- TODO(srivats): Convert test to testharness.js. crbug.com/588956
- (Please avoid writing new tests using video-test.js) -->
-<script src="../video-test.js"></script>
<script src="../media-controls.js"></script>
+<video controls></video>
<script>
-
+async_test(function(t) {
+ var video = document.querySelector("video");
var trackLanguages = ["en", "ru", "fr", "jp", "de"];
var trackCueText = ["English", "Russian", "French", "Japanese", "German"];
- function startTest()
- {
- findMediaElement();
- testClosedCaptionsButtonVisibility(true);
- consoleWrite("");
- testExpected("video.textTracks.length", trackLanguages.length);
- consoleWrite("");
+ video.oncanplaythrough = t.step_func_done(function() {
+ for (var i = 0; i < trackLanguages.length; i++) {
+ var track = video.addTextTrack("captions", trackCueText[i], trackLanguages[i]);
+ track.addCue(new VTTCue(0, 1, trackCueText[i]));
+ track.mode = "disabled";
+ }
+ assert_true(isClosedCaptionsButtonVisible(video));
+ assert_equals(video.textTracks.length, trackLanguages.length);
for (var i = 0; i < trackLanguages.length; i++) {
- consoleWrite("Select track at index " + i);
- selectTextTrack(video, i);
- testExpected("video.textTracks[" + i + "].mode", "showing");
- testExpected("textTrackDisplayElement(video, 'display').innerText", trackCueText[i]);
+ clickTextTrackAtIndex(video, i);
+ assert_equals(video.textTracks[i].mode, "showing");
+ assert_equals(textTrackCueDisplayElement(video).innerText, trackCueText[i]);
for (var j = 0; j < trackLanguages.length; j++) {
if (j != i)
- testExpected("video.textTracks[" + j + "].mode", "disabled");
+ assert_equals(video.textTracks[j].mode, "disabled");
}
- consoleWrite("");
}
- endTest();
- }
-
- function addTextTracks()
- {
- for (var i = 0; i < trackLanguages.length; i++) {
- var track = video.addTextTrack("captions", trackCueText[i], trackLanguages[i]);
- track.addCue(new VTTCue(0.0, 1.0, trackCueText[i]));
- track.mode = "disabled";
- }
- startTest();
- }
-
- window.onload = function()
- {
- consoleWrite("Test that we can add multiple tracks and select between them from the track selection menu");
- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
- waitForEvent("canplaythrough", addTextTracks);
- }
+ });
-</script>
-<video controls></video>
+ video.src = findMediaFile("video", "../content/test");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698