| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 registrar_.Add(this, | 51 registrar_.Add(this, |
| 52 chrome::NOTIFICATION_FULLSCREEN_CHANGED, | 52 chrome::NOTIFICATION_FULLSCREEN_CHANGED, |
| 53 content::NotificationService::AllSources()); | 53 content::NotificationService::AllSources()); |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual ~Waiter() { | 56 virtual ~Waiter() { |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void Observe(int type, | 59 virtual 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()->Quit(); |
| 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> |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 EXPECT_TRUE(tester->IsLocked()); | 112 EXPECT_TRUE(tester->IsLocked()); |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Verifies if LockScreenDismissed() was called once. | 115 // Verifies if LockScreenDismissed() was called once. |
| 116 bool VerifyLockScreenDismissed() { | 116 bool VerifyLockScreenDismissed() { |
| 117 return 1 == fake_session_manager_client_-> | 117 return 1 == fake_session_manager_client_-> |
| 118 notify_lock_screen_dismissed_call_count(); | 118 notify_lock_screen_dismissed_call_count(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 private: | 121 private: |
| 122 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 122 virtual void SetUpInProcessBrowserTestFixture() override { |
| 123 fake_session_manager_client_ = new FakeSessionManagerClient; | 123 fake_session_manager_client_ = new FakeSessionManagerClient; |
| 124 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( | 124 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
| 125 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); | 125 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); |
| 126 | 126 |
| 127 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 127 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
| 128 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 128 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
| 129 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 129 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
| 130 } | 130 } |
| 131 | 131 |
| 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 132 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 133 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 133 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
| 134 } | 134 } |
| 135 | 135 |
| 136 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 136 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(ScreenLockerTest); | 138 DISALLOW_COPY_AND_ASSIGN(ScreenLockerTest); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestBasic) { | 141 IN_PROC_BROWSER_TEST_F(ScreenLockerTest, TestBasic) { |
| 142 ScreenLocker::Show(); | 142 ScreenLocker::Show(); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 EXPECT_EQ("", tester->GetPassword()); | 295 EXPECT_EQ("", tester->GetPassword()); |
| 296 | 296 |
| 297 // Close the locker to match expectations. | 297 // Close the locker to match expectations. |
| 298 ScreenLocker::Hide(); | 298 ScreenLocker::Hide(); |
| 299 content::RunAllPendingInMessageLoop(); | 299 content::RunAllPendingInMessageLoop(); |
| 300 EXPECT_FALSE(tester->IsLocked()); | 300 EXPECT_FALSE(tester->IsLocked()); |
| 301 EXPECT_TRUE(VerifyLockScreenDismissed()); | 301 EXPECT_TRUE(VerifyLockScreenDismissed()); |
| 302 } | 302 } |
| 303 | 303 |
| 304 } // namespace chromeos | 304 } // namespace chromeos |
| OLD | NEW |