Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: LayoutTests/screen_orientation/orientationchange-event-subframe.html

Issue 277413002: Make screen.orientation implementation use WebScreenInfo::orientationType (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add FIXME comment Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/screen_orientation/resources/iframe-listen-orientation-change.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..f64053f0c4c1ec2702d39b862c7f673abff03213
--- /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;
+ }
+
+ 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>
« no previous file with comments | « no previous file | LayoutTests/screen_orientation/resources/iframe-listen-orientation-change.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698