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" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" | 12 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 13 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
15 #include "chrome/browser/ui/browser_window.h" | 15 #include "chrome/browser/ui/browser_window.h" |
16 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 16 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
17 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 17 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
21 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
22 #include "chromeos/dbus/fake_dbus_thread_manager.h" | 22 #include "chromeos/dbus/dbus_thread_manager.h" |
23 #include "chromeos/dbus/fake_session_manager_client.h" | 23 #include "chromeos/dbus/fake_session_manager_client.h" |
24 #include "chromeos/login/auth/key.h" | 24 #include "chromeos/login/auth/key.h" |
25 #include "chromeos/login/auth/mock_authenticator.h" | 25 #include "chromeos/login/auth/mock_authenticator.h" |
26 #include "chromeos/login/auth/user_context.h" | 26 #include "chromeos/login/auth/user_context.h" |
27 #include "chromeos/login/user_names.h" | 27 #include "chromeos/login/user_names.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "testing/gmock/include/gmock/gmock.h" | 29 #include "testing/gmock/include/gmock/gmock.h" |
30 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
31 #include "ui/base/test/ui_controls.h" | 31 #include "ui/base/test/ui_controls.h" |
32 #include "ui/compositor/layer_animator.h" | 32 #include "ui/compositor/layer_animator.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FakeDBusThreadManager* fake_dbus_thread_manager = new FakeDBusThreadManager; | |
124 fake_dbus_thread_manager->SetFakeClients(); | |
125 fake_session_manager_client_ = new FakeSessionManagerClient; | 123 fake_session_manager_client_ = new FakeSessionManagerClient; |
126 fake_dbus_thread_manager->SetSessionManagerClient( | 124 DBusThreadManager::GetSetterForTesting()->SetSessionManagerClient( |
127 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); | 125 scoped_ptr<SessionManagerClient>(fake_session_manager_client_)); |
128 DBusThreadManager::SetInstanceForTesting(fake_dbus_thread_manager); | |
129 | 126 |
130 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); | 127 InProcessBrowserTest::SetUpInProcessBrowserTestFixture(); |
131 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( | 128 zero_duration_mode_.reset(new ui::ScopedAnimationDurationScaleMode( |
132 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); | 129 ui::ScopedAnimationDurationScaleMode::ZERO_DURATION)); |
133 } | 130 } |
134 | 131 |
135 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 132 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
136 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); | 133 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
137 } | 134 } |
138 | 135 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EXPECT_EQ("", tester->GetPassword()); | 295 EXPECT_EQ("", tester->GetPassword()); |
299 | 296 |
300 // Close the locker to match expectations. | 297 // Close the locker to match expectations. |
301 ScreenLocker::Hide(); | 298 ScreenLocker::Hide(); |
302 content::RunAllPendingInMessageLoop(); | 299 content::RunAllPendingInMessageLoop(); |
303 EXPECT_FALSE(tester->IsLocked()); | 300 EXPECT_FALSE(tester->IsLocked()); |
304 EXPECT_TRUE(VerifyLockScreenDismissed()); | 301 EXPECT_TRUE(VerifyLockScreenDismissed()); |
305 } | 302 } |
306 | 303 |
307 } // namespace chromeos | 304 } // namespace chromeos |
OLD | NEW |