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

Side by Side Diff: content/browser/screen_orientation/screen_orientation_browsertest.cc

Issue 444033002: Fix screen.orientation.lock() rejection and an integration test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/screen_orientation/screen_orientation_dispatcher_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/screen_orientation/screen_orientation_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698