OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
9 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 9 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
10 #include "chrome/browser/chromeos/login/mock_authenticator.h" | 10 #include "chrome/browser/chromeos/login/mock_authenticator.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 content::NotificationService::AllSources()); | 98 content::NotificationService::AllSources()); |
99 if (!tester->IsLocked()) | 99 if (!tester->IsLocked()) |
100 lock_state_observer.Wait(); | 100 lock_state_observer.Wait(); |
101 EXPECT_TRUE(tester->IsLocked()); | 101 EXPECT_TRUE(tester->IsLocked()); |
102 } | 102 } |
103 | 103 |
104 private: | 104 private: |
105 virtual void SetUpInProcessBrowserTestFixture() { | 105 virtual void SetUpInProcessBrowserTestFixture() { |
106 MockDBusThreadManager* mock_dbus_thread_manager = | 106 MockDBusThreadManager* mock_dbus_thread_manager = |
107 new MockDBusThreadManager; | 107 new MockDBusThreadManager; |
| 108 EXPECT_CALL(*mock_dbus_thread_manager, GetSystemBus()) |
| 109 .WillRepeatedly(testing::Return(reinterpret_cast<dbus::Bus*>(NULL))); |
108 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); | 110 DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
109 CrosInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 111 CrosInProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
110 mock_power_manager_client_ = static_cast<MockPowerManagerClient*>( | 112 mock_power_manager_client_ = static_cast<MockPowerManagerClient*>( |
111 DBusThreadManager::Get()->GetPowerManagerClient()); | 113 DBusThreadManager::Get()->GetPowerManagerClient()); |
112 cros_mock_->InitStatusAreaMocks(); | 114 cros_mock_->InitStatusAreaMocks(); |
113 EXPECT_CALL(*mock_power_manager_client_, AddObserver(testing::_)) | 115 EXPECT_CALL(*mock_power_manager_client_, AddObserver(testing::_)) |
114 .Times(1) | 116 .Times(1) |
115 .RetiresOnSaturation(); | 117 .RetiresOnSaturation(); |
116 EXPECT_CALL(*mock_power_manager_client_, NotifyScreenUnlockCompleted()) | 118 EXPECT_CALL(*mock_power_manager_client_, NotifyScreenUnlockCompleted()) |
117 .Times(1) | 119 .Times(1) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 content::RunAllPendingInMessageLoop(); | 247 content::RunAllPendingInMessageLoop(); |
246 EXPECT_EQ("", tester->GetPassword()); | 248 EXPECT_EQ("", tester->GetPassword()); |
247 | 249 |
248 // Close the locker to match expectations. | 250 // Close the locker to match expectations. |
249 ScreenLocker::Hide(); | 251 ScreenLocker::Hide(); |
250 content::RunAllPendingInMessageLoop(); | 252 content::RunAllPendingInMessageLoop(); |
251 EXPECT_FALSE(tester->IsLocked()); | 253 EXPECT_FALSE(tester->IsLocked()); |
252 } | 254 } |
253 | 255 |
254 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |