Changeset 211374 in webkit
- Timestamp:
- Jan 30, 2017 10:16:57 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r211373 r211374 1 2017-01-30 Antoine Quint <graouts@apple.com> 2 3 LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky 4 https://bugs.webkit.org/show_bug.cgi?id=167254 5 <rdar://problem/30259293> 6 7 Reviewed by Dean Jackson. 8 9 We improve the test by setting off timers when the actual "play" and "pause" events are 10 triggered rather than when we call .play() or .pause() on the media element. This matches 11 when the auto-hide timer are set in ControlsBar and makes the test more robust. Combined 12 with the modern-media-controls WebCore module source changes, we can now stop marking this 13 test as flaky. 14 15 We apply the same change to media/modern-media-controls/media-controller/media-controller-auto-hide-pause.html 16 since it also sets off a timer based on the media being paused. 17 18 * media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play-expected.txt: 19 * media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html: 20 * media/modern-media-controls/media-controller/media-controller-auto-hide-pause.html: 21 * platform/mac/TestExpectations: 22 1 23 2017-01-30 Daniel Bates <dabates@apple.com> 2 24 -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play-expected.txt
r209430 r211374 7 7 PASS controlsBar.classList.contains('faded') is false 8 8 9 Pausing media, this stops the auto-hide timer. 9 Pausing media. 10 Media playback has paused, this stops the auto-hide timer. 10 11 11 Resuming media playback, this should rewind the auto-hide timer and ensure that entering and leaving the media doesn't hide the controls bar until the auto-hide timer has expired after playing. 12 Resuming media playback. 13 Media playback has resumed, this should rewind the auto-hide timer and ensure that entering and leaving the media doesn't hide the controls bar until the auto-hide timer has expired after playing. 12 14 13 15 Mouse entering the media. -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html
r210959 r211374 10 10 11 11 let controlsBar; 12 let played = false;13 12 14 document.querySelector("video").addEventListener("play", (event) => { 15 if (played) 16 return; 13 const media = document.querySelector("video"); 14 media.addEventListener("play", mediaStartedPlaying); 17 15 18 played = true; 19 16 function mediaStartedPlaying() 17 { 18 media.removeEventListener("play", mediaStartedPlaying); 19 baseTime = Date.now(); 20 controlsBar = window.internals.shadowRoot(media).querySelector(".controls-bar"); 21 20 22 window.requestAnimationFrame(() => { 21 const media = event.target;22 controlsBar = window.internals.shadowRoot(media).querySelector(".controls-bar");23 23 24 24 debug("Video started playing, controls bar is visible by default."); … … 26 26 27 27 debug(""); 28 debug("Pausing media, this stops the auto-hide timer."); 28 debug("Pausing media."); 29 30 media.addEventListener("pause", mediaPaused); 29 31 media.pause(); 32 }); 33 } 34 35 function mediaPaused() 36 { 37 debug("Media playback has paused, this stops the auto-hide timer."); 38 debug(""); 39 debug("Resuming media playback."); 40 media.addEventListener("play", mediaResumedPlaying); 41 media.play(); 42 } 43 44 function mediaResumedPlaying() 45 { 46 debug("Media playback has resumed, this should rewind the auto-hide timer and ensure that entering and leaving the media doesn't hide the controls bar until the auto-hide timer has expired after playing."); 47 setTimeout(() => { 48 debug(""); 49 debug("Mouse entering the media."); 50 window.eventSender.mouseMoveTo(100, 100); 30 51 31 52 setTimeout(() => { 32 53 debug(""); 33 debug(" Resuming media playback, this should rewind the auto-hide timer and ensure that entering and leaving the media doesn't hide the controls bar until the auto-hide timer has expired after playing.");34 media.play();54 debug("Mouse leaving the media."); 55 window.eventSender.mouseMoveTo(400, 400); 35 56 36 setTimeout(() => {57 window.requestAnimationFrame(() => { 37 58 debug(""); 38 debug("Mouse entering the media."); 39 eventSender.mouseMoveTo(100, 100); 59 debug("The initial auto-hide timer started when we resumed playback should not have expired or be overriden by the mouse entering and leaving the media, the controls should remain visible."); 60 shouldBeFalse("controlsBar.classList.contains('faded')"); 61 }); 62 }, 50); 63 }, 50); 40 64 41 42 43 debug("Mouse leaving the media.");44 eventSender.mouseMoveTo(400, 400);65 setTimeout(() => { 66 debug(""); 67 debug("The initial auto-hide timer started when we resumed playback should now have expired and the controls should be faded."); 68 shouldBeTrue("controlsBar.classList.contains('faded')"); 45 69 46 window.requestAnimationFrame(() => { 47 debug(""); 48 debug("The initial auto-hide timer started when we resumed playback should not have expired or be overriden by the mouse entering and leaving the media, the controls should remain visible."); 49 shouldBeFalse("controlsBar.classList.contains('faded')"); 50 51 }); 52 }, 50); 53 }, 50); 54 55 setTimeout(() => { 56 debug(""); 57 debug("The initial auto-hide timer started when we resumed playback should now have expired and the controls should be faded."); 58 shouldBeTrue("controlsBar.classList.contains('faded')"); 59 60 debug(""); 61 media.remove(); 62 finishJSTest(); 63 }, 300); 64 }); 65 }); 66 }); 70 debug(""); 71 media.remove(); 72 finishJSTest(); 73 }, 300); 74 } 67 75 68 76 </script> -
trunk/LayoutTests/media/modern-media-controls/media-controller/media-controller-auto-hide-pause.html
r210959 r211374 11 11 let controlsBar; 12 12 13 document.querySelector("video").addEventListener("play", (event)=> {13 document.querySelector("video").addEventListener("play", event => { 14 14 window.requestAnimationFrame(() => { 15 15 const media = event.target; … … 20 20 21 21 media.pause(); 22 media.addEventListener("pause", event => { 23 setTimeout(() => { 24 debug(""); 25 debug("Auto-hide timer would have elapsed, but media was paused so controls bar should remain visible."); 26 shouldBeFalse("controlsBar.classList.contains('faded')"); 22 27 23 setTimeout(() => { 24 debug(""); 25 debug("Auto-hide timer would have elapsed, but media was paused so controls bar should remain visible."); 26 shouldBeFalse("controlsBar.classList.contains('faded')"); 27 28 debug(""); 29 media.remove(); 30 finishJSTest(); 31 }, 300); 28 debug(""); 29 media.remove(); 30 finishJSTest(); 31 }, 300); 32 }); 32 33 }); 33 34 }); -
trunk/LayoutTests/platform/mac/TestExpectations
r211302 r211374 1470 1470 webkit.org/b/165290 media/modern-media-controls/tracks-panel/tracks-panel-hide-click-outside.html [ Pass Timeout ] 1471 1471 1472 webkit.org/b/167254 media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html [ Pass Failure ]1473 1474 1472 webkit.org/b/167263 media/modern-media-controls/media-controller/media-controller-auto-hide.html [ Pass Failure ] 1475 1473 -
trunk/Source/WebCore/ChangeLog
r211372 r211374 1 2017-01-30 Antoine Quint <graouts@apple.com> 2 3 LayoutTest media/modern-media-controls/media-controller/media-controller-auto-hide-mouse-leave-after-play.html is flaky 4 https://bugs.webkit.org/show_bug.cgi?id=167254 5 <rdar://problem/30259293> 6 7 Reviewed by Dean Jackson. 8 9 When we would identify that we need to prolong an existing auto-hide timer, when the previous 10 auto-hide timer was marked as non-cancelable, calling _cancelAutoHideTimer() would not actually 11 cancel the previous timer, which would let it fire and hide the controls bar. We now have two 12 methods, _cancelAutoHideTimer() which always cancels the current auto-hide timer, and 13 _cancelNonEnforcedAutoHideTimer() which is used from all other existing call sites, which only 14 cancels the current auto-hide timer if it was marked as cancelable. This, and revised timing in 15 the test itself, make media/modern-media-controls/media-controller/media-controller-auto-hide- 16 mouse-leave-after-play.html a lot more reliable. 17 18 We also make a small drive-by fix where we ensure the "autoHideDelay" property is set first so 19 that setting other members which may set a timer do not used an undefined value for the auto-hide 20 timer delay. 21 22 * Modules/modern-media-controls/controls/controls-bar.js: 23 (ControlsBar.prototype.set visible): 24 (ControlsBar.prototype.handleEvent): 25 (ControlsBar.prototype._cancelNonEnforcedAutoHideTimer): 26 (ControlsBar.prototype._cancelAutoHideTimer): 27 1 28 2017-01-30 Carlos Garcia Campos <cgarcia@igalia.com> 2 29 -
trunk/Source/WebCore/Modules/modern-media-controls/controls/controls-bar.js
r211209 r211374 34 34 this._mediaControls = mediaControls; 35 35 36 this.autoHideDelay = ControlsBar.DefaultAutoHideDelay; 37 36 38 this.fadesWhileIdle = false; 37 39 this.userInteractionEnabled = true; 38 39 this.autoHideDelay = ControlsBar.DefaultAutoHideDelay;40 40 41 41 if (GestureRecognizer.SupportsTouches) … … 119 119 this.faded = false; 120 120 else if (!flag) 121 this._cancel AutoHideTimer();121 this._cancelNonEnforcedAutoHideTimer(); 122 122 123 123 super.visible = flag; … … 158 158 if (event.type === "mouseenter") { 159 159 this._disableAutoHiding = true; 160 this._cancel AutoHideTimer();160 this._cancelNonEnforcedAutoHideTimer(); 161 161 } else if (event.type === "mouseleave") { 162 162 delete this._disableAutoHiding; … … 196 196 // Private 197 197 198 _cancelNonEnforcedAutoHideTimer() 199 { 200 if (!this._enforceAutoHideTimer) 201 this._cancelAutoHideTimer(); 202 203 } 204 198 205 _cancelAutoHideTimer() 199 206 { 200 if (this._enforceAutoHideTimer)201 return;202 203 207 window.clearTimeout(this._autoHideTimer); 204 208 delete this._autoHideTimer;
Note: See TracChangeset
for help on using the changeset viewer.