OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <title>Tests that video controls are shown when entering/exiting fullscreen |
| 3 whilst hovering over the controls. Opposite of |
| 4 video-enter-exit-fullscreen-without-hovering-doesnt-show-controls.html</title> |
| 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../media-file.js"></script> |
| 8 <script src="../media-controls.js"></script> |
| 9 |
| 10 <video controls></video> |
| 11 |
| 12 <script> |
| 13 async_test(function(t) { |
| 14 var video = document.querySelector("video"); |
| 15 |
| 16 video.oncanplaythrough = t.step_func(function() { |
| 17 video.oncanplaythrough = null; |
| 18 |
| 19 var panel = mediaControlsButton(video, "panel"); |
| 20 |
| 21 // Move mouse to the play button and start playing the video. |
| 22 clickAtCoordinates(...mediaControlsButtonCoordinates(video, "play-button")); |
| 23 |
| 24 assert_equals(getComputedStyle(panel).opacity, "1", |
| 25 "Inline controls should initially show since controls " + |
| 26 "attribute is present"); |
| 27 |
| 28 // Get fullscreen button coordinates whilst it is visible. |
| 29 var inlineFullscreenButtonCoordinates = |
| 30 mediaControlsButtonCoordinates(video, "fullscreen-button"); |
| 31 |
| 32 // Move mouse away so it no longer hovers over controls/video. |
| 33 eventSender.mouseMoveTo(0, 0); |
| 34 |
| 35 runAfterHideMediaControlsTimerFired(t.step_func(function() { |
| 36 assert_equals(getComputedStyle(panel).opacity, "0", |
| 37 "Inline controls should be hidden by timer"); |
| 38 |
| 39 // Move mouse to the fullscreen button and enter fullscreen. Leave the |
| 40 // mouse hovering over the controls. |
| 41 clickAtCoordinates(...inlineFullscreenButtonCoordinates); |
| 42 }), video); |
| 43 |
| 44 video.onwebkitfullscreenchange = t.step_func(function() { |
| 45 video.onwebkitfullscreenchange = null; |
| 46 |
| 47 assert_equals(document.webkitFullscreenElement, video, |
| 48 "Should have entered fullscreen"); |
| 49 |
| 50 assert_equals(getComputedStyle(panel).opacity, "1", |
| 51 "Fullscreen controls should show after entering " + |
| 52 "fullscreen since mouse is hovering over controls"); |
| 53 |
| 54 // Get fullscreen button coordinates whilst it is visible. |
| 55 var fullscreenFullscreenButtonCoordinates = |
| 56 mediaControlsButtonCoordinates(video, "fullscreen-button"); |
| 57 |
| 58 // Move mouse away so it no longer hovers over controls/video. |
| 59 eventSender.mouseMoveTo(0, 0); |
| 60 |
| 61 runAfterHideMediaControlsTimerFired(t.step_func(function() { |
| 62 assert_equals(getComputedStyle(panel).opacity, "0", |
| 63 "Fullscreen controls should be hidden by timer"); |
| 64 |
| 65 // Move mouse to the fullscreen button and exit fullscreen. Leave the |
| 66 // mouse hovering over the controls. |
| 67 clickAtCoordinates(...fullscreenFullscreenButtonCoordinates); |
| 68 }), video); |
| 69 |
| 70 video.onwebkitfullscreenchange = t.step_func(function() { |
| 71 assert_equals(document.webkitFullscreenElement, null, |
| 72 "Should have exited fullscreen"); |
| 73 |
| 74 assert_equals(getComputedStyle(panel).opacity, "1", |
| 75 "Inline controls should show again after exiting " + |
| 76 "fullscreen since mouse is hovering over controls"); |
| 77 |
| 78 t.done(); |
| 79 }); |
| 80 }); |
| 81 }); |
| 82 |
| 83 video.src = findMediaFile("video", "../content/test-25fps"); |
| 84 }); |
| 85 </script> |
OLD | NEW |