Title: [228017] trunk/LayoutTests
Revision
228017
Author
grao...@webkit.org
Date
2018-02-02 10:51:37 -0800 (Fri, 02 Feb 2018)

Log Message

[Modern Media Controls] Turn media/modern-media-controls/volume-* back on
https://bugs.webkit.org/show_bug.cgi?id=182438

Reviewed by Dean Jackson.

Update tests to match the modern-media-controls design and expectations.
One test was reworked as a Slider test since VolumeSlider no longer exists.

* media/modern-media-controls/slider/slider-value-expected.txt: Renamed from LayoutTests/media/modern-media-controls/volume-slider/volume-slider-value-expected.txt.
* media/modern-media-controls/slider/slider-value.html: Renamed from LayoutTests/media/modern-media-controls/volume-slider/volume-slider-value.html.
* media/modern-media-controls/volume-down-support/volume-down-support-expected.txt:
* media/modern-media-controls/volume-down-support/volume-down-support.html:
* media/modern-media-controls/volume-slider/volume-slider-expected.txt: Removed.
* media/modern-media-controls/volume-slider/volume-slider-value-expected.txt: Removed.
* media/modern-media-controls/volume-slider/volume-slider.html: Removed.
* media/modern-media-controls/volume-support/volume-support-click-expected.txt:
* media/modern-media-controls/volume-support/volume-support-click.html:
* media/modern-media-controls/volume-support/volume-support-drag-expected.txt:
* media/modern-media-controls/volume-support/volume-support-drag.html:
* media/modern-media-controls/volume-up-support/volume-up-support-expected.txt:
* media/modern-media-controls/volume-up-support/volume-up-support.html:
* platform/ios/TestExpectations:
* platform/mac/TestExpectations:

Modified Paths

Added Paths

Removed Paths

  • trunk/LayoutTests/media/modern-media-controls/volume-slider/

Diff

Modified: trunk/LayoutTests/ChangeLog (228016 => 228017)


--- trunk/LayoutTests/ChangeLog	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/ChangeLog	2018-02-02 18:51:37 UTC (rev 228017)
@@ -1,5 +1,31 @@
 2018-02-02  Antoine Quint  <grao...@apple.com>
 
+        [Modern Media Controls] Turn media/modern-media-controls/volume-* back on
+        https://bugs.webkit.org/show_bug.cgi?id=182438
+
+        Reviewed by Dean Jackson.
+
+        Update tests to match the modern-media-controls design and expectations.
+        One test was reworked as a Slider test since VolumeSlider no longer exists.
+
+        * media/modern-media-controls/slider/slider-value-expected.txt: Renamed from LayoutTests/media/modern-media-controls/volume-slider/volume-slider-value-expected.txt.
+        * media/modern-media-controls/slider/slider-value.html: Renamed from LayoutTests/media/modern-media-controls/volume-slider/volume-slider-value.html.
+        * media/modern-media-controls/volume-down-support/volume-down-support-expected.txt:
+        * media/modern-media-controls/volume-down-support/volume-down-support.html:
+        * media/modern-media-controls/volume-slider/volume-slider-expected.txt: Removed.
+        * media/modern-media-controls/volume-slider/volume-slider-value-expected.txt: Removed.
+        * media/modern-media-controls/volume-slider/volume-slider.html: Removed.
+        * media/modern-media-controls/volume-support/volume-support-click-expected.txt:
+        * media/modern-media-controls/volume-support/volume-support-click.html:
+        * media/modern-media-controls/volume-support/volume-support-drag-expected.txt:
+        * media/modern-media-controls/volume-support/volume-support-drag.html:
+        * media/modern-media-controls/volume-up-support/volume-up-support-expected.txt:
+        * media/modern-media-controls/volume-up-support/volume-up-support.html:
+        * platform/ios/TestExpectations:
+        * platform/mac/TestExpectations:
+
+2018-02-02  Antoine Quint  <grao...@apple.com>
+
         [Modern Media Controls] Turn media/modern-media-controls/tracks-panel and media/modern-media-controls/tracks-support back on
         https://bugs.webkit.org/show_bug.cgi?id=182426
 

