| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/user_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 EXPECT_FALSE(test_url_fetcher_factory_.GetFetcherByID(0)); | 541 EXPECT_FALSE(test_url_fetcher_factory_.GetFetcherByID(0)); |
| 542 | 542 |
| 543 // Set a fake refresh token at the OAuth2TokenService. | 543 // Set a fake refresh token at the OAuth2TokenService. |
| 544 FakeProfileOAuth2TokenService* token_service = | 544 FakeProfileOAuth2TokenService* token_service = |
| 545 static_cast<FakeProfileOAuth2TokenService*>( | 545 static_cast<FakeProfileOAuth2TokenService*>( |
| 546 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); | 546 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_)); |
| 547 ASSERT_TRUE(token_service); | 547 ASSERT_TRUE(token_service); |
| 548 SigninManagerBase* signin_manager = | 548 SigninManagerBase* signin_manager = |
| 549 SigninManagerFactory::GetForProfile(profile_); | 549 SigninManagerFactory::GetForProfile(profile_); |
| 550 ASSERT_TRUE(signin_manager); | 550 ASSERT_TRUE(signin_manager); |
| 551 const std::string& account_id = signin_manager->GetAuthenticatedAccountId(); | 551 std::string account_id = signin_manager->GetAuthenticatedAccountId(); |
| 552 EXPECT_FALSE(token_service->RefreshTokenIsAvailable(account_id)); | 552 EXPECT_FALSE(token_service->RefreshTokenIsAvailable(account_id)); |
| 553 token_service->UpdateCredentials(account_id, "refresh_token"); | 553 token_service->UpdateCredentials(account_id, "refresh_token"); |
| 554 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); | 554 EXPECT_TRUE(token_service->RefreshTokenIsAvailable(account_id)); |
| 555 | 555 |
| 556 // That should have notified the manager, which now issues the request for the | 556 // That should have notified the manager, which now issues the request for the |
| 557 // policy oauth token. | 557 // policy oauth token. |
| 558 MockDeviceManagementJob* register_request = IssueOAuthToken(true); | 558 MockDeviceManagementJob* register_request = IssueOAuthToken(true); |
| 559 ASSERT_TRUE(register_request); | 559 ASSERT_TRUE(register_request); |
| 560 register_request->SendResponse(DM_STATUS_SUCCESS, register_blob_); | 560 register_request->SendResponse(DM_STATUS_SUCCESS, register_blob_); |
| 561 | 561 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 583 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 583 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 584 | 584 |
| 585 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 585 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
| 586 // Running the task runner issues the initial fetch. | 586 // Running the task runner issues the initial fetch. |
| 587 FetchPolicy( | 587 FetchPolicy( |
| 588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace policy | 591 } // namespace policy |
| OLD | NEW |