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/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 virtual void SetUp() OVERRIDE { | 84 virtual void SetUp() OVERRIDE { |
85 // The initialization path that blocks on the initial policy fetch requires | 85 // The initialization path that blocks on the initial policy fetch requires |
86 // a signin Profile to use its URLRequestContext. | 86 // a signin Profile to use its URLRequestContext. |
87 profile_manager_.reset( | 87 profile_manager_.reset( |
88 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); | 88 new TestingProfileManager(TestingBrowserProcess::GetGlobal())); |
89 ASSERT_TRUE(profile_manager_->SetUp()); | 89 ASSERT_TRUE(profile_manager_->SetUp()); |
90 profile_ = profile_manager_->CreateTestingProfile( | 90 profile_ = profile_manager_->CreateTestingProfile( |
91 chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(), | 91 chrome::kInitialProfile, scoped_ptr<PrefServiceSyncable>(), |
92 UTF8ToUTF16("testing_profile"), 0, std::string()); | 92 UTF8ToUTF16("testing_profile"), 0, std::string()); |
93 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile); | 93 signin_profile_ = profile_manager_->CreateTestingProfile(kSigninProfile); |
94 signin_profile_->set_incognito(true); | 94 signin_profile_->ForceIncognito(true); |
95 // Usually the signin Profile and the main Profile are separate, but since | 95 // Usually the signin Profile and the main Profile are separate, but since |
96 // the signin Profile is an OTR Profile then for this test it suffices to | 96 // the signin Profile is an OTR Profile then for this test it suffices to |
97 // attach it to the main Profile. | 97 // attach it to the main Profile. |
98 profile_->SetOffTheRecordProfile(signin_profile_); | 98 profile_->SetOffTheRecordProfile(scoped_ptr<Profile>(signin_profile_)); |
99 signin_profile_->SetOriginalProfile(profile_); | 99 signin_profile_->SetOriginalProfile(profile_); |
100 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); | 100 ASSERT_EQ(signin_profile_, chromeos::ProfileHelper::GetSigninProfile()); |
101 | 101 |
102 chrome::RegisterLocalState(prefs_.registry()); | 102 chrome::RegisterLocalState(prefs_.registry()); |
103 | 103 |
104 // Set up a policy map for testing. | 104 // Set up a policy map for testing. |
105 policy_map_.Set("HomepageLocation", | 105 policy_map_.Set("HomepageLocation", |
106 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 106 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
107 base::Value::CreateStringValue("http://chromium.org"), | 107 base::Value::CreateStringValue("http://chromium.org"), |
108 NULL); | 108 NULL); |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 | 518 |
519 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 519 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
520 // It posts a delayed task with 0ms delay in this case, so spinning the loop | 520 // It posts a delayed task with 0ms delay in this case, so spinning the loop |
521 // issues the initial fetch. | 521 // issues the initial fetch. |
522 base::RunLoop loop; | 522 base::RunLoop loop; |
523 FetchPolicy( | 523 FetchPolicy( |
524 base::Bind(&base::RunLoop::RunUntilIdle, base::Unretained(&loop))); | 524 base::Bind(&base::RunLoop::RunUntilIdle, base::Unretained(&loop))); |
525 } | 525 } |
526 | 526 |
527 } // namespace policy | 527 } // namespace policy |
OLD | NEW |