Chromium Code Reviews| Index: LayoutTests/media/video-controls-fullscreen.js |
| diff --git a/LayoutTests/media/video-controls-fullscreen.js b/LayoutTests/media/video-controls-fullscreen.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e9f696f248ae0178e84409e161192200191361dc |
| --- /dev/null |
| +++ b/LayoutTests/media/video-controls-fullscreen.js |
| @@ -0,0 +1,54 @@ |
| +"use strict"; |
| + |
| +function fullscreen_test(controller, fullScreenEnabled) |
| +{ |
| + if (window.internals) |
| + window.internals.settings.setFullScreenEnabled(fullScreenEnabled); |
| + |
| + async_test(function(t) |
| + { |
| + var v1 = document.createElement("video"); |
| + var v2 = document.createElement("video"); |
| + v1.controls = v2.controls = true; |
| + v1.controller = v2.controller = controller; |
| + v1.src = findMediaFile("video", "content/test"); |
| + v2.src = findMediaFile("audio", "content/test"); |
| + document.body.appendChild(v1); |
| + document.body.appendChild(v2); |
| + |
| + // load event fires when both video elements are ready |
| + window.addEventListener("load", t.step_func(function() |
| + { |
| + function assert_button_hidden(elm) |
| + { |
| + assert_array_equals(mediaControlsButtonDimensions(elm, "fullscreen-button"), [0, 0]); |
| + } |
| + |
| + if (fullScreenEnabled) { |
| + // click the fullscreen button |
| + var coords = mediaControlsButtonCoordinates(v1, "fullscreen-button"); |
| + eventSender.mouseMoveTo(coords[0], coords[1]); |
| + eventSender.mouseDown(); |
| + eventSender.mouseUp(); |
| + // wait for the fullscreenchange event |
| + } else { |
| + // no fullscreen button when fullscreen is disabled |
| + assert_button_hidden(v1); |
| + t.done(); |
|
acolwell GONE FROM CHROMIUM
2014/03/17 23:57:55
nit: early return here since the test is supposed
philipj_slow
2014/03/18 03:08:02
Ah, yes. testharness.js actually ignores anything
|
| + } |
| + |
| + // no fullscreen button for a video element with no video track |
| + assert_button_hidden(v2); |
| + })); |
| + |
| + v1.addEventListener("webkitfullscreenchange", t.step_func(function() |
|
acolwell GONE FROM CHROMIUM
2014/03/17 23:57:55
Why are we waiting for prefixed events?
philipj_slow
2014/03/18 03:08:02
The fullscreen API is still not unprefixed, so the
|
| + { |
| + t.done(); |
| + })); |
| + |
| + v2.addEventListener("webkitfullscreenchange", t.step_func(function() |
| + { |
| + assert_unreached(); |
| + })); |
| + }); |
| +} |