OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../resources/js-test.js"></script> | 2 <script src="../resources/js-test.js"></script> |
3 <script src="full-screen-test.js"></script> | 3 <script src="full-screen-test.js"></script> |
4 <script src="../fast/events/touch/resources/touch-hover-active-tests.js"></scrip
t> | 4 <script src="../fast/events/touch/resources/touch-hover-active-tests.js"></scrip
t> |
5 <link rel="stylesheet" href="../fast/events/touch/resources/touch-hover-active-t
ests.css"> | 5 <link rel="stylesheet" href="../fast/events/touch/resources/touch-hover-active-t
ests.css"> |
6 | 6 |
7 <button id="enter" class='touch-interactive' onclick="document.body.webkitReques
tFullScreen()">Go full screen</button> | 7 <button id="enter" class='touch-interactive' onclick="document.body.webkitReques
tFullScreen()">Go full screen</button> |
8 <button id="exit" class='touch-interactive' onclick="document.webkitCancelFullSc
reen()">Exit full screen</button> | 8 <button id="exit" class='touch-interactive' onclick="document.webkitCancelFullSc
reen()">Exit full screen</button> |
9 | 9 |
10 <script> | 10 <script> |
11 var enterButton; | 11 var enterButton; |
12 var exitButton; | 12 var exitButton; |
13 | 13 |
14 function runTest() { | 14 function runTest() { |
15 if (!window.eventSender) { | 15 if (!window.eventSender) { |
16 debug('This test requires DRT.'); | 16 debug('This test requires DRT.'); |
17 return; | 17 return; |
18 } | 18 } |
19 | 19 |
20 enterButton = document.getElementById('enter'); | 20 enterButton = document.getElementById('enter'); |
21 exitButton = document.getElementById('exit'); | 21 exitButton = document.getElementById('exit'); |
22 | 22 |
23 var enterButtonCenter = elementCenter(enterButton); | 23 var enterButtonCenter = elementCenter(enterButton); |
24 | 24 |
25 waitForEventOnce(document, 'webkitfullscreenchange', function() { | 25 waitForEventOnce(document, 'webkitfullscreenchange', function() { |
26 shouldBeTrue("document.webkitIsFullScreen") | 26 shouldBeTrue("document.webkitIsFullScreen"); |
27 // After entering fullscreen, the button should lose hover | 27 // After entering fullscreen + layout, the button should lose hover. |
28 shouldBeDefault("getHoverActiveState(enterButton)") | 28 // TODO(foolip): Synchronize hover state changes with animation frames. |
| 29 // https://crbug.com/668758 |
| 30 shouldBeOnlyHovered("getHoverActiveState(enterButton)"); |
| 31 testRunner.layoutAndPaintAsyncThen(function() { |
| 32 shouldBeDefault("getHoverActiveState(enterButton)"); |
29 | 33 |
30 waitForEventOnce(document, 'webkitfullscreenchange', function() { | 34 waitForEventOnce(document, 'webkitfullscreenchange', function() { |
31 shouldBeFalse("document.webkitIsFullScreen") | 35 shouldBeFalse("document.webkitIsFullScreen"); |
32 // After leaving fullscreen, the button should lose hover | 36 // After exiting fullscreen + layout, the button should lose hov
er. |
33 shouldBeDefault("getHoverActiveState(exitButton)") | 37 shouldBeOnlyHovered("getHoverActiveState(exitButton)"); |
34 endTest(); | 38 testRunner.layoutAndPaintAsyncThen(function() { |
| 39 shouldBeDefault("getHoverActiveState(exitButton)"); |
| 40 endTest(); |
| 41 }); |
| 42 }); |
| 43 |
| 44 var exitButtonCenter = elementCenter(exitButton); |
| 45 // Hover on and click the "Exit fullscreen" button |
| 46 eventSender.mouseMoveTo(exitButtonCenter.x, exitButtonCenter.y); |
| 47 eventSender.mouseDown(); |
| 48 eventSender.mouseUp(); |
35 }); | 49 }); |
36 | |
37 var exitButtonCenter = elementCenter(exitButton); | |
38 // Hover on and click the "Exit fullscreen" button | |
39 eventSender.mouseMoveTo(exitButtonCenter.x, exitButtonCenter.y); | |
40 eventSender.mouseDown(); | |
41 eventSender.mouseUp(); | |
42 }); | 50 }); |
43 | 51 |
44 | 52 |
45 // Move mouse over to the "Go fullscreen" button and click | 53 // Move mouse over to the "Go fullscreen" button and click |
46 eventSender.mouseMoveTo(enterButtonCenter.x, enterButtonCenter.y); | 54 eventSender.mouseMoveTo(enterButtonCenter.x, enterButtonCenter.y); |
47 eventSender.mouseDown(); | 55 eventSender.mouseDown(); |
48 eventSender.mouseUp(); | 56 eventSender.mouseUp(); |
49 } | 57 } |
50 | 58 |
51 runTest(); | 59 runTest(); |
52 </script> | 60 </script> |
OLD | NEW |