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

Side by Side Diff: chrome/browser/chromeos/login/login_browsertest.cc

Issue 2752793003: Re-enable LoginGuestTest. (Closed)
Patch Set: Created 3 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 6
7 #include "ash/common/shelf/wm_shelf.h" 7 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/common/system/tray/system_tray.h" 8 #include "ash/common/system/tray/system_tray.h"
9 #include "ash/common/wm_window.h" 9 #include "ash/common/wm_window.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 UserContext user_context( 175 UserContext user_context(
176 AccountId::FromUserEmailGaiaId(kTestUser, kGaiaId)); 176 AccountId::FromUserEmailGaiaId(kTestUser, kGaiaId));
177 user_context.SetKey(Key(kPassword)); 177 user_context.SetKey(Key(kPassword));
178 SetExpectedCredentials(user_context); 178 SetExpectedCredentials(user_context);
179 } 179 }
180 }; 180 };
181 181
182 // Used to make sure that the system tray is visible and within the screen 182 // Used to make sure that the system tray is visible and within the screen
183 // bounds after login. 183 // bounds after login.
184 void TestSystemTrayIsVisible() { 184 void TestSystemTrayIsVisible(bool otr) {
185 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); 185 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray();
186 aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow(); 186 aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow();
187 ash::WmWindow* wm_primary_win = ash::WmWindow::Get(primary_win); 187 ash::WmWindow* wm_primary_win = ash::WmWindow::Get(primary_win);
188 ash::WmShelf* wm_shelf = ash::WmShelf::ForWindow(wm_primary_win); 188 ash::WmShelf* wm_shelf = ash::WmShelf::ForWindow(wm_primary_win);
189 SCOPED_TRACE(testing::Message() 189 SCOPED_TRACE(testing::Message()
190 << "ShelfVisibilityState=" << wm_shelf->GetVisibilityState() 190 << "ShelfVisibilityState=" << wm_shelf->GetVisibilityState()
191 << " ShelfAutoHideBehavior=" << wm_shelf->auto_hide_behavior()); 191 << " ShelfAutoHideBehavior=" << wm_shelf->auto_hide_behavior());
192 EXPECT_TRUE(tray->visible()); 192 EXPECT_TRUE(tray->visible());
193 EXPECT_TRUE(RectContains(primary_win->bounds(), tray->GetBoundsInScreen())); 193
194 // This check flakes for LoginGuestTest: https://crbug.com/693106.
195 if (!otr)
196 EXPECT_TRUE(RectContains(primary_win->bounds(), tray->GetBoundsInScreen()));
194 } 197 }
195 198
196 } // namespace 199 } // namespace
197 200
198 // After a chrome crash, the session manager will restart chrome with 201 // After a chrome crash, the session manager will restart chrome with
199 // the -login-user flag indicating that the user is already logged in. 202 // the -login-user flag indicating that the user is already logged in.
200 // This profile should NOT be an OTR profile. 203 // This profile should NOT be an OTR profile.
201 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { 204 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) {
202 Profile* profile = browser()->profile(); 205 Profile* profile = browser()->profile();
203 std::string profile_base_path("hash"); 206 std::string profile_base_path("hash");
204 profile_base_path.insert(0, chrome::kProfileDirPrefix); 207 profile_base_path.insert(0, chrome::kProfileDirPrefix);
205 EXPECT_EQ(profile_base_path, profile->GetPath().BaseName().value()); 208 EXPECT_EQ(profile_base_path, profile->GetPath().BaseName().value());
206 EXPECT_FALSE(profile->IsOffTheRecord()); 209 EXPECT_FALSE(profile->IsOffTheRecord());
207 210
208 TestSystemTrayIsVisible(); 211 TestSystemTrayIsVisible(false);
209 } 212 }
210 213
211 // Verifies the cursor is not hidden at startup when user is logged in. 214 // Verifies the cursor is not hidden at startup when user is logged in.
212 IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) { 215 IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) {
213 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 216 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
214 217
215 TestSystemTrayIsVisible(); 218 TestSystemTrayIsVisible(false);
216 } 219 }
217 220
218 // After a guest login, we should get the OTR default profile. 221 // After a guest login, we should get the OTR default profile.
219 // Test is flaky https://crbug.com/693106 222 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) {
220 IN_PROC_BROWSER_TEST_F(LoginGuestTest, DISABLED_GuestIsOTR) {
221 Profile* profile = browser()->profile(); 223 Profile* profile = browser()->profile();
222 EXPECT_TRUE(profile->IsOffTheRecord()); 224 EXPECT_TRUE(profile->IsOffTheRecord());
223 // Ensure there's extension service for this profile. 225 // Ensure there's extension service for this profile.
224 EXPECT_TRUE(extensions::ExtensionSystem::Get(profile)->extension_service()); 226 EXPECT_TRUE(extensions::ExtensionSystem::Get(profile)->extension_service());
225 227
226 TestSystemTrayIsVisible(); 228 TestSystemTrayIsVisible(true);
227 } 229 }
228 230
229 // Verifies the cursor is not hidden at startup when running guest session. 231 // Verifies the cursor is not hidden at startup when running guest session.
230 // Test is flaky https://crbug.com/693106 232 IN_PROC_BROWSER_TEST_F(LoginGuestTest, CursorShown) {
231 IN_PROC_BROWSER_TEST_F(LoginGuestTest, DISABLED_CursorShown) {
232 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 233 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
233 234
234 TestSystemTrayIsVisible(); 235 TestSystemTrayIsVisible(true);
235 } 236 }
236 237
237 // Verifies the cursor is hidden at startup on login screen. 238 // Verifies the cursor is hidden at startup on login screen.
238 IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) { 239 IN_PROC_BROWSER_TEST_F(LoginCursorTest, CursorHidden) {
239 // Login screen needs to be shown explicitly when running test. 240 // Login screen needs to be shown explicitly when running test.
240 ShowLoginWizard(OobeScreen::SCREEN_SPECIAL_LOGIN); 241 ShowLoginWizard(OobeScreen::SCREEN_SPECIAL_LOGIN);
241 242
242 // Cursor should be hidden at startup 243 // Cursor should be hidden at startup
243 EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 244 EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
244 245
245 // Cursor should be shown after cursor is moved. 246 // Cursor should be shown after cursor is moved.
246 EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point())); 247 EXPECT_TRUE(ui_test_utils::SendMouseMoveSync(gfx::Point()));
247 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); 248 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
248 249
249 base::ThreadTaskRunnerHandle::Get()->DeleteSoon( 250 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
250 FROM_HERE, LoginDisplayHost::default_host()); 251 FROM_HERE, LoginDisplayHost::default_host());
251 252
252 TestSystemTrayIsVisible(); 253 TestSystemTrayIsVisible(false);
253 } 254 }
254 255
255 // Verifies that the webui for login comes up successfully. 256 // Verifies that the webui for login comes up successfully.
256 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { 257 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) {
257 content::WindowedNotificationObserver( 258 content::WindowedNotificationObserver(
258 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, 259 chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE,
259 content::NotificationService::AllSources()) 260 content::NotificationService::AllSources())
260 .Wait(); 261 .Wait();
261 } 262 }
262 263
263 264
264 IN_PROC_BROWSER_TEST_F(LoginTest, PRE_GaiaAuthOffline) { 265 IN_PROC_BROWSER_TEST_F(LoginTest, PRE_GaiaAuthOffline) {
265 RegisterUser(kTestUser); 266 RegisterUser(kTestUser);
266 StartupUtils::MarkOobeCompleted(); 267 StartupUtils::MarkOobeCompleted();
267 CrosSettings::Get()->SetBoolean(kAccountsPrefShowUserNamesOnSignIn, false); 268 CrosSettings::Get()->SetBoolean(kAccountsPrefShowUserNamesOnSignIn, false);
268 } 269 }
269 270
270 // Flaky, see http://crbug/692364. 271 // Flaky, see http://crbug/692364.
271 IN_PROC_BROWSER_TEST_F(LoginTest, DISABLED_GaiaAuthOffline) { 272 IN_PROC_BROWSER_TEST_F(LoginTest, DISABLED_GaiaAuthOffline) {
272 PrepareOfflineLogin(); 273 PrepareOfflineLogin();
273 content::WindowedNotificationObserver session_start_waiter( 274 content::WindowedNotificationObserver session_start_waiter(
274 chrome::NOTIFICATION_SESSION_STARTED, 275 chrome::NOTIFICATION_SESSION_STARTED,
275 content::NotificationService::AllSources()); 276 content::NotificationService::AllSources());
276 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); 277 SubmitGaiaAuthOfflineForm(kTestUser, kPassword);
277 session_start_waiter.Wait(); 278 session_start_waiter.Wait();
278 279
279 TestSystemTrayIsVisible(); 280 TestSystemTrayIsVisible(false);
280 } 281 }
281 282
282 } // namespace chromeos 283 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698