| 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/supervised/supervised_user_test_base.h" | 5 #include "chrome/browser/chromeos/login/supervised/supervised_user_test_base.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 // Log in as supervised user, make sure that everything works. | 359 // Log in as supervised user, make sure that everything works. |
| 360 ASSERT_EQ(3UL, UserManager::Get()->GetUsers().size()); | 360 ASSERT_EQ(3UL, UserManager::Get()->GetUsers().size()); |
| 361 | 361 |
| 362 // Created supervised user have to be first in a list. | 362 // Created supervised user have to be first in a list. |
| 363 const user_manager::User* user = | 363 const user_manager::User* user = |
| 364 UserManager::Get()->GetUsers().at(user_index); | 364 UserManager::Get()->GetUsers().at(user_index); |
| 365 ASSERT_EQ(base::UTF8ToUTF16(expected_display_name), user->display_name()); | 365 ASSERT_EQ(base::UTF8ToUTF16(expected_display_name), user->display_name()); |
| 366 LoginUser(user->email()); | 366 LoginUser(user->email()); |
| 367 if (check_homedir_calls) | 367 if (check_homedir_calls) |
| 368 ::testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); | 368 ::testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); |
| 369 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); | 369 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 370 shared_settings_adapter_.reset( | 370 shared_settings_adapter_.reset( |
| 371 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); | 371 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); |
| 372 | 372 |
| 373 // Check ChromeOS preference is initialized. | 373 // Check ChromeOS preference is initialized. |
| 374 EXPECT_TRUE( | 374 EXPECT_TRUE( |
| 375 static_cast<ProfileImpl*>(profile)->chromeos_preferences_); | 375 static_cast<ProfileImpl*>(profile)->chromeos_preferences_); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void SupervisedUserTestBase::SigninAsManager(int user_index) { | 378 void SupervisedUserTestBase::SigninAsManager(int user_index) { |
| 379 // Log in as supervised user, make sure that everything works. | 379 // Log in as supervised user, make sure that everything works. |
| 380 ASSERT_EQ(3UL, UserManager::Get()->GetUsers().size()); | 380 ASSERT_EQ(3UL, UserManager::Get()->GetUsers().size()); |
| 381 | 381 |
| 382 // Created supervised user have to be first in a list. | 382 // Created supervised user have to be first in a list. |
| 383 const user_manager::User* user = | 383 const user_manager::User* user = |
| 384 UserManager::Get()->GetUsers().at(user_index); | 384 UserManager::Get()->GetUsers().at(user_index); |
| 385 LoginUser(user->email()); | 385 LoginUser(user->email()); |
| 386 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); | 386 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 387 shared_settings_adapter_.reset( | 387 shared_settings_adapter_.reset( |
| 388 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); | 388 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); |
| 389 supervised_users_adapter_.reset(new SupervisedUsersSyncTestAdapter(profile)); | 389 supervised_users_adapter_.reset(new SupervisedUsersSyncTestAdapter(profile)); |
| 390 } | 390 } |
| 391 | 391 |
| 392 void SupervisedUserTestBase::RemoveSupervisedUser( | 392 void SupervisedUserTestBase::RemoveSupervisedUser( |
| 393 unsigned long original_user_count, | 393 unsigned long original_user_count, |
| 394 int user_index, | 394 int user_index, |
| 395 const std::string& expected_display_name) { | 395 const std::string& expected_display_name) { |
| 396 // Remove supervised user. | 396 // Remove supervised user. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 426 // Confirm deletion. | 426 // Confirm deletion. |
| 427 JSEval(StringPrintf( | 427 JSEval(StringPrintf( |
| 428 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 428 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
| 429 user_index)); | 429 user_index)); |
| 430 | 430 |
| 431 // Make sure there is no supervised user in list. | 431 // Make sure there is no supervised user in list. |
| 432 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); | 432 ASSERT_EQ(original_user_count - 1, UserManager::Get()->GetUsers().size()); |
| 433 } | 433 } |
| 434 | 434 |
| 435 } // namespace chromeos | 435 } // namespace chromeos |
| OLD | NEW |