OLD | NEW |
1 <html> | 1 <!DOCTYPE html> |
2 <head> | 2 <title>Test controls with zooming.</title> |
3 <title>Test controls with zooming</title> | 3 <script src="../resources/testharness.js"></script> |
4 <style type="text/css" media="screen"> | 4 <script src="../resources/testharnessreport.js"></script> |
5 video { | 5 <script src="media-file.js"></script> |
6 margin: 50px; | 6 <script src="media-controls.js"></script> |
7 } | 7 <style> |
8 </style> | 8 video { |
9 <script src=media-file.js></script> | 9 margin: 50px; |
10 <script src=media-controls.js></script> | 10 } |
11 <script type="text/javascript" charset="utf-8"> | 11 </style> |
12 function runTest() | 12 <video controls></video> |
13 { | 13 <script> |
14 window.setTimeout(function() { | 14 async_test(function(t) { |
15 document.documentElement.style.zoom = '150%'; | 15 var video = document.querySelector("video"); |
16 video.addEventListener("playing", function() { | 16 assert_true(video.controls); |
17 testExpected("video.paused", false); | |
18 endTest(); | |
19 }); | |
20 | 17 |
21 if (window.eventSender) | 18 video.oncanplaythrough = t.step_func(function() { |
22 { | 19 setTimeout(function() { |
| 20 document.documentElement.style.zoom = "150%"; |
| 21 video.onplaying = t.step_func_done(function() { |
| 22 assert_false(video.paused); |
| 23 }); |
| 24 |
23 // Find the play button and click the middle of its bounding box. | 25 // Find the play button and click the middle of its bounding box. |
24 var playCoords; | 26 var playCoords = mediaControlsButtonCoordinates(video, "play-button"
); |
25 try { | |
26 playCoords = mediaControlsButtonCoordinates(video, "play-button"
); | |
27 } catch (exception) { | |
28 failTest(exception.description); | |
29 return; | |
30 } | |
31 var clickX = playCoords[0]; | |
32 var clickY = playCoords[1]; | |
33 | |
34 // Apply the page zoom value to the coordinates because | 27 // Apply the page zoom value to the coordinates because |
35 // getBoundingClientRect() used in | 28 // getBoundingClientRect() used in mediaControlsButtonCoordinates()
doesn't do it. |
36 // mediaControlsButtonCoordinates() doesn't do it. | 29 var clickX = playCoords[0] * 1.5; |
37 clickX = clickX * 1.5; | 30 var clickY = playCoords[1] * 1.5; |
38 clickY = clickY * 1.5; | |
39 | 31 |
40 eventSender.mouseMoveTo(clickX, clickY); | 32 eventSender.mouseMoveTo(clickX, clickY); |
41 eventSender.mouseDown(); | 33 eventSender.mouseDown(); |
42 eventSender.mouseUp(); | 34 eventSender.mouseUp(); |
43 } | 35 }, 50); |
44 }, 50); | 36 }); |
45 } | 37 |
46 </script> | 38 video.src = findMediaFile("video", "content/test"); |
47 </head> | 39 }); |
48 <body> | 40 </script> |
49 <video controls></video> | |
50 <p>Test controls on zoomed video.</p> | |
51 <p>This test only runs in DRT!</p> | |
52 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
53 (Please avoid writing new tests using video-test.js) --> | |
54 <script src=video-test.js></script> | |
55 <script> | |
56 testExpected("video.controls", null, '!='); | |
57 waitForEvent('canplaythrough', function() { | |
58 runTest(); | |
59 } ); | |
60 video.src = findMediaFile("video", "content/test"); | |
61 </script> | |
62 </body> | |
63 </html> | |
OLD | NEW |