Skip to content
Permalink
Browse files
[mediacontrols] Add a test for the show controls button
https://bugs.webkit.org/show_bug.cgi?id=148655
<rdar://problem/22509688>

Reviewed by Eric Carlson.

Source/WebCore:

We'll add a list of control elements to the status object,
so we can query the state of buttons, etc. Begin with the
Show Controls button (used for accessibility).

There are also some drive-by whitespace changes.

Test: media/controls/showControlsButton.html

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.get idiom): Differentiate between iOS and
OS X. This isn't necessary at the moment, but will come in
handy later.
(Controller.prototype.createControls): Whitespace.
(Controller.prototype.getCurrentControlsStatus): Add the information
on the Show Controls button.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.get idiom):

LayoutTests:

* media/controls/controls-test-helpers.js: Added. This will
hold any helper functions.
(statusForControlsElement): Return the status object for
a named control.
* media/controls/showControlsButton-expected.txt: Added.
* media/controls/showControlsButton.html: Added.

Canonical link: https://commits.webkit.org/166792@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@189214 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grorg committed Sep 1, 2015
1 parent 4d07116 commit 38cde5c72eec6a19ebf48ef59eb62767498d0659
Showing 7 changed files with 133 additions and 9 deletions.
@@ -1,3 +1,18 @@
2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add a test for the show controls button
https://bugs.webkit.org/show_bug.cgi?id=148655
<rdar://problem/22509688>

Reviewed by Eric Carlson.

* media/controls/controls-test-helpers.js: Added. This will
hold any helper functions.
(statusForControlsElement): Return the status object for
a named control.
* media/controls/showControlsButton-expected.txt: Added.
* media/controls/showControlsButton.html: Added.

2015-09-01 Brian Burg <bburg@apple.com>

Web Inspector: add TestSuite hooks for per-testcase setup and teardown actions
@@ -0,0 +1,10 @@
function statusForControlsElement(statusObject, elementName)
{
if (statusObject.elements && statusObject.elements.length) {
for (var i = 0; i < statusObject.elements.length; i++) {
if (statusObject.elements[i].name == elementName)
return statusObject.elements[i];
}
}
return null;
}
@@ -0,0 +1,10 @@
This tests for the existence of a hidden Show Controls button.

This test only runs in DRT!


EVENT(canplaythrough)
EXPECTED (showControlsButtonInfo.name == 'Show Controls') OK
EXPECTED (showControlsButtonInfo.hidden == 'true') OK
END OF TEST

@@ -0,0 +1,45 @@
<!DOCTYPE html>
<html>
<head>
<script src="../media-file.js"></script>
<script src="../video-test.js"></script>
<script src="controls-test-helpers.js"></script>
<script>
var video;
var currentStatus;
var showControlsButtonInfo;

function init()
{
findMediaElement();
video.src = findMediaFile("video", "../content/test");

waitForEvent("canplaythrough", canplaythrough);
waitForEventAndFail("error");
}

function canplaythrough()
{
if (!window.testRunner)
return;

currentStatus = JSON.parse(internals.getCurrentMediaControlsStatusForElement(video));
if (currentStatus) {
if (currentStatus.idiom == "apple") {
showControlsButtonInfo = statusForControlsElement(currentStatus, "Show Controls");
if (showControlsButtonInfo) {
testExpected("showControlsButtonInfo.name", "Show Controls");
testExpected("showControlsButtonInfo.hidden", true);
}
}
}
endTest();
}
</script>
</head>
<body onload="init()">
<p>This tests for the existence of a hidden Show Controls button.</p>
<p>This test only runs in DRT!</p>
<video controls></video>
</body>
</html>
@@ -1,3 +1,29 @@
2015-08-31 Dean Jackson <dino@apple.com>

[mediacontrols] Add a test for the show controls button
https://bugs.webkit.org/show_bug.cgi?id=148655
<rdar://problem/22509688>

Reviewed by Eric Carlson.

We'll add a list of control elements to the status object,
so we can query the state of buttons, etc. Begin with the
Show Controls button (used for accessibility).

There are also some drive-by whitespace changes.

Test: media/controls/showControlsButton.html

* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.get idiom): Differentiate between iOS and
OS X. This isn't necessary at the moment, but will come in
handy later.
(Controller.prototype.createControls): Whitespace.
(Controller.prototype.getCurrentControlsStatus): Add the information
on the Show Controls button.
* Modules/mediacontrols/mediaControlsiOS.js:
(ControllerIOS.prototype.get idiom):

2015-09-01 Joseph Pecoraro <pecoraro@apple.com>

Possible CFArray leak in MediaPlayerPrivateAVFoundationCF.cpp
@@ -144,6 +144,11 @@ Controller.prototype = {
}
},

get idiom()
{
return "apple";
},

UIString: function(developmentString, replaceString, replacementString)
{
var localized = UIStringTable[developmentString];
@@ -336,10 +341,10 @@ Controller.prototype = {
this.listenFor(panel, 'click', this.handlePanelClick);
this.listenFor(panel, 'dblclick', this.handlePanelClick);
this.listenFor(panel, 'dragstart', this.handlePanelDragStart);

var panelBackgroundContainer = this.controls.panelBackgroundContainer = document.createElement('div');
panelBackgroundContainer.setAttribute('pseudo', '-webkit-media-controls-panel-background-container');

var panelTint = this.controls.panelTint = document.createElement('div');
panelTint.setAttribute('pseudo', '-webkit-media-controls-panel-tint');
this.listenFor(panelTint, 'mousedown', this.handlePanelMouseDown);
@@ -401,7 +406,7 @@ Controller.prototype = {

this.timelineContextName = "_webkit-media-controls-timeline-" + this.host.generateUUID();
timeline.style.backgroundImage = '-webkit-canvas(' + this.timelineContextName + ')';

var thumbnailTrack = this.controls.thumbnailTrack = document.createElement('div');
thumbnailTrack.classList.add(this.ClassNames.thumbnailTrack);

@@ -438,10 +443,10 @@ Controller.prototype = {
var volumeBox = this.controls.volumeBox = document.createElement('div');
volumeBox.setAttribute('pseudo', '-webkit-media-controls-volume-slider-container');
volumeBox.classList.add(this.ClassNames.volumeBox);

var volumeBoxBackground = this.controls.volumeBoxBackground = document.createElement('div');
volumeBoxBackground.setAttribute('pseudo', '-webkit-media-controls-volume-slider-container-background');

var volumeBoxTint = this.controls.volumeBoxTint = document.createElement('div');
volumeBoxTint.setAttribute('pseudo', '-webkit-media-controls-volume-slider-container-tint');

@@ -458,7 +463,7 @@ Controller.prototype = {

this.volumeContextName = "_webkit-media-controls-volume-" + this.host.generateUUID();
volume.style.backgroundImage = '-webkit-canvas(' + this.volumeContextName + ')';

var captionButton = this.controls.captionButton = document.createElement('button');
captionButton.setAttribute('pseudo', '-webkit-media-controls-toggle-closed-captions-button');
captionButton.setAttribute('aria-label', this.UIString('Captions'));
@@ -483,10 +488,10 @@ Controller.prototype = {

var inlinePlaybackPlaceholderText = this.controls.inlinePlaybackPlaceholderText = document.createElement('div');
inlinePlaybackPlaceholderText.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text');

var inlinePlaybackPlaceholderTextTop = this.controls.inlinePlaybackPlaceholderTextTop = document.createElement('p');
inlinePlaybackPlaceholderTextTop.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text-top');

var inlinePlaybackPlaceholderTextBottom = this.controls.inlinePlaybackPlaceholderTextBottom = document.createElement('p');
inlinePlaybackPlaceholderTextBottom.setAttribute('pseudo', '-webkit-media-controls-wireless-playback-text-bottom');

@@ -2092,7 +2097,15 @@ Controller.prototype = {
getCurrentControlsStatus: function ()
{
return JSON.stringify({
status: "ok"
idiom: this.idiom,
status: "ok",
elements: [
{
name: "Show Controls",
className: this.showControlsButton.className,
hidden: this.showControlsButton.hidden
}
]
});
}

@@ -30,6 +30,11 @@ ControllerIOS.prototype = {
MinimumTimelineWidth: 200,
ButtonWidth: 42,

get idiom()
{
return "ios";
},

addVideoListeners: function() {
Controller.prototype.addVideoListeners.call(this);

0 comments on commit 38cde5c

Please sign in to comment.