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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 | 56 |
57 ~Waiter() override {} | 57 ~Waiter() override {} |
58 | 58 |
59 void Observe(int type, | 59 void Observe(int type, |
60 const content::NotificationSource& source, | 60 const content::NotificationSource& source, |
61 const content::NotificationDetails& details) override { | 61 const content::NotificationDetails& details) override { |
62 DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED || | 62 DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED || |
63 type == chrome::NOTIFICATION_FULLSCREEN_CHANGED); | 63 type == chrome::NOTIFICATION_FULLSCREEN_CHANGED); |
64 if (running_) | 64 if (running_) |
65 base::MessageLoop::current()->Quit(); | 65 base::MessageLoop::current()->QuitWhenIdle(); |
66 } | 66 } |
67 | 67 |
68 // Wait until the two conditions are met. | 68 // Wait until the two conditions are met. |
69 void Wait(bool locker_state, bool fullscreen) { | 69 void Wait(bool locker_state, bool fullscreen) { |
70 running_ = true; | 70 running_ = true; |
71 scoped_ptr<chromeos::test::ScreenLockerTester> | 71 scoped_ptr<chromeos::test::ScreenLockerTester> |
72 tester(chromeos::ScreenLocker::GetTester()); | 72 tester(chromeos::ScreenLocker::GetTester()); |
73 while (tester->IsLocked() != locker_state || | 73 while (tester->IsLocked() != locker_state || |
74 browser_->window()->IsFullscreen() != fullscreen) { | 74 browser_->window()->IsFullscreen() != fullscreen) { |
75 content::RunMessageLoop(); | 75 content::RunMessageLoop(); |
(...skipping 235 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 |