OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/renderer_host/render_widget_host_impl.h" | 8 #include "content/browser/renderer_host/render_widget_host_impl.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/public/browser/render_widget_host.h" | 10 #include "content/public/browser/render_widget_host.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 #endif // defined(USE_AURA) || defined(OS_ANDROID) | 138 #endif // defined(USE_AURA) || defined(OS_ANDROID) |
139 | 139 |
140 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, WindowOrientationChange) { | 140 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, WindowOrientationChange) { |
141 GURL test_url = GetTestUrl("screen_orientation", | 141 GURL test_url = GetTestUrl("screen_orientation", |
142 "screen_orientation_windoworientationchange.html"); | 142 "screen_orientation_windoworientationchange.html"); |
143 | 143 |
144 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); | 144 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
145 shell()->LoadURL(test_url); | 145 shell()->LoadURL(test_url); |
146 navigation_observer.Wait(); | 146 navigation_observer.Wait(); |
| 147 #if USE_AURA |
| 148 WaitForResizeComplete(shell()->web_contents()); |
| 149 #endif // USE_AURA |
147 | 150 |
148 if (!WindowOrientationSupported()) | 151 if (!WindowOrientationSupported()) |
149 return; | 152 return; |
150 | 153 |
151 int angle = GetWindowOrientationAngle(); | 154 int angle = GetWindowOrientationAngle(); |
152 | 155 |
153 for (int i = 0; i < 4; ++i) { | 156 for (int i = 0; i < 4; ++i) { |
154 angle = (angle + 90) % 360; | 157 angle = (angle + 90) % 360; |
155 SendFakeScreenOrientation(angle, "portrait-primary"); | 158 SendFakeScreenOrientation(angle, "portrait-primary"); |
156 | 159 |
157 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); | 160 TestNavigationObserver navigation_observer(shell()->web_contents(), 1); |
158 navigation_observer.Wait(); | 161 navigation_observer.Wait(); |
159 EXPECT_EQ(angle == 270 ? -90 : angle, GetWindowOrientationAngle()); | 162 EXPECT_EQ(angle == 270 ? -90 : angle, GetWindowOrientationAngle()); |
160 } | 163 } |
161 } | 164 } |
162 | 165 |
| 166 // Chromium Android does not support fullscreen |
| 167 IN_PROC_BROWSER_TEST_F(ScreenOrientationBrowserTest, LockSmoke) { |
| 168 GURL test_url = GetTestUrl("screen_orientation", |
| 169 "screen_orientation_lock_smoke.html"); |
| 170 |
| 171 TestNavigationObserver navigation_observer(shell()->web_contents(), 2); |
| 172 shell()->LoadURL(test_url); |
| 173 navigation_observer.Wait(); |
| 174 #if USE_AURA |
| 175 WaitForResizeComplete(shell()->web_contents()); |
| 176 #endif // USE_AURA |
| 177 |
| 178 std::string expected = |
| 179 #if defined(OS_ANDROID) |
| 180 "SecurityError"; // WebContents need to be fullscreen. |
| 181 #else |
| 182 "NotSupportedError"; // Locking isn't supported. |
| 183 #endif |
| 184 |
| 185 EXPECT_EQ(expected, shell()->web_contents()->GetLastCommittedURL().ref()); |
| 186 } |
| 187 |
163 } // namespace content | 188 } // namespace content |
OLD | NEW |