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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 } | 162 } |
163 | 163 |
164 void CreateManager(bool wait_for_fetch, int fetch_timeout) { | 164 void CreateManager(bool wait_for_fetch, int fetch_timeout) { |
165 store_ = new MockCloudPolicyStore(); | 165 store_ = new MockCloudPolicyStore(); |
166 external_data_manager_ = new MockCloudExternalDataManager; | 166 external_data_manager_ = new MockCloudExternalDataManager; |
167 external_data_manager_->SetPolicyStore(store_); | 167 external_data_manager_->SetPolicyStore(store_); |
168 EXPECT_CALL(*store_, Load()); | 168 EXPECT_CALL(*store_, Load()); |
169 manager_.reset(new UserCloudPolicyManagerChromeOS( | 169 manager_.reset(new UserCloudPolicyManagerChromeOS( |
170 scoped_ptr<CloudPolicyStore>(store_), | 170 scoped_ptr<CloudPolicyStore>(store_), |
171 scoped_ptr<CloudExternalDataManager>(external_data_manager_), | 171 scoped_ptr<CloudExternalDataManager>(external_data_manager_), |
172 base::FilePath(), | 172 base::FilePath(), wait_for_fetch, std::string(), |
173 wait_for_fetch, | 173 base::TimeDelta::FromSeconds(fetch_timeout), task_runner_, task_runner_, |
174 base::TimeDelta::FromSeconds(fetch_timeout), | |
175 task_runner_, | |
176 task_runner_, | |
177 task_runner_)); | 174 task_runner_)); |
178 manager_->Init(&schema_registry_); | 175 manager_->Init(&schema_registry_); |
179 manager_->AddObserver(&observer_); | 176 manager_->AddObserver(&observer_); |
180 manager_->Connect(&prefs_, &device_management_service_, NULL, | 177 manager_->Connect(&prefs_, &device_management_service_, NULL, |
181 USER_AFFILIATION_NONE); | 178 USER_AFFILIATION_NONE); |
182 Mock::VerifyAndClearExpectations(store_); | 179 Mock::VerifyAndClearExpectations(store_); |
183 EXPECT_FALSE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 180 EXPECT_FALSE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
184 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); | 181 EXPECT_FALSE(manager_->core()->service()->IsInitializationComplete()); |
185 | 182 |
186 if (!wait_for_fetch) { | 183 if (!wait_for_fetch) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 579 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
583 EXPECT_TRUE(manager_->core()->client()->is_registered()); | 580 EXPECT_TRUE(manager_->core()->client()->is_registered()); |
584 | 581 |
585 // The refresh scheduler takes care of the initial fetch for unmanaged users. | 582 // The refresh scheduler takes care of the initial fetch for unmanaged users. |
586 // Running the task runner issues the initial fetch. | 583 // Running the task runner issues the initial fetch. |
587 FetchPolicy( | 584 FetchPolicy( |
588 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); | 585 base::Bind(&base::TestSimpleTaskRunner::RunUntilIdle, task_runner_)); |
589 } | 586 } |
590 | 587 |
591 } // namespace policy | 588 } // namespace policy |
OLD | NEW |