| 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 | 334 |
| 335 ::testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); | 335 ::testing::Mock::VerifyAndClearExpectations(mock_homedir_methods_); |
| 336 | 336 |
| 337 EXPECT_TRUE(registration_utility_stub_->register_was_called()); | 337 EXPECT_TRUE(registration_utility_stub_->register_was_called()); |
| 338 EXPECT_EQ(registration_utility_stub_->display_name(), | 338 EXPECT_EQ(registration_utility_stub_->display_name(), |
| 339 base::UTF8ToUTF16(expected_display_name)); | 339 base::UTF8ToUTF16(expected_display_name)); |
| 340 | 340 |
| 341 registration_utility_stub_->RunSuccessCallback("token"); | 341 registration_utility_stub_->RunSuccessCallback("token"); |
| 342 | 342 |
| 343 // Token writing moves control to BlockingPool and back. | 343 // Token writing moves control to BlockingPool and back. |
| 344 base::RunLoop().RunUntilIdle(); | 344 content::RunAllBlockingPoolTasksUntilIdle(); |
| 345 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | |
| 346 base::RunLoop().RunUntilIdle(); | |
| 347 | 345 |
| 348 JSExpect(StringPrintf("%s == 'created'", kCurrentPage)); | 346 JSExpect(StringPrintf("%s == 'created'", kCurrentPage)); |
| 349 JSEval("$('supervised-user-creation-gotit-button').click()"); | 347 JSEval("$('supervised-user-creation-gotit-button').click()"); |
| 350 } | 348 } |
| 351 | 349 |
| 352 void SupervisedUserTestBase::SigninAsSupervisedUser( | 350 void SupervisedUserTestBase::SigninAsSupervisedUser( |
| 353 bool check_homedir_calls, | 351 bool check_homedir_calls, |
| 354 int user_index, | 352 int user_index, |
| 355 const std::string& expected_display_name) { | 353 const std::string& expected_display_name) { |
| 356 if (check_homedir_calls) | 354 if (check_homedir_calls) |
| (...skipping 26 matching lines...) Expand all Loading... |
| 383 const user_manager::User* user = | 381 const user_manager::User* user = |
| 384 user_manager::UserManager::Get()->GetUsers().at(user_index); | 382 user_manager::UserManager::Get()->GetUsers().at(user_index); |
| 385 LoginUser(user->email()); | 383 LoginUser(user->email()); |
| 386 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); | 384 Profile* profile = ProfileHelper::Get()->GetProfileByUserUnsafe(user); |
| 387 shared_settings_adapter_.reset( | 385 shared_settings_adapter_.reset( |
| 388 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); | 386 new SupervisedUsersSharedSettingsSyncTestAdapter(profile)); |
| 389 supervised_users_adapter_.reset(new SupervisedUsersSyncTestAdapter(profile)); | 387 supervised_users_adapter_.reset(new SupervisedUsersSyncTestAdapter(profile)); |
| 390 } | 388 } |
| 391 | 389 |
| 392 void SupervisedUserTestBase::RemoveSupervisedUser( | 390 void SupervisedUserTestBase::RemoveSupervisedUser( |
| 393 unsigned long original_user_count, | 391 size_t original_user_count, |
| 394 int user_index, | 392 int user_index, |
| 395 const std::string& expected_display_name) { | 393 const std::string& expected_display_name) { |
| 396 // Remove supervised user. | 394 // Remove supervised user. |
| 397 ASSERT_EQ(original_user_count, | 395 ASSERT_EQ(original_user_count, |
| 398 user_manager::UserManager::Get()->GetUsers().size()); | 396 user_manager::UserManager::Get()->GetUsers().size()); |
| 399 | 397 |
| 400 // Created supervised user have to be first in a list. | 398 // Created supervised user have to be first in a list. |
| 401 const user_manager::User* user = | 399 const user_manager::User* user = |
| 402 user_manager::UserManager::Get()->GetUsers().at(user_index); | 400 user_manager::UserManager::Get()->GetUsers().at(user_index); |
| 403 ASSERT_EQ(base::UTF8ToUTF16(expected_display_name), user->display_name()); | 401 ASSERT_EQ(base::UTF8ToUTF16(expected_display_name), user->display_name()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 428 JSEval(StringPrintf( | 426 JSEval(StringPrintf( |
| 429 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", | 427 "$('pod-row').pods[%d].querySelector('.remove-warning-button').click()", |
| 430 user_index)); | 428 user_index)); |
| 431 | 429 |
| 432 // Make sure there is no supervised user in list. | 430 // Make sure there is no supervised user in list. |
| 433 ASSERT_EQ(original_user_count - 1, | 431 ASSERT_EQ(original_user_count - 1, |
| 434 user_manager::UserManager::Get()->GetUsers().size()); | 432 user_manager::UserManager::Get()->GetUsers().size()); |
| 435 } | 433 } |
| 436 | 434 |
| 437 } // namespace chromeos | 435 } // namespace chromeos |
| OLD | NEW |