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 "ash/session/session_state_delegate.h" | 5 #include "ash/session/session_state_delegate.h" |
6 #include "ash/shell.h" | 6 #include "ash/shell.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" | 9 #include "chrome/browser/chromeos/login/lock/screen_locker.h" |
10 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" | 10 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 44 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
45 LoginManagerTest::SetUpInProcessBrowserTestFixture(); | 45 LoginManagerTest::SetUpInProcessBrowserTestFixture(); |
46 UserAddingScreen::Get()->AddObserver(this); | 46 UserAddingScreen::Get()->AddObserver(this); |
47 } | 47 } |
48 | 48 |
49 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; } | 49 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; } |
50 | 50 |
51 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; } | 51 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; } |
52 | 52 |
53 void SetUserCanLock(User* user, bool can_lock) { | 53 void SetUserCanLock(user_manager::User* user, bool can_lock) { |
54 user->set_can_lock(can_lock); | 54 user->set_can_lock(can_lock); |
55 } | 55 } |
56 | 56 |
57 void CheckScreenIsVisible() { | 57 void CheckScreenIsVisible() { |
58 views::View* web_view = | 58 views::View* web_view = |
59 LoginDisplayHostImpl::default_host()->GetWebUILoginView()->child_at(0); | 59 LoginDisplayHostImpl::default_host()->GetWebUILoginView()->child_at(0); |
60 for (views::View* current_view = web_view; | 60 for (views::View* current_view = web_view; |
61 current_view; | 61 current_view; |
62 current_view = current_view->parent()) { | 62 current_view = current_view->parent()) { |
63 EXPECT_TRUE(current_view->visible()); | 63 EXPECT_TRUE(current_view->visible()); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 | 185 |
186 // One of the users has the primary-only policy. | 186 // One of the users has the primary-only policy. |
187 // List of unlock users doesn't depend on kEnableLockScreen preference. | 187 // List of unlock users doesn't depend on kEnableLockScreen preference. |
188 prefs1->SetBoolean(prefs::kEnableAutoScreenLock, true); | 188 prefs1->SetBoolean(prefs::kEnableAutoScreenLock, true); |
189 prefs1->SetString(prefs::kMultiProfileUserBehavior, | 189 prefs1->SetString(prefs::kMultiProfileUserBehavior, |
190 MultiProfileUserController::kBehaviorPrimaryOnly); | 190 MultiProfileUserController::kBehaviorPrimaryOnly); |
191 prefs2->SetString(prefs::kMultiProfileUserBehavior, | 191 prefs2->SetString(prefs::kMultiProfileUserBehavior, |
192 MultiProfileUserController::kBehaviorUnrestricted); | 192 MultiProfileUserController::kBehaviorUnrestricted); |
193 prefs3->SetString(prefs::kMultiProfileUserBehavior, | 193 prefs3->SetString(prefs::kMultiProfileUserBehavior, |
194 MultiProfileUserController::kBehaviorUnrestricted); | 194 MultiProfileUserController::kBehaviorUnrestricted); |
195 chromeos::UserList unlock_users = user_manager->GetUnlockUsers(); | 195 user_manager::UserList unlock_users = user_manager->GetUnlockUsers(); |
196 ASSERT_EQ(1UL, unlock_users.size()); | 196 ASSERT_EQ(1UL, unlock_users.size()); |
197 EXPECT_EQ(kTestUsers[0], unlock_users[0]->email()); | 197 EXPECT_EQ(kTestUsers[0], unlock_users[0]->email()); |
198 | 198 |
199 prefs1->SetBoolean(prefs::kEnableAutoScreenLock, false); | 199 prefs1->SetBoolean(prefs::kEnableAutoScreenLock, false); |
200 unlock_users = user_manager->GetUnlockUsers(); | 200 unlock_users = user_manager->GetUnlockUsers(); |
201 ASSERT_EQ(1UL, unlock_users.size()); | 201 ASSERT_EQ(1UL, unlock_users.size()); |
202 EXPECT_EQ(kTestUsers[0], unlock_users[0]->email()); | 202 EXPECT_EQ(kTestUsers[0], unlock_users[0]->email()); |
203 | 203 |
204 // If all users have unrestricted policy then anyone can perform unlock. | 204 // If all users have unrestricted policy then anyone can perform unlock. |
205 prefs1->SetString(prefs::kMultiProfileUserBehavior, | 205 prefs1->SetString(prefs::kMultiProfileUserBehavior, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 content::NotificationService::AllSources()).Wait(); | 263 content::NotificationService::AllSources()).Wait(); |
264 | 264 |
265 UserAddingScreen::Get()->Start(); | 265 UserAddingScreen::Get()->Start(); |
266 content::RunAllPendingInMessageLoop(); | 266 content::RunAllPendingInMessageLoop(); |
267 CheckScreenIsVisible(); | 267 CheckScreenIsVisible(); |
268 UserAddingScreen::Get()->Cancel(); | 268 UserAddingScreen::Get()->Cancel(); |
269 content::RunAllPendingInMessageLoop(); | 269 content::RunAllPendingInMessageLoop(); |
270 } | 270 } |
271 | 271 |
272 } // namespace chromeos | 272 } // namespace chromeos |
OLD | NEW |