| 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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 151 } |
| 152 | 152 |
| 153 void CreateManager(bool wait_for_fetch, int fetch_timeout) { | 153 void CreateManager(bool wait_for_fetch, int fetch_timeout) { |
| 154 store_ = new MockCloudPolicyStore(); | 154 store_ = new MockCloudPolicyStore(); |
| 155 external_data_manager_ = new MockCloudExternalDataManager; | 155 external_data_manager_ = new MockCloudExternalDataManager; |
| 156 external_data_manager_->SetPolicyStore(store_); | 156 external_data_manager_->SetPolicyStore(store_); |
| 157 EXPECT_CALL(*store_, Load()); | 157 EXPECT_CALL(*store_, Load()); |
| 158 manager_.reset(new UserCloudPolicyManagerChromeOS( | 158 manager_.reset(new UserCloudPolicyManagerChromeOS( |
| 159 scoped_ptr<CloudPolicyStore>(store_), | 159 scoped_ptr<CloudPolicyStore>(store_), |
| 160 scoped_ptr<CloudExternalDataManager>(external_data_manager_), | 160 scoped_ptr<CloudExternalDataManager>(external_data_manager_), |
| 161 task_runner_, | |
| 162 base::FilePath(), | 161 base::FilePath(), |
| 163 wait_for_fetch, | 162 wait_for_fetch, |
| 164 base::TimeDelta::FromSeconds(fetch_timeout))); | 163 base::TimeDelta::FromSeconds(fetch_timeout), |
| 164 task_runner_, |
| 165 task_runner_, |
| 166 task_runner_)); |
| 165 manager_->Init(&schema_registry_); | 167 manager_->Init(&schema_registry_); |
| 166 manager_->AddObserver(&observer_); | 168 manager_->AddObserver(&observer_); |
| 167 manager_->Connect(&prefs_, &device_management_service_, NULL, | 169 manager_->Connect(&prefs_, &device_management_service_, NULL, |
| 168 USER_AFFILIATION_NONE); | 170 USER_AFFILIATION_NONE); |
| 169 Mock::VerifyAndClearExpectations(store_); | 171 Mock::VerifyAndClearExpectations(store_); |
| 170 EXPECT_FALSE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 172 EXPECT_FALSE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 171 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); | 173 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); |
| 172 | 174 |
| 173 if (!wait_for_fetch) { | 175 if (!wait_for_fetch) { |
| 174 // Create the UserCloudPolicyTokenForwarder, which fetches the access | 176 // Create the UserCloudPolicyTokenForwarder, which fetches the access |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 566 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
| 565 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 567 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
| 566 | 568 |
| 567 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 569 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
| 568 // Running the task runner issues the initial fetch. | 570 // Running the task runner issues the initial fetch. |
| 569 FetchPolicy( | 571 FetchPolicy( |
| 570 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 572 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
| 571 } | 573 } |
| 572 | 574 |
| 573 } // namespace policy | 575 } // namespace policy |
| OLD | NEW |