| Index: LayoutTests/media/media-controls.js
|
| diff --git a/LayoutTests/media/media-controls.js b/LayoutTests/media/media-controls.js
|
| index e0630476439bc8a4c84ac9bb472f0833f4e212ef..7e025750173b5c27ffe87fb901b38c698e867f2e 100644
|
| --- a/LayoutTests/media/media-controls.js
|
| +++ b/LayoutTests/media/media-controls.js
|
| @@ -1,3 +1,5 @@
|
| +var captionsButtonElement;
|
| +var captionsButtonCoordinates;
|
|
|
| function mediaControlsElement(first, id)
|
| {
|
| @@ -73,3 +75,28 @@ function textTrackDisplayElement(parentElement, id, cueNumber)
|
|
|
| return displayElement;
|
| }
|
| +
|
| +function testClosedCaptionsButtonVisibility(expected)
|
| +{
|
| + try {
|
| + captionsButtonElement = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-toggle-closed-captions-button");
|
| + captionsButtonCoordinates = mediaControlsButtonCoordinates(video, "toggle-closed-captions-button");
|
| + } catch (exception) {
|
| + consoleWrite("Failed to find a closed captions button or its coordinates: " + exception);
|
| + if (expected)
|
| + failTest();
|
| + return;
|
| + }
|
| +
|
| + consoleWrite("");
|
| + if (expected == true) {
|
| + consoleWrite("** Caption button should be visible and enabled because we have a captions track.");
|
| + testExpected("captionsButtonCoordinates[0]", 0, ">");
|
| + testExpected("captionsButtonCoordinates[1]", 0, ">");
|
| + testExpected("captionsButtonElement.disabled", false);
|
| + } else {
|
| + consoleWrite("** Caption button should not be visible as there are no caption tracks.");
|
| + testExpected("captionsButtonCoordinates[0]", 0, "<=");
|
| + testExpected("captionsButtonCoordinates[1]", 0, "<=");
|
| + }
|
| +}
|
|
|