Added: trunk/LayoutTests/media/modern-media-controls/slider/slider-value-expected.txt (0 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/slider/slider-value-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/slider/slider-value-expected.txt	2018-02-02 18:51:37 UTC (rev 228017)
@@ -0,0 +1,35 @@
+Testing the Slider value property.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS slider.value is 0
+
+Now we'll drag to the slider thumb from 10px to 30px within the slider's bounds
+controlValueWillStartChanging
+controlValueDidChange, value = 0.048
+controlValueDidChange, value = 0.053
+controlValueDidChange, value = 0.058
+controlValueDidChange, value = 0.063
+controlValueDidChange, value = 0.068
+controlValueDidChange, value = 0.073
+controlValueDidChange, value = 0.078
+controlValueDidChange, value = 0.083
+controlValueDidChange, value = 0.088
+controlValueDidChange, value = 0.093
+controlValueDidChange, value = 0.098
+controlValueDidChange, value = 0.103
+controlValueDidChange, value = 0.108
+controlValueDidChange, value = 0.113
+controlValueDidChange, value = 0.118
+controlValueDidChange, value = 0.123
+controlValueDidChange, value = 0.128
+controlValueDidChange, value = 0.133
+controlValueDidChange, value = 0.138
+controlValueDidChange, value = 0.143
+controlValueDidChange, value = 0.148
+controlValueDidStopChanging
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Copied: trunk/LayoutTests/media/modern-media-controls/slider/slider-value.html (from rev 228015, trunk/LayoutTests/media/modern-media-controls/volume-slider/volume-slider-value.html) (0 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/slider/slider-value.html	                        (rev 0)
+++ trunk/LayoutTests/media/modern-media-controls/slider/slider-value.html	2018-02-02 18:51:37 UTC (rev 228017)
@@ -0,0 +1,72 @@
+<script src=""
+<script src="" type="text/_javascript_"></script>
+<style type="text/css" media="screen">
+    .slider { position: absolute; }
+</style>
+<body>
+<script type="text/_javascript_">
+
+description("Testing the <code>Slider</code> value property.");
+
+window.jsTestIsAsync = true;
+
+const KNOB_WIDTH = 9;
+
+const slider = new Slider;
+slider.x = 10;
+slider.y = 32;
+slider.width = 200 + KNOB_WIDTH;
+
+slider.uiDelegate = {
+
+    controlValueWillStartChanging: function()
+    {
+        debug(`controlValueWillStartChanging`);
+    },
+
+    controlValueDidChange: function()
+    {
+        debug(`controlValueDidChange, value = ${slider.value}`);
+    },
+
+    controlValueDidStopChanging: function()
+    {
+        debug(`controlValueDidStopChanging`);
+        finishJSTest();
+    }
+
+};
+
+const input = slider.children[1].element;
+
+function dragSlider(fromPx, toPx) {
+    const bounds = input.getBoundingClientRect();
+    const minX = bounds.left + KNOB_WIDTH / 2;
+    const centerY = bounds.top + bounds.height / 2;
+
+    eventSender.mouseMoveTo(minX + fromPx, centerY);
+    eventSender.mouseDown();
+
+    const delta = toPx - fromPx;
+    const iterations = Math.abs(delta);
+    for (let i = 1; i <= iterations; ++i)
+        eventSender.mouseMoveTo(minX + fromPx + i * Math.sign(delta), centerY);
+
+    eventSender.mouseUp();
+}
+
+scheduler.frameDidFire = function()
+{
+    document.body.appendChild(slider.element);
+
+    shouldBe("slider.value", "0");
+    debug("");
+    debug("Now we'll drag to the slider thumb from 10px to 30px within the slider's bounds");
+    dragSlider(10, 30);
+    
+    scheduler.frameDidFire = null;
+}
+
+</script>
+<script src=""
+</body>

Modified: trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support-expected.txt (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support-expected.txt	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support-expected.txt	2018-02-02 18:51:37 UTC (rev 228017)
@@ -3,12 +3,13 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS !!window.internals.shadowRoot(media).lastChild.querySelector("button.volume-down") became true
+PASS !!internals.shadowRoot(media).querySelector("button.volume-down") became true
 PASS media.webkitDisplayingFullscreen is true
-PASS media.volume is 1
+PASS media.volume is 0.5
+PASS volumeSlider.getBoundingClientRect().left became 196
 
 Pressing on the volume down button
-PASS media.volume is within 0.1 of 0
+PASS media.volume is 0
 
 PASS successfullyParsed is true
 

Modified: trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support.html (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support.html	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-down-support/volume-down-support.html	2018-02-02 18:51:37 UTC (rev 228017)
@@ -2,8 +2,8 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
+<button id="fullscreen" style="position: absolute; left: 0; top: 0;">Enter fullscreen</button>
 <video src="" style="width: 320px; height: 240px;" controls></video>
-<div id="shadow"></div>
 <script type="text/_javascript_">
 
 window.jsTestIsAsync = true;
@@ -11,26 +11,53 @@
 description("Testing clicking on the volume down button correctly sets the volume to 0.");
 
 const media = document.querySelector("video");
-const button = document.body.appendChild(document.createElement("button"));
+const button = document.querySelector("#fullscreen");
 
-button.addEventListener("click", () => media.webkitEnterFullscreen());
+media.volume = 0.5;
 
+function enterFullscreen()
+{
+    if (!("eventSender" in window)) {
+        debug("This test is designed to run in DRT");
+        return;
+    }
+
+    // Click a button so we may enter fullscreen.
+    button.addEventListener("click", event => {
+        try {
+            media.webkitEnterFullscreen();
+        } catch(e) {
+            debug("Toggling fullscreen failed");
+            finishJSTest();
+        }
+    });
+
+    pressOnElement(button);
+}
+
+let volumeDownButton, volumeSlider;
 media.addEventListener("loadedmetadata", () => {
-    pressOnElement(button);
-    shouldBecomeEqual('!!window.internals.shadowRoot(media).lastChild.querySelector("button.volume-down")', "true", () => {
+    enterFullscreen();
+    shouldBecomeEqual('!!internals.shadowRoot(media).querySelector("button.volume-down")', "true", () => {
         shouldBeTrue("media.webkitDisplayingFullscreen");
-        shouldBe("media.volume", "1");
+        shouldBe("media.volume", "0.5");
 
-        shouldBeCloseTo("media.volume", "0", () => {
+        volumeDownButton = internals.shadowRoot(media).querySelector("button.volume-down");
+        volumeSlider = internals.shadowRoot(media).querySelector(".slider.volume");
+
+        shouldBecomeEqual('volumeSlider.getBoundingClientRect().left', "196", () => {
+            media.addEventListener("volumechange", () => {
+                shouldBe("media.volume", "0");
+                debug("");
+                media.remove();
+                button.remove();
+                finishJSTest();
+            });
+
             debug("");
-            media.remove();
-            button.remove();
-            finishJSTest();
+            debug("Pressing on the volume down button");
+            pressOnElement(volumeDownButton);
         });
-
-        debug("");
-        debug("Pressing on the volume down button");
-        pressOnElement(window.internals.shadowRoot(media).lastElementChild.lastElementChild.querySelector("button.volume-down"));
     });
 });
 

Modified: trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click-expected.txt (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click-expected.txt	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click-expected.txt	2018-02-02 18:51:37 UTC (rev 228017)
@@ -4,7 +4,7 @@
 
 
 PASS mediaController.controls.volumeSlider.parent.visible is true
-PASS media.volume is 0.5
+PASS media.volume is 0.51
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click.html (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click.html	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-click.html	2018-02-02 18:51:37 UTC (rev 228017)
@@ -55,7 +55,9 @@
 mediaController.controls.showsStartButton = false;
 
 media.addEventListener("volumechange", () => {
-    shouldBe("media.volume", "0.5");
+    // Because the slider has a 9pt-wide knob and tests are ran at 1x, we can't get 0.5 here, and instead get 0.51 since
+    // the slider will only increment on whole pixels.
+    shouldBe("media.volume", "0.51");
     container.remove();
     media.remove();
     finishJSTest();

Modified: trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag-expected.txt (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag-expected.txt	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag-expected.txt	2018-02-02 18:51:37 UTC (rev 228017)
@@ -13,7 +13,7 @@
 
 We initiated a volume slider drag, the media should no longer be muted and the volume set
 PASS media.muted became false
-PASS media.volume became 0.5
+PASS media.volume became 0.51
 
 We finished dragging to set the volume to 1
 PASS media.volume became 1

Modified: trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag.html (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag.html	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag.html	2018-02-02 18:51:37 UTC (rev 228017)
@@ -56,7 +56,9 @@
             debug("");
             debug("We initiated a volume slider drag, the media should no longer be muted and the volume set");
             shouldBecomeEqual("media.muted", "false", () => {
-                shouldBecomeEqual("media.volume", "0.5", () => {
+                // Because the slider has a 9pt-wide knob and tests are ran at 1x, we can't get 0.5 here,
+                // and instead get 0.51 since the slider will only increment on whole pixels.
+                shouldBecomeEqual("media.volume", "0.51", () => {
                     for (let i = 1; i <= iterations; ++i)
                         eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta));
 
@@ -78,6 +80,8 @@
     });
 });
 
+setTimeout(finishJSTest, 3500);
+
 </script>
 <script src=""
 </body>

Modified: trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support-expected.txt (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support-expected.txt	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support-expected.txt	2018-02-02 18:51:37 UTC (rev 228017)
@@ -3,8 +3,10 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS !!window.internals.shadowRoot(media).querySelector('button.volume-up') became true
+PASS !!internals.shadowRoot(media).querySelector("button.volume-up") became true
+PASS media.webkitDisplayingFullscreen is true
 PASS media.volume is 0.5
+PASS volumeSlider.getBoundingClientRect().left became 196
 
 Pressing on the volume up button
 PASS media.volume is 1

Modified: trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support.html (228016 => 228017)


--- trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support.html	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/media/modern-media-controls/volume-up-support/volume-up-support.html	2018-02-02 18:51:37 UTC (rev 228017)
@@ -2,8 +2,8 @@
 <script src=""
 <script src="" type="text/_javascript_"></script>
 <body>
+<button id="fullscreen" style="position: absolute; left: 0; top: 0;">Enter fullscreen</button>
 <video src="" style="width: 320px; height: 240px;" controls></video>
-<div id="shadow"></div>
 <script type="text/_javascript_">
 
 window.jsTestIsAsync = true;
@@ -11,31 +11,12 @@
 description("Testing clicking on the volume up button correctly sets the volume to 1.");
 
 const media = document.querySelector("video");
-const button = document.body.appendChild(document.createElement("button"));
+const button = document.querySelector("#fullscreen");
 
 media.volume = 0.5;
 
-media.addEventListener("webkitfullscreenchange", function() {
-    if (media.webkitDisplayingFullscreen) {
-        shouldBecomeEqual("!!window.internals.shadowRoot(media).querySelector('button.volume-up')", "true", () => {
-            shouldBe("media.volume", "0.5");
-
-            media.addEventListener("volumechange", () => {
-                shouldBe("media.volume", "1");
-                debug("");
-                media.remove();
-                button.remove();
-                finishJSTest();
-            });
-
-            debug("");
-            debug("Pressing on the volume up button");
-            pressOnElement(window.internals.shadowRoot(media).querySelector("button.volume-up"));
-        });
-    }
-});
-
-media.addEventListener("loadedmetadata", () => {
+function enterFullscreen()
+{
     if (!("eventSender" in window)) {
         debug("This test is designed to run in DRT");
         return;
@@ -52,6 +33,32 @@
     });
 
     pressOnElement(button);
+}
+
+let volumeUpButton, volumeSlider;
+media.addEventListener("loadedmetadata", () => {
+    enterFullscreen();
+    shouldBecomeEqual('!!internals.shadowRoot(media).querySelector("button.volume-up")', "true", () => {
+        shouldBeTrue("media.webkitDisplayingFullscreen");
+        shouldBe("media.volume", "0.5");
+
+        volumeUpButton = internals.shadowRoot(media).querySelector("button.volume-up");
+        volumeSlider = internals.shadowRoot(media).querySelector(".slider.volume");
+
+        shouldBecomeEqual('volumeSlider.getBoundingClientRect().left', "196", () => {
+            media.addEventListener("volumechange", () => {
+                shouldBe("media.volume", "1");
+                debug("");
+                media.remove();
+                button.remove();
+                finishJSTest();
+            });
+
+            debug("");
+            debug("Pressing on the volume up button");
+            pressOnElement(volumeUpButton);
+        });
+    });
 });
 
 </script>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (228016 => 228017)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-02-02 18:51:37 UTC (rev 228017)
@@ -3290,6 +3290,7 @@
 media/modern-media-controls/playback-support/playback-support-button-click.html [ Skip ]
 media/modern-media-controls/scrubber-support/scrubber-support-click.html [ Skip ]
 media/modern-media-controls/scrubber-support/scrubber-support-drag.html [ Skip ]
+media/modern-media-controls/slider/slider-value.html [ Skip ]
 
 webkit.org/b/178127 media/modern-media-controls/media-controller/media-controller-video-with-only-audio.html [ Skip ]
 

Modified: trunk/LayoutTests/platform/mac/TestExpectations (228016 => 228017)


--- trunk/LayoutTests/platform/mac/TestExpectations	2018-02-02 17:44:36 UTC (rev 228016)
+++ trunk/LayoutTests/platform/mac/TestExpectations	2018-02-02 18:51:37 UTC (rev 228017)
@@ -1495,6 +1495,8 @@
 media/modern-media-controls/tracks-panel [ Pass ]
 media/modern-media-controls/tracks-support [ Pass ]
 media/modern-media-controls/tracks-button [ Pass ]
+media/modern-media-controls/volume-down-support [ Pass ]
+media/modern-media-controls/volume-support [ Pass ]
 media/modern-media-controls/volume-up-support [ Pass ]
 
 # These tests are iOS-specific
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to