Add a test for media control dropoff
authorjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Nov 2015 10:06:21 +0000 (10:06 +0000)
committerjonlee@apple.com <jonlee@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 19 Nov 2015 10:06:21 +0000 (10:06 +0000)
https://bugs.webkit.org/show_bug.cgi?id=151287
rdar://problem/23544666

Reviewed by Dean Jackson.

Source/WebCore:

Test: media/controls/inline-elements-dropoff-order.html

* Modules/mediacontrols/mediaControlsApple.css:
(audio::-webkit-media-controls-timeline-container.dropped): Override the
display:none since we want the container to remain visible but acting
as a flexible width space to push the other elements to the ends of the
inline flexbox. We will want to refactor the CSS rules so that all of the
components in the timeline are keyed off of the container's dropped class
rather than having each individual component have that class attached.
(audio::-webkit-media-controls-panel.hidden): Deleted. Consolidate a
couple rules.
* Modules/mediacontrols/mediaControlsApple.js:
(Controller.prototype.updateLayoutForDisplayedWidth): Also attach the
"dropped" class on the timeline box. Add the captions button for reporting
media control state.
* testing/Internals.cpp:
(WebCore::Internals::setMockMediaPlaybackTargetPickerState): Extend this to
also take "DeviceNotAvailable" to update the mock device's availability.

* testing/Internals.cpp: Update to use a reference to Page.
(WebCore::Internals::resetToConsistentState): Reset mock enabled setting for
each test.
* testing/Internals.h:
* testing/js/WebCoreTestSupport.cpp:
(WebCoreTestSupport::resetInternalsObject): Update to use a reference to Page.

LayoutTests:

The test takes a video element and resizes it to multiple widths. It
checks for the existence of the dropped or hidden class on each of the
media controls. The tests are run twice; once with wireless target
availability, and once without. If the platform does not support wireless
playback, it only goes through the tests once.

Test assumes that setMockMediaPlaybackTargetPickerEnabled is set to true at the beginning
of the test.

* media/controls/controls-test-helpers.js:
(ControlsTest.prototype.setup): Create the console box first before
checking to see the testRunner is available so that the failure
message appears when trying to run the test manually.
* media/controls/inline-elements-dropoff-order-expected.txt: Added.
* media/controls/inline-elements-dropoff-order.html: Added.
* platform/mac-mavericks/media/controls/inline-elements-dropoff-order-expected.txt: Added.
* platform/mac-yosemite/media/controls/inline-elements-dropoff-order-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@192622 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
LayoutTests/ChangeLog
LayoutTests/media/controls/controls-test-helpers.js
LayoutTests/media/controls/inline-elements-dropoff-order-expected.txt [new file with mode: 0644]
LayoutTests/media/controls/inline-elements-dropoff-order.html [new file with mode: 0644]
LayoutTests/platform/mac-mavericks/media/controls/inline-elements-dropoff-order-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac-yosemite/media/controls/inline-elements-dropoff-order-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/Modules/mediacontrols/mediaControlsApple.css
Source/WebCore/Modules/mediacontrols/mediaControlsApple.js
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/js/WebCoreTestSupport.cpp

index 2d1659f..518dff2 100644 (file)
@@ -1,3 +1,29 @@
+2015-11-19  Jon Lee  <jonlee@apple.com>
+
+        Add a test for media control dropoff
+        https://bugs.webkit.org/show_bug.cgi?id=151287
+        rdar://problem/23544666
+
+        Reviewed by Dean Jackson.
+
+        The test takes a video element and resizes it to multiple widths. It
+        checks for the existence of the dropped or hidden class on each of the
+        media controls. The tests are run twice; once with wireless target
+        availability, and once without. If the platform does not support wireless
+        playback, it only goes through the tests once.
+
+        Test assumes that setMockMediaPlaybackTargetPickerEnabled is set to true at the beginning
+        of the test.
+
+        * media/controls/controls-test-helpers.js:
+        (ControlsTest.prototype.setup): Create the console box first before
+        checking to see the testRunner is available so that the failure
+        message appears when trying to run the test manually.
+        * media/controls/inline-elements-dropoff-order-expected.txt: Added.
+        * media/controls/inline-elements-dropoff-order.html: Added.
+        * platform/mac-mavericks/media/controls/inline-elements-dropoff-order-expected.txt: Added.
+        * platform/mac-yosemite/media/controls/inline-elements-dropoff-order-expected.txt: Added.
+
 2015-11-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [Streams API] Implement IsReadableStreamDisturbed according to spec
