| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/chromeos/login/login_manager_test.h" | 9 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 10 #include "chrome/browser/chromeos/login/startup_utils.h" | 10 #include "chrome/browser/chromeos/login/startup_utils.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 StartupUtils::MarkOobeCompleted(); | 264 StartupUtils::MarkOobeCompleted(); |
| 265 } | 265 } |
| 266 | 266 |
| 267 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, SharedOptions) { | 267 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, SharedOptions) { |
| 268 // Log in the owner first, then add a secondary user. | 268 // Log in the owner first, then add a secondary user. |
| 269 LoginUser(kTestOwner); | 269 LoginUser(kTestOwner); |
| 270 UserAddingScreen::Get()->Start(); | 270 UserAddingScreen::Get()->Start(); |
| 271 content::RunAllPendingInMessageLoop(); | 271 content::RunAllPendingInMessageLoop(); |
| 272 AddUser(kTestNonOwner); | 272 AddUser(kTestNonOwner); |
| 273 | 273 |
| 274 UserManager* manager = UserManager::Get(); | 274 UserManager* manager = GetUserManager(); |
| 275 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); | 275 ASSERT_EQ(2u, manager->GetLoggedInUsers().size()); |
| 276 { | 276 { |
| 277 SCOPED_TRACE("Checking settings for owner, primary user."); | 277 SCOPED_TRACE("Checking settings for owner, primary user."); |
| 278 CheckOptionsUI(manager->FindUser(manager->GetOwnerEmail()), true, true); | 278 CheckOptionsUI(manager->FindUser(manager->GetOwnerEmail()), true, true); |
| 279 } | 279 } |
| 280 { | 280 { |
| 281 SCOPED_TRACE("Checking settings for non-owner, secondary user."); | 281 SCOPED_TRACE("Checking settings for non-owner, secondary user."); |
| 282 CheckOptionsUI(manager->FindUser(kTestNonOwner), false, false); | 282 CheckOptionsUI(manager->FindUser(kTestNonOwner), false, false); |
| 283 } | 283 } |
| 284 // TODO(michaelpg): Add tests for non-primary owner and primary non-owner | 284 // TODO(michaelpg): Add tests for non-primary owner and primary non-owner |
| (...skipping 10 matching lines...) Expand all Loading... |
| 295 // when the secondary user has enabled or disabled their preference. | 295 // when the secondary user has enabled or disabled their preference. |
| 296 // (The checkbox is unset if the current user's preference is false, but if any | 296 // (The checkbox is unset if the current user's preference is false, but if any |
| 297 // other signed-in user has enabled this preference, the shared setting | 297 // other signed-in user has enabled this preference, the shared setting |
| 298 // indicator explains this.) | 298 // indicator explains this.) |
| 299 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, ScreenLockPreferencePrimary) { | 299 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, ScreenLockPreferencePrimary) { |
| 300 LoginUser(kTestOwner); | 300 LoginUser(kTestOwner); |
| 301 UserAddingScreen::Get()->Start(); | 301 UserAddingScreen::Get()->Start(); |
| 302 content::RunAllPendingInMessageLoop(); | 302 content::RunAllPendingInMessageLoop(); |
| 303 AddUser(kTestNonOwner); | 303 AddUser(kTestNonOwner); |
| 304 | 304 |
| 305 UserManager* manager = UserManager::Get(); | 305 UserManager* manager = GetUserManager(); |
| 306 const User* user1 = manager->FindUser(kTestOwner); | 306 const User* user1 = manager->FindUser(kTestOwner); |
| 307 const User* user2 = manager->FindUser(kTestNonOwner); | 307 const User* user2 = manager->FindUser(kTestNonOwner); |
| 308 | 308 |
| 309 PrefService* prefs1 = | 309 PrefService* prefs1 = |
| 310 ProfileHelper::Get()->GetProfileByUser(user1)->GetPrefs(); | 310 ProfileHelper::Get()->GetProfileByUser(user1)->GetPrefs(); |
| 311 PrefService* prefs2 = | 311 PrefService* prefs2 = |
| 312 ProfileHelper::Get()->GetProfileByUser(user2)->GetPrefs(); | 312 ProfileHelper::Get()->GetProfileByUser(user2)->GetPrefs(); |
| 313 | 313 |
| 314 // Set both users' preference to false, then change the secondary user's to | 314 // Set both users' preference to false, then change the secondary user's to |
| 315 // true. We'll do the opposite in the next test. Doesn't provide 100% coverage | 315 // true. We'll do the opposite in the next test. Doesn't provide 100% coverage |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 // when the primary user has enabled or disabled their preference. | 366 // when the primary user has enabled or disabled their preference. |
| 367 // (The checkbox is unset if the current user's preference is false, but if any | 367 // (The checkbox is unset if the current user's preference is false, but if any |
| 368 // other signed-in user has enabled this preference, the shared setting | 368 // other signed-in user has enabled this preference, the shared setting |
| 369 // indicator explains this.) | 369 // indicator explains this.) |
| 370 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, ScreenLockPreferenceSecondary) { | 370 IN_PROC_BROWSER_TEST_F(SharedOptionsTest, ScreenLockPreferenceSecondary) { |
| 371 LoginUser(kTestOwner); | 371 LoginUser(kTestOwner); |
| 372 UserAddingScreen::Get()->Start(); | 372 UserAddingScreen::Get()->Start(); |
| 373 content::RunAllPendingInMessageLoop(); | 373 content::RunAllPendingInMessageLoop(); |
| 374 AddUser(kTestNonOwner); | 374 AddUser(kTestNonOwner); |
| 375 | 375 |
| 376 UserManager* manager = UserManager::Get(); | 376 UserManager* manager = GetUserManager(); |
| 377 const User* user1 = manager->FindUser(kTestOwner); | 377 const User* user1 = manager->FindUser(kTestOwner); |
| 378 const User* user2 = manager->FindUser(kTestNonOwner); | 378 const User* user2 = manager->FindUser(kTestNonOwner); |
| 379 | 379 |
| 380 PrefService* prefs1 = | 380 PrefService* prefs1 = |
| 381 ProfileHelper::Get()->GetProfileByUser(user1)->GetPrefs(); | 381 ProfileHelper::Get()->GetProfileByUser(user1)->GetPrefs(); |
| 382 PrefService* prefs2 = | 382 PrefService* prefs2 = |
| 383 ProfileHelper::Get()->GetProfileByUser(user2)->GetPrefs(); | 383 ProfileHelper::Get()->GetProfileByUser(user2)->GetPrefs(); |
| 384 | 384 |
| 385 // Set both users' preference to true, then change the secondary user's to | 385 // Set both users' preference to true, then change the secondary user's to |
| 386 // false. | 386 // false. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 content::WaitForLoadStop(contents); | 420 content::WaitForLoadStop(contents); |
| 421 { | 421 { |
| 422 SCOPED_TRACE("Screen lock false for both users"); | 422 SCOPED_TRACE("Screen lock false for both users"); |
| 423 expected_value = false; | 423 expected_value = false; |
| 424 CheckBooleanPreference(contents, prefs::kEnableAutoScreenLock, disabled, | 424 CheckBooleanPreference(contents, prefs::kEnableAutoScreenLock, disabled, |
| 425 empty_controlled, expected_value); | 425 empty_controlled, expected_value); |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 } // namespace chromeos | 429 } // namespace chromeos |
| OLD | NEW |