Chromium Code Reviews| Index: LayoutTests/screen_orientation/orientationchange-event-subframe.html |
| diff --git a/LayoutTests/screen_orientation/orientationchange-event-subframe.html b/LayoutTests/screen_orientation/orientationchange-event-subframe.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8a15e04219f52baae3dbcad9d27e2dec45a70878 |
| --- /dev/null |
| +++ b/LayoutTests/screen_orientation/orientationchange-event-subframe.html |
| @@ -0,0 +1,46 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<body> |
| +<script src="../resources/testharness.js"></script> |
| +<script src="../resources/testharnessreport.js"></script> |
| + |
| +<iframe id="testIframe" sandbox="allow-scripts allow-same-origin" style="display:none"> |
| +</iframe> |
| + |
| +<script> |
| + var test = async_test("Test subframes receive 'orientationchange' events"); |
| + |
| + var orientations = [ |
| + 'portrait-primary', |
| + 'portrait-secondary', |
| + 'landscape-primary', |
| + 'landscape-secondary' |
| + ]; |
| + |
| + var currentIndex = orientations.indexOf(window.screen.orientation); |
| + var eventsReceived = 0; |
| + |
| + function getNextIndex() { |
| + return (currentIndex + 1) % orientations.length; |
|
jochen (gone - plz use gerrit)
2014/05/26 10:02:11
4space indent everywhere plz
Inactive
2014/05/27 14:22:15
Done.
|
| + } |
| + |
| + function changeOrientation() { |
| + window.testRunner.setMockScreenOrientation(orientations[getNextIndex()]); |
| + currentIndex = getNextIndex(); |
| + } |
| + |
| + window.onmessage = test.step_func(function (ev) { |
| + assert_equals(ev.data, orientations[currentIndex], "subframe receives 'orientationchange' event"); |
| + ++eventsReceived; |
| + if (eventsReceived < 4) |
| + changeOrientation() |
| + else |
| + test.done(); |
| + }); |
| + |
| + var testIframe = document.getElementById("testIframe"); |
| + testIframe.src = "resources/iframe-listen-orientation-change.html"; |
| + testIframe.onload = changeOrientation; |
| +</script> |
| +</body> |
| +</html> |