Changeset 213317 in webkit
- Timestamp:
- Mar 2, 2017 3:53:49 PM (7 years ago)
- Location:
- trunk/LayoutTests
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r213315 r213317 1 2017-03-02 Antoine Quint <graouts@apple.com> 2 3 LayoutTest media/modern-media-controls/volume-support/volume-support-drag.html is a flaky failure 4 https://bugs.webkit.org/show_bug.cgi?id=164226 5 <rdar://problem/30811901> 6 7 Reviewed by Dean Jackson. 8 9 Use asynchronous assertions to step through the test and make it more robust. 10 11 * media/modern-media-controls/volume-support/volume-support-drag-expected.txt: 12 * media/modern-media-controls/volume-support/volume-support-drag.html: 13 1 14 2017-03-02 Ryan Haddad <ryanhaddad@apple.com> 2 15 -
trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag-expected.txt
r212861 r213317 6 6 By default, the volume slider should be set to 0 because the media is muted 7 7 PASS mediaController.controls.volumeSlider.value is 0 8 PASS muteButton.getBoundingClientRect().width became different from 0 9 PASS volumeSlider.getBoundingClientRect().width became different from 0 8 10 9 11 Before starting to drag the volume slider, the media should be muted still … … 11 13 12 14 We initiated a volume slider drag, the media should no longer be muted and the volume set 13 PASS media.muted isfalse14 PASS media.volume is0.515 PASS media.muted became false 16 PASS media.volume became 0.5 15 17 16 18 We finished dragging to set the volume to 1 17 PASS media.volume is119 PASS media.volume became 1 18 20 PASS mediaController.controls.volumeSlider.parent.visible is true 19 21 PASS successfullyParsed is true -
trunk/LayoutTests/media/modern-media-controls/volume-support/volume-support-drag.html
r212943 r213317 26 26 const mediaController = createControls(container, media, null); 27 27 28 const muteButton = mediaController.controls.muteButton.element; 29 const volumeSlider = mediaController.controls.volumeSlider.children[1].element; 30 28 31 debug("By default, the volume slider should be set to 0 because the media is muted"); 29 32 shouldBe("mediaController.controls.volumeSlider.value", "0"); 30 33 31 let numberOfFrames = 0; 32 scheduler.frameDidFire = function() { 33 const muteButtonElement = mediaController.controls.muteButton.element; 34 const muteButtonBounds = muteButtonElement.getBoundingClientRect(); 35 if (media.paused || muteButtonBounds.width === 0) 36 return; 37 38 numberOfFrames++; 39 40 if (numberOfFrames == 1) { 34 media.addEventListener("play", () => { 35 media.pause(); 36 shouldBecomeDifferent("muteButton.getBoundingClientRect().width", "0", () => { 37 const muteButtonBounds = muteButton.getBoundingClientRect(); 41 38 // Controls are now visible, let's hover over the mute button to make the volume control visible. 42 39 eventSender.mouseMoveTo(muteButtonBounds.left + muteButtonBounds.width / 2, muteButtonBounds.top + muteButtonBounds.height / 2); 43 } else if (numberOfFrames == 2){44 // Volume slider is visible, let's start dragging in the middle of it.45 const bounds = mediaController.controls.volumeSlider.children[1].element.getBoundingClientRect();46 const centerX = bounds.left + bounds.width / 2;47 const dragStartY = bounds.top + bounds.height / 2;48 const dragEndY = bounds.top;49 const delta = dragEndY - dragStartY;50 const iterations = Math.abs(delta);40 shouldBecomeDifferent("volumeSlider.getBoundingClientRect().width", "0", () => { 41 // Volume slider is visible, let's start dragging in the middle of it. 42 const bounds = volumeSlider.getBoundingClientRect(); 43 const centerX = bounds.left + bounds.width / 2; 44 const dragStartY = bounds.top + bounds.height / 2; 45 const dragEndY = bounds.top; 46 const delta = dragEndY - dragStartY; 47 const iterations = Math.abs(delta); 51 48 52 debug("");53 debug("Before starting to drag the volume slider, the media should be muted still");54 shouldBeTrue("media.muted");49 debug(""); 50 debug("Before starting to drag the volume slider, the media should be muted still"); 51 shouldBeTrue("media.muted"); 55 52 56 eventSender.mouseMoveTo(centerX, dragStartY);57 eventSender.mouseDown();53 eventSender.mouseMoveTo(centerX, dragStartY); 54 eventSender.mouseDown(); 58 55 59 debug(""); 60 debug("We initiated a volume slider drag, the media should no longer be muted and the volume set"); 61 shouldBeFalse("media.muted"); 62 shouldBe("media.volume", "0.5"); 56 debug(""); 57 debug("We initiated a volume slider drag, the media should no longer be muted and the volume set"); 58 shouldBecomeEqual("media.muted", "false", () => { 59 shouldBecomeEqual("media.volume", "0.5", () => { 60 for (let i = 1; i <= iterations; ++i) 61 eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta)); 63 62 64 for (let i = 1; i <= iterations; ++i) 65 eventSender.mouseMoveTo(bounds.left + bounds.width / 2, dragStartY + i * Math.sign(delta)); 63 eventSender.mouseUp(); 66 64 67 eventSender.mouseUp(); 65 debug(""); 66 debug("We finished dragging to set the volume to 1"); 67 shouldBecomeEqual("media.volume", "1", () => { 68 // Ensure the volume slider remains visible. 69 shouldBeTrue("mediaController.controls.volumeSlider.parent.visible"); 68 70 69 debug(""); 70 debug("We finished dragging to set the volume to 1"); 71 shouldBe("media.volume", "1"); 72 73 // Ensure the volume slider remains visible. 74 shouldBeTrue("mediaController.controls.volumeSlider.parent.visible"); 75 76 container.remove(); 77 media.remove(); 78 finishMediaControlsTest(); 79 } 80 }; 81 82 // First, ensure controls are shown. 83 mediaController.controls.showsStartButton = false; 71 container.remove(); 72 media.remove(); 73 finishJSTest(); 74 }); 75 }); 76 }); 77 }); 78 }); 79 }); 84 80 85 81 </script>
Note: See TracChangeset
for help on using the changeset viewer.