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

Unified Diff: third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html

Issue 2539023002: Media Controls: Use events to update controls for closed captions. (Closed)
Patch Set: ready for review Created 4 years 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/controls/closed-captions-switch-track.html
diff --git a/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html b/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html
new file mode 100644
index 0000000000000000000000000000000000000000..52dcec7ba7c3dafd177331af7f9e2f5d17f936b1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/media/controls/closed-captions-switch-track.html
@@ -0,0 +1,41 @@
+<!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>
+<script src="../media-controls.js"></script>
+<!-- Width should be large enough to display closed captions button. -->
+<video controls style="width: 500px"></video>
+<script>
+async_test(t => {
+ var video = document.querySelector("video");
+ var trackLanguages = ["en", "ru", "fr", "jp", "de"];
+ var trackCueText = ["English", "Russian", "French", "Japanese", "German"];
+
+ video.oncanplaythrough = t.step_func(_ => {
+ 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";
+ }
+
+ // The controls are updated asynchronously.
+ setTimeout(t.step_func_done(_ => {
+ assert_true(isClosedCaptionsButtonVisible(video));
+ assert_equals(video.textTracks.length, trackLanguages.length);
+
+ for (var i = 0; i < trackLanguages.length; i++) {
+ clickTextTrackAtIndex(video, i);
+ assert_equals(video.textTracks[i].mode, "showing");
+ assert_equals(textTrackDisplayElement(video).innerText, trackCueText[i]);
+ for (var j = 0; j < trackLanguages.length; j++) {
+ if (j != i)
+ assert_equals(video.textTracks[j].mode, "disabled");
+ }
+ }
+ }));
+ });
+
+ video.src = findMediaFile("video", "../content/test");
+});
+</script>

Powered by Google App Engine
This is Rietveld 408576698