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

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

Issue 2452983002: ChromeOS: This CL moves chromeos/login/user_names* to user_mananger. (Closed)
Patch Set: Removed unused #includes Created 4 years, 1 month 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 <memory> 7 #include <memory>
8 8
9 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
10 #include "ash/wm/window_state_aura.h" 10 #include "ash/wm/window_state_aura.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "chrome/browser/chrome_notification_types.h" 14 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" 15 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
16 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 16 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
17 #include "chrome/browser/profiles/profile_manager.h" 17 #include "chrome/browser/profiles/profile_manager.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 20 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
22 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
23 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
24 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
25 #include "chromeos/dbus/dbus_thread_manager.h" 25 #include "chromeos/dbus/dbus_thread_manager.h"
26 #include "chromeos/dbus/fake_session_manager_client.h" 26 #include "chromeos/dbus/fake_session_manager_client.h"
27 #include "chromeos/login/auth/key.h" 27 #include "chromeos/login/auth/key.h"
28 #include "chromeos/login/auth/stub_authenticator.h" 28 #include "chromeos/login/auth/stub_authenticator.h"
29 #include "chromeos/login/auth/user_context.h" 29 #include "chromeos/login/auth/user_context.h"
30 #include "chromeos/login/user_names.h" 30 #include "components/user_manager/user_names.h"
31 #include "content/public/browser/notification_service.h" 31 #include "content/public/browser/notification_service.h"
32 #include "content/public/test/test_utils.h" 32 #include "content/public/test/test_utils.h"
33 #include "testing/gmock/include/gmock/gmock.h" 33 #include "testing/gmock/include/gmock/gmock.h"
34 #include "testing/gtest/include/gtest/gtest.h" 34 #include "testing/gtest/include/gtest/gtest.h"
35 #include "ui/base/test/ui_controls.h" 35 #include "ui/base/test/ui_controls.h"
36 #include "ui/compositor/layer_animator.h" 36 #include "ui/compositor/layer_animator.h"
37 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 37 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
38 #include "ui/views/widget/widget.h" 38 #include "ui/views/widget/widget.h"
39 39
40 using testing::_; 40 using testing::_;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 if (!tester->IsLocked()) 151 if (!tester->IsLocked())
152 lock_state_observer.Wait(); 152 lock_state_observer.Wait();
153 153
154 // Test to make sure that the widget is actually appearing and is of 154 // Test to make sure that the widget is actually appearing and is of
155 // reasonable size, preventing a regression of 155 // reasonable size, preventing a regression of
156 // http://code.google.com/p/chromium-os/issues/detail?id=5987 156 // http://code.google.com/p/chromium-os/issues/detail?id=5987
157 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen(); 157 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen();
158 EXPECT_GT(lock_bounds.width(), 10); 158 EXPECT_GT(lock_bounds.width(), 10);
159 EXPECT_GT(lock_bounds.height(), 10); 159 EXPECT_GT(lock_bounds.height(), 10);
160 160
161 UserContext user_context(login::StubAccountId()); 161 UserContext user_context(user_manager::StubAccountId());
162 user_context.SetKey(Key("pass")); 162 user_context.SetKey(Key("pass"));
163 tester->InjectStubUserContext(user_context); 163 tester->InjectStubUserContext(user_context);
164 EXPECT_TRUE(tester->IsLocked()); 164 EXPECT_TRUE(tester->IsLocked());
165 tester->EnterPassword("fail"); 165 tester->EnterPassword("fail");
166 content::RunAllPendingInMessageLoop(); 166 content::RunAllPendingInMessageLoop();
167 EXPECT_TRUE(tester->IsLocked()); 167 EXPECT_TRUE(tester->IsLocked());
168 tester->EnterPassword("pass"); 168 tester->EnterPassword("pass");
169 content::RunAllPendingInMessageLoop(); 169 content::RunAllPendingInMessageLoop();
170 // Successful authentication clears the lock screen and tells the 170 // Successful authentication clears the lock screen and tells the
171 // SessionManager to announce this over DBus. 171 // SessionManager to announce this over DBus.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 } 208 }
209 { 209 {
210 Waiter waiter(browser()); 210 Waiter waiter(browser());
211 ScreenLocker::Show(); 211 ScreenLocker::Show();
212 tester->EmulateWindowManagerReady(); 212 tester->EmulateWindowManagerReady();
213 waiter.Wait(true /* locked */, true /* full screen */); 213 waiter.Wait(true /* locked */, true /* full screen */);
214 EXPECT_TRUE(browser_window->IsFullscreen()); 214 EXPECT_TRUE(browser_window->IsFullscreen());
215 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); 215 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen());
216 EXPECT_TRUE(tester->IsLocked()); 216 EXPECT_TRUE(tester->IsLocked());
217 } 217 }
218 UserContext user_context(login::StubAccountId()); 218 UserContext user_context(user_manager::StubAccountId());
219 user_context.SetKey(Key("pass")); 219 user_context.SetKey(Key("pass"));
220 tester->InjectStubUserContext(user_context); 220 tester->InjectStubUserContext(user_context);
221 tester->EnterPassword("pass"); 221 tester->EnterPassword("pass");
222 content::RunAllPendingInMessageLoop(); 222 content::RunAllPendingInMessageLoop();
223 EXPECT_FALSE(tester->IsLocked()); 223 EXPECT_FALSE(tester->IsLocked());
224 { 224 {
225 Waiter waiter(browser()); 225 Waiter waiter(browser());
226 browser() 226 browser()
227 ->exclusive_access_manager() 227 ->exclusive_access_manager()
228 ->fullscreen_controller() 228 ->fullscreen_controller()
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 EXPECT_EQ("", tester->GetPassword()); 314 EXPECT_EQ("", tester->GetPassword());
315 315
316 // Close the locker to match expectations. 316 // Close the locker to match expectations.
317 ScreenLocker::Hide(); 317 ScreenLocker::Hide();
318 content::RunAllPendingInMessageLoop(); 318 content::RunAllPendingInMessageLoop();
319 EXPECT_FALSE(tester->IsLocked()); 319 EXPECT_FALSE(tester->IsLocked());
320 EXPECT_TRUE(VerifyLockScreenDismissed()); 320 EXPECT_TRUE(VerifyLockScreenDismissed());
321 } 321 }
322 322
323 } // namespace chromeos 323 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698