index bb1a174..15d1bd1 100644 (file)
@@ -87,15 +87,15 @@ ControlsTest = class ControlsTest {
 
     setup()
     {
+        this.console = document.createElement("div");
+        this.console.className = "console";
+        document.body.appendChild(this.console);
+
         if (!window.testRunner) {
             this.logFailure("Test requires DRT.");
             return false;
         }
 
-        this.console = document.createElement("div");
-        this.console.className = "console";
-        document.body.appendChild(this.console);
-
         this.media = document.querySelector("video");
 
         if (!this.media) {
diff --git a/LayoutTests/media/controls/inline-elements-dropoff-order-expected.txt b/LayoutTests/media/controls/inline-elements-dropoff-order-expected.txt
new file mode 100644 (file)
index 0000000..1d2deec
--- /dev/null
@@ -0,0 +1,148 @@
+This tests that elements in the inline controls drop off when width is restricted, and are in the right place. It also tests that the wireless picker is hidden when no routes are available.
+
+This test only runs in run-webkit-tests!
+
+
+EVENT: canplaythrough
+PASS: We are using the apple idiom
+
+
+Without wireless target availability
+
+
+Testing video at width 310px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is visible
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 160px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 130px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 100px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 70px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 30px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is dropped
+
+
+With wireless target availability
+
+
+Testing video at width 350px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is visible
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is visible
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 200px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is visible
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 160px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is dropped
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 130px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is dropped
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 100px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is dropped
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 70px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is dropped
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 30px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is dropped
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is dropped
+
+Testing finished.
+
diff --git a/LayoutTests/media/controls/inline-elements-dropoff-order.html b/LayoutTests/media/controls/inline-elements-dropoff-order.html
new file mode 100644 (file)
index 0000000..2879ad7
--- /dev/null
@@ -0,0 +1,184 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <script src="../media-file.js"></script>
+        <script src="controls-test-helpers.js"></script>
+        <script>
+            var tester = new ControlsTest("../content/audio-describes-video")
+                .whenReady(setup)
+                .start();
+            var supportsWirelessTargets = !!internals.setMockMediaPlaybackTargetPickerEnabled;
+            var runNextStep, currentState, elementNames, testWidthsAndExpectedToBeDropped, testsFinished;
+
+            function setup()
+            {
+                currentState = tester.currentState;
+                tester.test("We are using the apple idiom")
+                    .value(currentState.idiom)
+                    .isEqualTo("apple");
+
+                if (supportsWirelessTargets)
+                    internals.setMockMediaPlaybackTargetPickerState("Wireless playback target", "DeviceNotAvailable");
+
+                runNextStep = runNoAirPlayTests;
+
+                tester.media.addEventListener('webkitplaybacktargetavailabilitychanged', function() {
+                    setTimeout(runNextStep, 0);
+                });
+
+                elementNames = ["Play Button", "Rewind Button", "Timeline Box", "Mute Box", "AppleTV Device Picker", "Captions Button", "Fullscreen Button"];
+
+                if (!supportsWirelessTargets)
+                    setTimeout(runNextStep, 0);
+            }
+
+            function runNoAirPlayTests() {
+                tester.logBlankLine();
+                tester.startNewSection("Without wireless target availability");
+                testWidthsAndExpectedToBeDropped = [
+                    {
+                        width: 310,
+                        expectedToBeDropped: [],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                    {
+                        width: 160,
+                        expectedToBeDropped: ["Timeline Box"],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                    {
+                        width: 130,
+                        expectedToBeDropped: ["Timeline Box", "Captions Button"],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                    {
+                        width: 100,
+                        expectedToBeDropped: ["Timeline Box", "Captions Button", "Mute Box"],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                    {
+                        width: 70,
+                        expectedToBeDropped: ["Timeline Box", "Captions Button", "Mute Box", "Rewind Button"],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                    {
+                        width: 30,
+                        expectedToBeDropped: ["Timeline Box", "Captions Button", "Mute Box", "Rewind Button", "Fullscreen Button"],
+                        expectedToBeHidden: ["AppleTV Device Picker"]
+                    },
+                ];
+                testsFinished = function() {
+                    if (supportsWirelessTargets)
+                        runAirPlayTests();
+                    else
+                        tester.end();
+                };
+                setTimeout(runNextTest, 0);
+            }
+
+            function runAirPlayTests() {
+                tester.logBlankLine();
+                tester.startNewSection("With wireless target availability");
+
+                testWidthsAndExpectedToBeDropped = [
+                    {
+                        width: 350,
+                        expectedToBeDropped: [],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 200,
+                        expectedToBeDropped: ["Timeline Box"],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 160,
+                        expectedToBeDropped: ["Timeline Box", "AppleTV Device Picker"],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 130,
+                        expectedToBeDropped: ["Timeline Box", "AppleTV Device Picker", "Captions Button"],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 100,
+                        expectedToBeDropped: ["Timeline Box", "AppleTV Device Picker", "Captions Button", "Mute Box"],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 70,
+                        expectedToBeDropped: ["Timeline Box", "AppleTV Device Picker", "Captions Button", "Mute Box", "Rewind Button"],
+                        expectedToBeHidden: []
+                    },
+                    {
+                        width: 30,
+                        expectedToBeDropped: ["Timeline Box", "AppleTV Device Picker", "Captions Button", "Mute Box", "Rewind Button", "Fullscreen Button"],
+                        expectedToBeHidden: []
+                    },
+                ];
+
+                internals.setMockMediaPlaybackTargetPickerState("Wireless playback target", "DeviceAvailable");
+                // Start running the tests after we are told availability has changed.
+                runNextStep = runNextTest;
+
+                testsFinished = function() {
+                    tester.end();
+                };
+            }
+
+            function runNextTest() {
+                if (!testWidthsAndExpectedToBeDropped.length) {
+                    testsFinished();
+                    return;
+                }
+
+                nextTest = testWidthsAndExpectedToBeDropped.shift();
+                tester.media.style.width = nextTest.width + "px";
+                setTimeout(testDroppedInlineElements, 0);
+            }
+
+            function testDroppedInlineElements() {
+                tester.startNewSection(`Testing video at width ${tester.media.style.width}`);
+                currentState = tester.currentState;
+                elementNames.forEach(function (name) {
+                    var elementState = tester.stateForControlsElement(name);
+
+                    function isElementInArray(elementName) {
+                        return elementName == name;
+                    }
+
+                    var isDropped = elementState.className.indexOf("dropped") > -1;
+                    var isHidden = elementState.className.indexOf("hidden") > -1;
+                    var expectedToBeDropped = nextTest.expectedToBeDropped.find(isElementInArray);
+                    var expectedToBeHidden = nextTest.expectedToBeHidden.find(isElementInArray);
+                    if (expectedToBeHidden) {
+                        tester.test(`${name} is hidden`)
+                            .value(isHidden)
+                            .isTrue();
+                    } else if (expectedToBeDropped) {
+                        tester.test(`${name} is dropped`)
+                            .value(isDropped)
+                            .isTrue();
+                    } else {
+                        tester.test(`${name} is visible`)
+                            .value(isDropped)
+                            .isFalse();
+                    }
+                });
+
+                setTimeout(runNextTest, 0);
+            }
+
+        </script>
+        <style>
+            body { margin-left: 0; }
+            video { width: 310px; height: 80px; }
+        </style>
+    </head>
+    <body>
+        <p>This tests that elements in the inline controls drop off when width is restricted, and are in the right place. It also tests that the wireless picker is hidden when no routes are available.</p>
+        <p>This test only runs in run-webkit-tests!</p>
+        <video controls></video>
+    </body>
+</html>
diff --git a/LayoutTests/platform/mac-mavericks/media/controls/inline-elements-dropoff-order-expected.txt b/LayoutTests/platform/mac-mavericks/media/controls/inline-elements-dropoff-order-expected.txt
new file mode 100644 (file)
index 0000000..c8a3063
--- /dev/null
@@ -0,0 +1,74 @@
+This tests that elements in the inline controls drop off when width is restricted, and are in the right place. It also tests that the wireless picker is hidden when no routes are available.
+
+This test only runs in run-webkit-tests!
+
+
+EVENT: canplaythrough
+PASS: We are using the apple idiom
+
+
+Without wireless target availability
+
+
+Testing video at width 310px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is visible
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 160px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 130px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 100px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 70px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 30px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is dropped
+
+Testing finished.
+
diff --git a/LayoutTests/platform/mac-yosemite/media/controls/inline-elements-dropoff-order-expected.txt b/LayoutTests/platform/mac-yosemite/media/controls/inline-elements-dropoff-order-expected.txt
new file mode 100644 (file)
index 0000000..c8a3063
--- /dev/null
@@ -0,0 +1,74 @@
+This tests that elements in the inline controls drop off when width is restricted, and are in the right place. It also tests that the wireless picker is hidden when no routes are available.
+
+This test only runs in run-webkit-tests!
+
+
+EVENT: canplaythrough
+PASS: We are using the apple idiom
+
+
+Without wireless target availability
+
+
+Testing video at width 310px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is visible
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 160px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is visible
+PASS: Fullscreen Button is visible
+
+Testing video at width 130px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is visible
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 100px
+
+PASS: Play Button is visible
+PASS: Rewind Button is visible
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 70px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is visible
+
+Testing video at width 30px
+
+PASS: Play Button is visible
+PASS: Rewind Button is dropped
+PASS: Timeline Box is dropped
+PASS: Mute Box is dropped
+PASS: AppleTV Device Picker is hidden
+PASS: Captions Button is dropped
+PASS: Fullscreen Button is dropped
+
+Testing finished.
+
index 4350b1b..d51e6f1 100644 (file)
@@ -1,3 +1,37 @@
+2015-11-19  Jon Lee  <jonlee@apple.com>
+
+        Add a test for media control dropoff
+        https://bugs.webkit.org/show_bug.cgi?id=151287
+        rdar://problem/23544666
+
+        Reviewed by Dean Jackson.
+
+        Test: media/controls/inline-elements-dropoff-order.html
+
+        * Modules/mediacontrols/mediaControlsApple.css:
+        (audio::-webkit-media-controls-timeline-container.dropped): Override the
+        display:none since we want the container to remain visible but acting
+        as a flexible width space to push the other elements to the ends of the
+        inline flexbox. We will want to refactor the CSS rules so that all of the
+        components in the timeline are keyed off of the container's dropped class
+        rather than having each individual component have that class attached.
+        (audio::-webkit-media-controls-panel.hidden): Deleted. Consolidate a
+        couple rules.
+        * Modules/mediacontrols/mediaControlsApple.js:
+        (Controller.prototype.updateLayoutForDisplayedWidth): Also attach the
+        "dropped" class on the timeline box. Add the captions button for reporting
+        media control state.
+        * testing/Internals.cpp:
+        (WebCore::Internals::setMockMediaPlaybackTargetPickerState): Extend this to
+        also take "DeviceNotAvailable" to update the mock device's availability.
+
+        * testing/Internals.cpp: Update to use a reference to Page.
+        (WebCore::Internals::resetToConsistentState): Reset mock enabled setting for
+        each test.
+        * testing/Internals.h:
+        * testing/js/WebCoreTestSupport.cpp:
+        (WebCoreTestSupport::resetInternalsObject): Update to use a reference to Page.
+
 2015-11-19  Xabier Rodriguez Calvar  <calvaris@igalia.com>
 
         [Streams API] Implement IsReadableStreamDisturbed according to spec
index 47c0107..45c78eb 100644 (file)
@@ -619,6 +619,11 @@ audio::-webkit-media-controls-timeline-container {
     padding: 0;
 }
 
+video::-webkit-media-controls-timeline-container.dropped,
+audio::-webkit-media-controls-timeline-container.dropped {
+    display: -webkit-flex !important;
+}
+
 video::-webkit-media-controls-panel .thumbnail-track,
 audio::-webkit-media-controls-panel .thumbnail-track {
     position: relative;
@@ -657,10 +662,7 @@ audio::-webkit-media-controls-panel .thumbnail.show {
 }
 
 video::-webkit-media-controls-panel.hidden,
-audio::-webkit-media-controls-panel.hidden {
-    display: none;
-}
-
+audio::-webkit-media-controls-panel.hidden,
 video::-webkit-media-controls-panel .hidden,
 audio::-webkit-media-controls-panel .hidden,
 video::-webkit-media-controls-panel .dropped,
index b759104..92cdbb0 100644 (file)
@@ -1501,6 +1501,7 @@ Controller.prototype = {
 
         // Check if there is enough room for the scrubber.
         var shouldDropTimeline = (visibleWidth - visibleButtonWidth) < this.MinimumTimelineWidth;
+        this.controls.timelineBox.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
         this.controls.timeline.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
         this.controls.currentTime.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
         this.controls.thumbnailTrack.classList.toggle(this.ClassNames.dropped, shouldDropTimeline);
@@ -2132,6 +2133,10 @@ Controller.prototype = {
                 object: this.controls.muteBox
             },
             {
+                name: "Captions Button",
+                object: this.controls.captionButton
+            },
+            {
                 name: "Fullscreen Button",
                 object: this.controls.fullscreenButton
             },
index 5e42a79..9d383dd 100644 (file)
@@ -348,22 +348,20 @@ Internals::~Internals()
 {
 }
 
-void Internals::resetToConsistentState(Page* page)
+void Internals::resetToConsistentState(Page& page)
 {
-    ASSERT(page);
-
-    page->setPageScaleFactor(1, IntPoint(0, 0));
-    page->setPagination(Pagination());
+    page.setPageScaleFactor(1, IntPoint(0, 0));
+    page.setPagination(Pagination());
 
-    page->setDefersLoading(false);
+    page.setDefersLoading(false);
     
-    page->mainFrame().setTextZoomFactor(1.0f);
+    page.mainFrame().setTextZoomFactor(1.0f);
     
-    FrameView* mainFrameView = page->mainFrame().view();
+    FrameView* mainFrameView = page.mainFrame().view();
     if (mainFrameView) {
         mainFrameView->setHeaderHeight(0);
         mainFrameView->setFooterHeight(0);
-        page->setTopContentInset(0);
+        page.setTopContentInset(0);
         mainFrameView->setUseFixedLayout(false);
         mainFrameView->setFixedLayoutSize(IntSize());
     }
@@ -371,16 +369,16 @@ void Internals::resetToConsistentState(Page* page)
     TextRun::setAllowsRoundingHacks(false);
     WebCore::overrideUserPreferredLanguages(Vector<String>());
     WebCore::Settings::setUsesOverlayScrollbars(false);
-    page->inspectorController().setProfilerEnabled(false);
+    page.inspectorController().setProfilerEnabled(false);
 #if ENABLE(VIDEO_TRACK)
-    page->group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
-    page->group().captionPreferences()->setTestingMode(false);
-#endif
-    if (!page->mainFrame().editor().isContinuousSpellCheckingEnabled())
-        page->mainFrame().editor().toggleContinuousSpellChecking();
-    if (page->mainFrame().editor().isOverwriteModeEnabled())
-        page->mainFrame().editor().toggleOverwriteModeEnabled();
-    page->mainFrame().loader().clearTestingOverrides();
+    page.group().captionPreferences()->setCaptionsStyleSheetOverride(emptyString());
+    page.group().captionPreferences()->setTestingMode(false);
+#endif
+    if (!page.mainFrame().editor().isContinuousSpellCheckingEnabled())
+        page.mainFrame().editor().toggleContinuousSpellChecking();
+    if (page.mainFrame().editor().isOverwriteModeEnabled())
+        page.mainFrame().editor().toggleOverwriteModeEnabled();
+    page.mainFrame().loader().clearTestingOverrides();
     ApplicationCacheStorage::singleton().setDefaultOriginQuota(ApplicationCacheStorage::noQuota());
 #if ENABLE(VIDEO)
     PlatformMediaSessionManager::sharedManager().resetRestrictions();
@@ -397,7 +395,11 @@ void Internals::resetToConsistentState(Page* page)
     MockContentFilterSettings::reset();
 #endif
 
-    page->setShowAllPlugins(false);
+#if ENABLE(WIRELESS_PLAYBACK_TARGET)
+    page.setMockMediaPlaybackTargetPickerEnabled(true);
+#endif
+
+    page.setShowAllPlugins(false);
 }
 
 Internals::Internals(Document* document)
@@ -2976,6 +2978,8 @@ void Internals::setMockMediaPlaybackTargetPickerState(const String& deviceName,
 
     if (equalIgnoringCase(deviceState, "DeviceAvailable"))
         state = MediaPlaybackTargetContext::OutputDeviceAvailable;
+    else if (equalIgnoringCase(deviceState, "DeviceNotAvailable"))
+        state = MediaPlaybackTargetContext::Unavailable;
     else {
         ec = INVALID_ACCESS_ERR;
         return;
index d6e31bb..709bcaa 100644 (file)
@@ -81,7 +81,7 @@ public:
     static Ref<Internals> create(Document*);
     virtual ~Internals();
 
-    static void resetToConsistentState(Page*);
+    static void resetToConsistentState(Page&);
 
     String elementRenderTreeAsText(Element*, ExceptionCode&);
     bool hasPausedImageAnimations(Element*, ExceptionCode&);
index f7c971c..ce5f2fd 100644 (file)
@@ -61,7 +61,7 @@ void resetInternalsObject(JSContextRef context)
     JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject());
     ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext();
     Page* page = downcast<Document>(scriptContext)->frame()->page();
-    Internals::resetToConsistentState(page);
+    Internals::resetToConsistentState(*page);
     InternalSettings::from(page)->resetToConsistentState();
 }