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

Unified Diff: third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html
diff --git a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html
index 5ad97086ea5bc4038917c79bce8835cd4c65ed51..6af6e004d0bab7aedf726cf0cacd45ac3c866274 100644
--- a/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html
+++ b/third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track.html
@@ -1,51 +1,35 @@
<!DOCTYPE html>
+<title>Test that we can add a track dynamically and it is displayed on 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>
+ <track src="captions-webvtt/captions.vtt" kind="captions" label="English" srclang="en" default>
+</video>
<script>
-
+async_test(function(t) {
var trackCueText = "Bonjour";
+ var video = document.querySelector("video");
- function selectTrackAdded()
- {
- findMediaElement();
- testClosedCaptionsButtonVisibility(true);
- consoleWrite("");
- testExpected("video.textTracks.length", 2);
- testExpected("video.textTracks[0].mode", "showing");
- testExpected("video.textTracks[1].mode", "hidden");
-
- consoleWrite("");
- consoleWrite("Verify the default track is being displayed");
- testExpected("textTrackDisplayElement(video, 'display').innerText", "Lorem");
+ video.oncanplaythrough = t.step_func_done(function() {
+ var track = video.addTextTrack("captions", "French", "fr");
+ track.addCue(new VTTCue(0, 1, trackCueText));
+ assert_true(isClosedCaptionsButtonVisible(video));
+ assert_equals(video.textTracks.length, 2);
+ assert_equals(video.textTracks[0].mode, "showing");
+ assert_equals(video.textTracks[1].mode, "hidden");
- consoleWrite("");
- consoleWrite("Select the newly added track");
- selectTextTrack(video, 1);
- testExpected("video.textTracks[1].mode", "showing");
- testExpected("video.textTracks[0].mode", "disabled");
- testExpected("textTrackDisplayElement(video, 'display').innerText", trackCueText);
- endTest();
- }
+ // Verify the default track is being displayed.
+ assert_equals(textTrackCueDisplayElement(video).innerText, "Lorem");
- function addTextTrack()
- {
- track = video.addTextTrack("captions", "French", "fr");
- track.addCue(new VTTCue(0.0, 1.0, trackCueText));
- selectTrackAdded();
- }
+ // Click the newly added track.
+ clickTextTrackAtIndex(video, 1);
+ assert_equals(video.textTracks[1].mode, "showing");
+ assert_equals(video.textTracks[0].mode, "disabled");
+ assert_equals(textTrackCueDisplayElement(video).innerText, trackCueText);
+ });
- window.onload = function()
- {
- consoleWrite("Test that we can add a track dynamically and it is displayed on the track selection menu");
- findMediaElement();
- video.src = findMediaFile("video", "../content/test");
- waitForEvent("canplaythrough", addTextTrack);
- }
-
-</script>
-<video controls>
- <track src="captions-webvtt/captions.vtt" kind="captions" label="English" srclang="en" default>
-</video>
+ video.src = findMediaFile("video", "../content/test");
+})
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/track/text-track-selection-menu-add-track-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698