OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>This tests that a mouse click event will not cause a media element to gai
n focus.</title> |
3 <head> | 3 <script src="../resources/testharness.js"></script> |
4 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | 4 <script src="../resources/testharnessreport.js"></script> |
5 (Please avoid writing new tests using video-test.js) --> | 5 <script src="media-controls.js"></script> |
6 <script src="video-test.js"></script> | 6 <video controls></video> |
7 <script> | 7 <script> |
8 var startTest = function() { | 8 test(function() { |
9 if (!window.eventSender) { | 9 var video = document.querySelector("video"); |
10 logResult(false, "This test requires window.eventSender."); | 10 var rect = video.getBoundingClientRect(); |
11 return; | 11 // Click on the center of the video element. |
12 } | 12 var x = rect.left + rect.width / 2; |
| 13 var y = rect.top + rect.height / 2; |
| 14 eventSender.mouseMoveTo(x, y); |
| 15 eventSender.mouseDown(); |
| 16 eventSender.mouseUp(); |
| 17 assert_not_equals(document.activeElement, video); |
13 | 18 |
14 findMediaElement(); | 19 // Click on the play button. |
15 var rect = video.getBoundingClientRect(); | 20 mediaControlsButton(video, "play-button").click(); |
16 consoleWrite("Click on the center of the video element."); | 21 assert_not_equals(document.activeElement, video); |
17 var x = rect.left + rect.width / 2; | 22 }); |
18 var y = rect.top + rect.height / 2; | 23 </script> |
19 eventSender.mouseMoveTo(x, y); | |
20 eventSender.mouseDown(); | |
21 eventSender.mouseUp(); | |
22 testExpected("document.activeElement.id", "video", "!="); | |
23 | |
24 consoleWrite("Click on the play button."); | |
25 eventSender.mouseMoveTo(rect.left + 20, rect.top + rect.height -
20); | |
26 eventSender.mouseDown(); | |
27 eventSender.mouseUp(); | |
28 testExpected("document.activeElement.id", "video", "!="); | |
29 | |
30 endTest(); | |
31 }; | |
32 </script> | |
33 </head> | |
34 <body onload="startTest();"> | |
35 <p>This tests that a mouse click event will not cause a media element to
gain focus.</p> | |
36 <video id="video" controls></video> | |
37 </body> | |
38 </html> | |
OLD | NEW |