OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <title>Test that focus moves to "body" when controls fade out with a button focu
sed.</title> |
3 <title>Test focus movement when controls fade out with a button focused</title> | 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 <script src="media-file.js"></script> |
7 <script src=media-controls.js></script> | 7 <video controls></video> |
8 <p> | |
9 Test that focus moves to the <body>/document when controls fade out with a bu
tton focused. | |
10 </p> | |
11 <video controls src="content/test.ogv"></video> | |
12 <script> | 8 <script> |
13 var controls; | 9 async_test(function(t) { |
14 var video = document.querySelector("video"); | 10 var video = document.querySelector("video"); |
15 | 11 |
16 video.addEventListener("canplay", function() | 12 video.oncanplay = t.step_func(function() { |
17 { | 13 assert_equals(document.activeElement, document.body); |
18 testExpected("document.activeElement", document.body); | |
19 | 14 |
20 var playButton = mediaControlsButton(video, "play-button"); | 15 var playButton = mediaControlsButton(video, "play-button"); |
21 playButton.focus(); | 16 playButton.focus(); |
22 playButton.click(); | 17 playButton.click(); |
23 | 18 |
24 testExpected("document.activeElement", video); | 19 assert_equals(document.activeElement, video); |
25 | 20 |
26 runAfterHideMediaControlsTimerFired(function() | 21 runAfterHideMediaControlsTimerFired(t.step_func_done(function() { |
27 { | 22 var controls = mediaControlsButton(video, "panel"); |
28 controls = mediaControlsButton(video, "panel"); | 23 assert_equals(getComputedStyle(controls).opacity, "0"); |
29 testExpected("getComputedStyle(controls).opacity", 0); | 24 assert_equals(document.activeElement, document.body); |
| 25 }), video); |
| 26 }); |
30 | 27 |
31 testExpected("document.activeElement", document.body); | 28 video.src = findMediaFile("video", "content/test"); |
32 | |
33 consoleWrite(""); | |
34 endTest(); | |
35 }, video); | |
36 }); | 29 }); |
37 | 30 </script> |
38 </script> | |
OLD | NEW |