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

Side by Side Diff: chrome/browser/chromeos/login/lock/screen_locker_browsertest.cc

Issue 745613002: [cros] Cleanup: remove LoginUtils (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: get rid of FakeChromeUserManager usage in ExistingUserController* tests Created 5 years, 10 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
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 "chrome/browser/chromeos/login/lock/screen_locker.h" 5 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
6 6
7 #include "ash/wm/window_state.h" 7 #include "ash/wm/window_state.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" 12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
13 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_window.h" 15 #include "chrome/browser/ui/browser_window.h"
16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" 17 #include "chrome/browser/ui/tabs/tab_strip_model.h"
18 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
19 #include "chrome/test/base/in_process_browser_test.h" 19 #include "chrome/test/base/in_process_browser_test.h"
20 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
21 #include "chromeos/dbus/dbus_thread_manager.h" 21 #include "chromeos/dbus/dbus_thread_manager.h"
22 #include "chromeos/dbus/fake_session_manager_client.h" 22 #include "chromeos/dbus/fake_session_manager_client.h"
23 #include "chromeos/login/auth/key.h" 23 #include "chromeos/login/auth/key.h"
24 #include "chromeos/login/auth/mock_authenticator.h" 24 #include "chromeos/login/auth/stub_authenticator.h"
25 #include "chromeos/login/auth/user_context.h" 25 #include "chromeos/login/auth/user_context.h"
26 #include "chromeos/login/user_names.h" 26 #include "chromeos/login/user_names.h"
27 #include "content/public/browser/notification_service.h" 27 #include "content/public/browser/notification_service.h"
28 #include "content/public/test/test_utils.h" 28 #include "content/public/test/test_utils.h"
29 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 #include "ui/base/test/ui_controls.h" 31 #include "ui/base/test/ui_controls.h"
32 #include "ui/compositor/layer_animator.h" 32 #include "ui/compositor/layer_animator.h"
33 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 33 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
34 #include "ui/views/widget/widget.h" 34 #include "ui/views/widget/widget.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Test to make sure that the widget is actually appearing and is of 150 // Test to make sure that the widget is actually appearing and is of
151 // reasonable size, preventing a regression of 151 // reasonable size, preventing a regression of
152 // http://code.google.com/p/chromium-os/issues/detail?id=5987 152 // http://code.google.com/p/chromium-os/issues/detail?id=5987
153 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen(); 153 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen();
154 EXPECT_GT(lock_bounds.width(), 10); 154 EXPECT_GT(lock_bounds.width(), 10);
155 EXPECT_GT(lock_bounds.height(), 10); 155 EXPECT_GT(lock_bounds.height(), 10);
156 156
157 UserContext user_context(chromeos::login::kStubUser); 157 UserContext user_context(chromeos::login::kStubUser);
158 user_context.SetKey(Key("pass")); 158 user_context.SetKey(Key("pass"));
159 tester->InjectMockAuthenticator(user_context); 159 tester->InjectStubUserContext(user_context);
160 EXPECT_TRUE(tester->IsLocked()); 160 EXPECT_TRUE(tester->IsLocked());
161 tester->EnterPassword("fail"); 161 tester->EnterPassword("fail");
162 content::RunAllPendingInMessageLoop(); 162 content::RunAllPendingInMessageLoop();
163 EXPECT_TRUE(tester->IsLocked()); 163 EXPECT_TRUE(tester->IsLocked());
164 tester->EnterPassword("pass"); 164 tester->EnterPassword("pass");
165 content::RunAllPendingInMessageLoop(); 165 content::RunAllPendingInMessageLoop();
166 // Successful authentication clears the lock screen and tells the 166 // Successful authentication clears the lock screen and tells the
167 // SessionManager to announce this over DBus. 167 // SessionManager to announce this over DBus.
168 EXPECT_FALSE(tester->IsLocked()); 168 EXPECT_FALSE(tester->IsLocked());
169 EXPECT_EQ( 169 EXPECT_EQ(
(...skipping 28 matching lines...) Expand all
198 Waiter waiter(browser()); 198 Waiter waiter(browser());
199 ScreenLocker::Show(); 199 ScreenLocker::Show();
200 tester->EmulateWindowManagerReady(); 200 tester->EmulateWindowManagerReady();
201 waiter.Wait(true /* locked */, true /* full screen */); 201 waiter.Wait(true /* locked */, true /* full screen */);
202 EXPECT_TRUE(browser_window->IsFullscreen()); 202 EXPECT_TRUE(browser_window->IsFullscreen());
203 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); 203 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen());
204 EXPECT_TRUE(tester->IsLocked()); 204 EXPECT_TRUE(tester->IsLocked());
205 } 205 }
206 UserContext user_context(chromeos::login::kStubUser); 206 UserContext user_context(chromeos::login::kStubUser);
207 user_context.SetKey(Key("pass")); 207 user_context.SetKey(Key("pass"));
208 tester->InjectMockAuthenticator(user_context); 208 tester->InjectStubUserContext(user_context);
209 tester->EnterPassword("pass"); 209 tester->EnterPassword("pass");
210 content::RunAllPendingInMessageLoop(); 210 content::RunAllPendingInMessageLoop();
211 EXPECT_FALSE(tester->IsLocked()); 211 EXPECT_FALSE(tester->IsLocked());
212 { 212 {
213 Waiter waiter(browser()); 213 Waiter waiter(browser());
214 browser() 214 browser()
215 ->exclusive_access_manager() 215 ->exclusive_access_manager()
216 ->fullscreen_controller() 216 ->fullscreen_controller()
217 ->ToggleBrowserFullscreenMode(); 217 ->ToggleBrowserFullscreenMode();
218 waiter.Wait(false /* not locked */, false /* fullscreen */); 218 waiter.Wait(false /* not locked */, false /* fullscreen */);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 EXPECT_EQ("", tester->GetPassword()); 302 EXPECT_EQ("", tester->GetPassword());
303 303
304 // Close the locker to match expectations. 304 // Close the locker to match expectations.
305 ScreenLocker::Hide(); 305 ScreenLocker::Hide();
306 content::RunAllPendingInMessageLoop(); 306 content::RunAllPendingInMessageLoop();
307 EXPECT_FALSE(tester->IsLocked()); 307 EXPECT_FALSE(tester->IsLocked());
308 EXPECT_TRUE(VerifyLockScreenDismissed()); 308 EXPECT_TRUE(VerifyLockScreenDismissed());
309 } 309 }
310 310
311 } // namespace chromeos 311 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/lock/screen_locker.cc ('k') | chrome/browser/chromeos/login/lock/screen_locker_tester.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698