OLD | NEW |
---|---|
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test video control element visibility when play by touch.</title> |
3 <style> | 3 <script src="../resources/testharness.js"></script> |
4 #no-video-media { | 4 <script src="../resources/testharnessreport.js"></script> |
5 width: 320px; | 5 <script src="media-file.js"></script> |
6 height: 240px; | 6 <script src="media-controls.js"></script> |
7 } | 7 <video controls></video> |
fs
2016/06/29 21:15:01
I think 'loop' was here for the same reason as abo
Srirama
2016/06/30 09:34:27
Done.
| |
8 </style> | |
9 <!-- TODO(foolip): Convert test to testharness.js. crbug.com/588956 | |
10 (Please avoid writing new tests using video-test.js) --> | |
11 <script src=video-test.js></script> | |
12 <script src=media-file.js></script> | |
13 <script src=media-controls.js></script> | |
14 <script> | 8 <script> |
9 async_test(function(t) { | |
10 var video = document.querySelector("video"); | |
15 | 11 |
16 var controls; | 12 video.oncanplaythrough = t.step_func(function() { |
13 var controls = mediaControlsButton(video, "panel"); | |
17 | 14 |
18 function dispatchActivateEvent(target) { | 15 assert_true(video.paused); |
19 // Create a DOMActivate event and dispatch it | |
20 var event = document.createEvent('UIEvents'); | |
21 event.initUIEvent('DOMActivate', true, true, window, 1) | |
22 target.dispatchEvent(event); | |
23 } | |
24 | 16 |
17 // Click the play button. | |
18 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); | |
19 var clickX = playCoords[0]; | |
20 var clickY = playCoords[1]; | |
21 eventSender.gestureTap(clickX, clickY); | |
22 eventSender.gestureTapDown(clickX, clickY); | |
23 assert_false(video.paused); | |
25 | 24 |
26 function runTest() | 25 runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
27 { | 26 assert_equals(getComputedStyle(controls).opacity, "0"); |
28 video = document.getElementById("no-video-media"); | 27 }), video); |
29 controls = mediaControlsButton(video, "panel"); | 28 }); |
30 | 29 |
31 testExpected("video.paused", true); | 30 video.src = findMediaFile("video", "content/test"); |
32 if (!window.testRunner) | 31 }); |
33 return; | 32 </script> |
34 | |
35 // Click the play button. | |
36 var playCoords = mediaControlsButtonCoordinates(video, "play-button"); | |
37 var clickX = playCoords[0]; | |
38 var clickY = playCoords[1]; | |
39 eventSender.gestureTap(clickX, clickY); | |
40 eventSender.gestureTapDown(clickX, clickY); | |
41 dispatchActivateEvent(controls); | |
Srirama
2016/06/29 19:35:45
do we need this? the test passes even without this
fs
2016/06/29 21:15:01
Off hand I can't think of any reason for why it wo
Srirama
2016/06/30 09:34:27
I will keep it to be on safe side.
| |
42 | |
43 testExpected("video.paused", false); | |
44 | |
45 runAfterHideMediaControlsTimerFired(function() | |
46 { | |
47 testExpected("getComputedStyle(controls).opacity", 0); | |
48 | |
49 consoleWrite(""); | |
50 endTest(); | |
51 }, video); | |
52 } | |
53 </script> | |
54 <body> | |
55 <p>Test video control element visibility when play by touch.</p> | |
56 <p>This test only runs in DRT!</p> | |
57 | |
58 <video id="no-video-media" controls loop oncanplaythrough="runTest()"></vide o> | |
59 <script> | |
60 setSrcById("no-video-media", findMediaFile("video", "content/test")); | |
61 </script> | |
62 </body> | |
63 </html> | |
OLD | NEW |