| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 // The initialization path that blocks on the initial policy fetch requires | 86 // The initialization path that blocks on the initial policy fetch requires |
| 87 // a signin Profile to use its URLRequestContext. | 87 // a signin Profile to use its URLRequestContext. |
| 88 profile_manager_.reset( | 88 profile_manager_.reset( |
| 89 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 89 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
| 90 ASSERT_TRUE(profile_manager_->SetUp()); | 90 ASSERT_TRUE(profile_manager_->SetUp()); |
| 91 TestingProfile::TestingFactories factories; | 91 TestingProfile::TestingFactories factories; |
| 92 factories.push_back( | 92 factories.push_back( |
| 93 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), | 93 std::make_pair(ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 94 BuildFakeProfileOAuth2TokenService)); | 94 BuildFakeProfileOAuth2TokenService)); |
| 95 profile_ = profile_manager_->CreateTestingProfile( | 95 profile_ = profile_manager_->CreateTestingProfile( |
| 96 chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(), | 96 chrome::kInitialProfile, |
| 97 base::UTF8ToUTF16("testing_profile"), 0, std::string(), factories); | 97 scoped_ptr<PrefServiceSyncable>(), |
| 98 base::UTF8ToUTF16(""), |
| 99 0, |
| 100 std::string(), |
| 101 factories); |
| 98 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile); | 102 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile); |
| 99 signin_profile_->ForceIncognito(true); | 103 signin_profile_->ForceIncognito(true); |
| 100 // Usually the signin Profile and the main Profile are separate, but since | 104 // Usually the signin Profile and the main Profile are separate, but since |
| 101 // the signin Profile is an OTR Profile then for this test it suffices to | 105 // the signin Profile is an OTR Profile then for this test it suffices to |
| 102 // attach it to the main Profile. | 106 // attach it to the main Profile. |
| 103 profile_->SetOffTheRecordProfile(scoped_ptr<Profile>(signin_profile_)); | 107 profile_->SetOffTheRecordProfile(scoped_ptr<Profile>(signin_profile_)); |
| 104 signin_profile_->SetOriginalProfile(profile_); | 108 signin_profile_->SetOriginalProfile(profile_); |
| 105 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 109 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
| 106 | 110 |
| 107 chrome::RegisterLocalState(prefs_.registry()); | 111 chrome::RegisterLocalState(prefs_.registry()); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 579 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 583 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 580 | 584 |
| 581 // 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. |
| 582 // Running the task runner issues the initial fetch. | 586 // Running the task runner issues the initial fetch. |
| 583 FetchPolicy( | 587 FetchPolicy( |
| 584 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 585 } | 589 } |
| 586 | 590 |
| 587 } // namespace policy | 591 } // namespace policy |
| OLD | NEW |