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 "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" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 if (!tester->IsLocked()) | 148 if (!tester->IsLocked()) |
149 lock_state_observer.Wait(); | 149 lock_state_observer.Wait(); |
150 | 150 |
151 // Test to make sure that the widget is actually appearing and is of | 151 // Test to make sure that the widget is actually appearing and is of |
152 // reasonable size, preventing a regression of | 152 // reasonable size, preventing a regression of |
153 // http://code.google.com/p/chromium-os/issues/detail?id=5987 | 153 // http://code.google.com/p/chromium-os/issues/detail?id=5987 |
154 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen(); | 154 gfx::Rect lock_bounds = tester->GetChildWidget()->GetWindowBoundsInScreen(); |
155 EXPECT_GT(lock_bounds.width(), 10); | 155 EXPECT_GT(lock_bounds.width(), 10); |
156 EXPECT_GT(lock_bounds.height(), 10); | 156 EXPECT_GT(lock_bounds.height(), 10); |
157 | 157 |
158 UserContext user_context(chromeos::login::kStubUser); | 158 UserContext user_context(login::StubAccountId()); |
159 user_context.SetKey(Key("pass")); | 159 user_context.SetKey(Key("pass")); |
160 tester->InjectStubUserContext(user_context); | 160 tester->InjectStubUserContext(user_context); |
161 EXPECT_TRUE(tester->IsLocked()); | 161 EXPECT_TRUE(tester->IsLocked()); |
162 tester->EnterPassword("fail"); | 162 tester->EnterPassword("fail"); |
163 content::RunAllPendingInMessageLoop(); | 163 content::RunAllPendingInMessageLoop(); |
164 EXPECT_TRUE(tester->IsLocked()); | 164 EXPECT_TRUE(tester->IsLocked()); |
165 tester->EnterPassword("pass"); | 165 tester->EnterPassword("pass"); |
166 content::RunAllPendingInMessageLoop(); | 166 content::RunAllPendingInMessageLoop(); |
167 // Successful authentication clears the lock screen and tells the | 167 // Successful authentication clears the lock screen and tells the |
168 // SessionManager to announce this over DBus. | 168 // SessionManager to announce this over DBus. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 } | 205 } |
206 { | 206 { |
207 Waiter waiter(browser()); | 207 Waiter waiter(browser()); |
208 ScreenLocker::Show(); | 208 ScreenLocker::Show(); |
209 tester->EmulateWindowManagerReady(); | 209 tester->EmulateWindowManagerReady(); |
210 waiter.Wait(true /* locked */, true /* full screen */); | 210 waiter.Wait(true /* locked */, true /* full screen */); |
211 EXPECT_TRUE(browser_window->IsFullscreen()); | 211 EXPECT_TRUE(browser_window->IsFullscreen()); |
212 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); | 212 EXPECT_FALSE(window_state->hide_shelf_when_fullscreen()); |
213 EXPECT_TRUE(tester->IsLocked()); | 213 EXPECT_TRUE(tester->IsLocked()); |
214 } | 214 } |
215 UserContext user_context(chromeos::login::kStubUser); | 215 UserContext user_context(login::StubAccountId()); |
216 user_context.SetKey(Key("pass")); | 216 user_context.SetKey(Key("pass")); |
217 tester->InjectStubUserContext(user_context); | 217 tester->InjectStubUserContext(user_context); |
218 tester->EnterPassword("pass"); | 218 tester->EnterPassword("pass"); |
219 content::RunAllPendingInMessageLoop(); | 219 content::RunAllPendingInMessageLoop(); |
220 EXPECT_FALSE(tester->IsLocked()); | 220 EXPECT_FALSE(tester->IsLocked()); |
221 { | 221 { |
222 Waiter waiter(browser()); | 222 Waiter waiter(browser()); |
223 browser() | 223 browser() |
224 ->exclusive_access_manager() | 224 ->exclusive_access_manager() |
225 ->fullscreen_controller() | 225 ->fullscreen_controller() |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 EXPECT_EQ("", tester->GetPassword()); | 311 EXPECT_EQ("", tester->GetPassword()); |
312 | 312 |
313 // Close the locker to match expectations. | 313 // Close the locker to match expectations. |
314 ScreenLocker::Hide(); | 314 ScreenLocker::Hide(); |
315 content::RunAllPendingInMessageLoop(); | 315 content::RunAllPendingInMessageLoop(); |
316 EXPECT_FALSE(tester->IsLocked()); | 316 EXPECT_FALSE(tester->IsLocked()); |
317 EXPECT_TRUE(VerifyLockScreenDismissed()); | 317 EXPECT_TRUE(VerifyLockScreenDismissed()); |
318 } | 318 } |
319 | 319 |
320 } // namespace chromeos | 320 } // namespace chromeos |
OLD | NEW |