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

Side by Side Diff: LayoutTests/media/media-controls.js

Issue 54713007: Hide the CC button for <audio> with <track>s (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add test Created 7 years, 1 month 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 unified diff | Download patch
OLDNEW
1 var captionsButtonElement; 1 var captionsButtonElement;
2 var captionsButtonCoordinates; 2 var captionsButtonCoordinates;
3 3
4 function mediaControlsElement(first, id) 4 function mediaControlsElement(first, id)
5 { 5 {
6 for (var element = first; element; element = element.nextSibling) { 6 for (var element = first; element; element = element.nextSibling) {
7 // Not every element in the media controls has a shadow pseudo ID, eg. t he 7 // Not every element in the media controls has a shadow pseudo ID, eg. t he
8 // text nodes for the time values, so guard against exceptions. 8 // text nodes for the time values, so guard against exceptions.
9 try { 9 try {
10 if (internals.shadowPseudoId(element) == id) 10 if (internals.shadowPseudoId(element) == id)
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 if (!displayElement) 72 if (!displayElement)
73 throw "There are not " + cueNumber + " text track cues visible"; 73 throw "There are not " + cueNumber + " text track cues visible";
74 } 74 }
75 75
76 return displayElement; 76 return displayElement;
77 } 77 }
78 78
79 function testClosedCaptionsButtonVisibility(expected) 79 function testClosedCaptionsButtonVisibility(expected)
80 { 80 {
81 try { 81 try {
82 captionsButtonElement = mediaControlsElement(internals.shadowRoot(video) .firstChild, "-webkit-media-controls-toggle-closed-captions-button"); 82 captionsButtonElement = mediaControlsElement(internals.shadowRoot(mediaE lement).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
83 captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggl e-closed-captions-button"); 83 captionsButtonCoordinates = mediaControlsButtonCoordinates(mediaElement, "toggle-closed-captions-button");
84 } catch (exception) { 84 } catch (exception) {
85 consoleWrite("Failed to find a closed captions button or its coordinates : " + exception); 85 consoleWrite("Failed to find a closed captions button or its coordinates : " + exception);
86 if (expected) 86 if (expected)
87 failTest(); 87 failTest();
88 return; 88 return;
89 } 89 }
90 90
91 consoleWrite(""); 91 consoleWrite("");
92 if (expected == true) { 92 if (expected == true) {
93 consoleWrite("** Caption button should be visible and enabled because we have a captions track."); 93 consoleWrite("** Caption button should be visible and enabled.");
94 testExpected("captionsButtonCoordinates[0]", 0, ">"); 94 testExpected("captionsButtonCoordinates[0]", 0, ">");
95 testExpected("captionsButtonCoordinates[1]", 0, ">"); 95 testExpected("captionsButtonCoordinates[1]", 0, ">");
96 testExpected("captionsButtonElement.disabled", false); 96 testExpected("captionsButtonElement.disabled", false);
97 } else { 97 } else {
98 consoleWrite("** Caption button should not be visible as there are no ca ption tracks."); 98 consoleWrite("** Caption button should not be visible.");
99 testExpected("captionsButtonCoordinates[0]", 0, "<="); 99 testExpected("captionsButtonCoordinates[0]", 0, "<=");
100 testExpected("captionsButtonCoordinates[1]", 0, "<="); 100 testExpected("captionsButtonCoordinates[1]", 0, "<=");
101 } 101 }
102 } 102 }
103 103
104 function clickCCButton() 104 function clickCCButton()
105 { 105 {
106 consoleWrite("*** Click the CC button."); 106 consoleWrite("*** Click the CC button.");
107 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina tes[1]); 107 eventSender.mouseMoveTo(captionsButtonCoordinates[0], captionsButtonCoordina tes[1]);
108 eventSender.mouseDown(); 108 eventSender.mouseDown();
109 eventSender.mouseUp(); 109 eventSender.mouseUp();
110 } 110 }
OLDNEW
« no previous file with comments | « LayoutTests/media/audio-controls-captions-expected.txt ('k') | LayoutTests/media/video-controls-captions-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698