OLD | NEW |
1 "use strict"; | 1 "use strict"; |
2 | 2 |
3 function fullscreen_test(controller, fullScreenEnabled) | 3 function fullscreen_test(controller) |
4 { | 4 { |
5 if (window.internals) | |
6 window.internals.settings.setFullScreenEnabled(fullScreenEnabled); | |
7 | |
8 async_test(function(t) | 5 async_test(function(t) |
9 { | 6 { |
10 var v1 = document.createElement("video"); | 7 var v1 = document.createElement("video"); |
11 var v2 = document.createElement("video"); | 8 var v2 = document.createElement("video"); |
12 v1.controls = v2.controls = true; | 9 v1.controls = v2.controls = true; |
13 v1.controller = v2.controller = controller; | 10 v1.controller = v2.controller = controller; |
14 v1.src = findMediaFile("video", "content/test"); | 11 v1.src = findMediaFile("video", "content/test"); |
15 v2.src = findMediaFile("audio", "content/test"); | 12 v2.src = findMediaFile("audio", "content/test"); |
16 document.body.appendChild(v1); | 13 document.body.appendChild(v1); |
17 document.body.appendChild(v2); | 14 document.body.appendChild(v2); |
18 | 15 |
19 // load event fires when both video elements are ready | 16 // load event fires when both video elements are ready |
20 window.addEventListener("load", t.step_func(function() | 17 window.addEventListener("load", t.step_func(function() |
21 { | 18 { |
22 function assert_button_hidden(elm) | 19 function assert_button_hidden(elm) |
23 { | 20 { |
24 assert_array_equals(mediaControlsButtonDimensions(elm, "fullscre
en-button"), [0, 0]); | 21 assert_array_equals(mediaControlsButtonDimensions(elm, "fullscre
en-button"), [0, 0]); |
25 } | 22 } |
26 | 23 |
27 // no fullscreen button for a video element with no video track | 24 // no fullscreen button for a video element with no video track |
28 assert_button_hidden(v2); | 25 assert_button_hidden(v2); |
29 | 26 |
30 if (fullScreenEnabled) { | 27 // click the fullscreen button |
31 // click the fullscreen button | 28 var coords = mediaControlsButtonCoordinates(v1, "fullscreen-button")
; |
32 var coords = mediaControlsButtonCoordinates(v1, "fullscreen-butt
on"); | 29 eventSender.mouseMoveTo(coords[0], coords[1]); |
33 eventSender.mouseMoveTo(coords[0], coords[1]); | 30 eventSender.mouseDown(); |
34 eventSender.mouseDown(); | 31 eventSender.mouseUp(); |
35 eventSender.mouseUp(); | 32 // wait for the fullscreenchange event |
36 // wait for the fullscreenchange event | |
37 } else { | |
38 // no fullscreen button when fullscreen is disabled | |
39 assert_button_hidden(v1); | |
40 t.done(); | |
41 } | |
42 })); | 33 })); |
43 | 34 |
44 v1.addEventListener("webkitfullscreenchange", t.step_func(function() | 35 v1.addEventListener("webkitfullscreenchange", t.step_func(function() |
45 { | 36 { |
46 t.done(); | 37 t.done(); |
47 })); | 38 })); |
48 | 39 |
49 v2.addEventListener("webkitfullscreenchange", t.step_func(function() | 40 v2.addEventListener("webkitfullscreenchange", t.step_func(function() |
50 { | 41 { |
51 assert_unreached(); | 42 assert_unreached(); |
52 })); | 43 })); |
53 }); | 44 }); |
54 } | 45 } |
OLD | NEW |