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