Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/policy/user_cloud_policy_manager_unittest.cc

Issue 10545033: Removed the PolicyDefinitionList from the ConfigurationPolicyProvider interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/policy/cloud_policy_service.h" 8 #include "chrome/browser/policy/cloud_policy_service.h"
9 #include "chrome/browser/policy/configuration_policy_provider_test.h" 9 #include "chrome/browser/policy/configuration_policy_provider_test.h"
10 #include "chrome/browser/policy/mock_cloud_policy_store.h" 10 #include "chrome/browser/policy/mock_cloud_policy_store.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 TestHarness::~TestHarness() {} 68 TestHarness::~TestHarness() {}
69 69
70 void TestHarness::SetUp() {} 70 void TestHarness::SetUp() {}
71 71
72 ConfigurationPolicyProvider* TestHarness::CreateProvider( 72 ConfigurationPolicyProvider* TestHarness::CreateProvider(
73 const PolicyDefinitionList* policy_definition_list) { 73 const PolicyDefinitionList* policy_definition_list) {
74 // Create and initialize the store. 74 // Create and initialize the store.
75 store_ = new MockCloudPolicyStore(); 75 store_ = new MockCloudPolicyStore();
76 store_->NotifyStoreLoaded(); 76 store_->NotifyStoreLoaded();
77 EXPECT_CALL(*store_, Load()); 77 EXPECT_CALL(*store_, Load());
78 return new UserCloudPolicyManager(policy_definition_list, 78 return new UserCloudPolicyManager(scoped_ptr<CloudPolicyStore>(store_).Pass(),
79 scoped_ptr<CloudPolicyStore>(store_).Pass(),
80 false); 79 false);
81 } 80 }
82 81
83 void TestHarness::InstallEmptyPolicy() {} 82 void TestHarness::InstallEmptyPolicy() {}
84 83
85 void TestHarness::InstallStringPolicy(const std::string& policy_name, 84 void TestHarness::InstallStringPolicy(const std::string& policy_name,
86 const std::string& policy_value) { 85 const std::string& policy_value) {
87 store_->policy_map_.Set(policy_name, policy_level(), policy_scope(), 86 store_->policy_map_.Set(policy_name, policy_level(), policy_scope(),
88 base::Value::CreateStringValue(policy_value)); 87 base::Value::CreateStringValue(policy_value));
89 } 88 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 policy_response->mutable_policy_data())); 151 policy_response->mutable_policy_data()));
153 152
154 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _)) 153 EXPECT_CALL(device_management_service_, StartJob(_, _, _, _, _, _, _))
155 .Times(AnyNumber()); 154 .Times(AnyNumber());
156 } 155 }
157 156
158 void CreateManager(bool wait_for_policy_fetch) { 157 void CreateManager(bool wait_for_policy_fetch) {
159 store_ = new MockCloudPolicyStore(); 158 store_ = new MockCloudPolicyStore();
160 EXPECT_CALL(*store_, Load()); 159 EXPECT_CALL(*store_, Load());
161 manager_.reset( 160 manager_.reset(
162 new UserCloudPolicyManager(policy::GetChromePolicyDefinitionList(), 161 new UserCloudPolicyManager(scoped_ptr<CloudPolicyStore>(store_).Pass(),
163 scoped_ptr<CloudPolicyStore>(store_).Pass(),
164 wait_for_policy_fetch)); 162 wait_for_policy_fetch));
165 registrar_.Init(manager_.get(), &observer_); 163 registrar_.Init(manager_.get(), &observer_);
166 } 164 }
167 165
168 void CreateManagerWithPendingFetch() { 166 void CreateManagerWithPendingFetch() {
169 CreateManager(true); 167 CreateManager(true);
170 manager_->Initialize(&prefs_, &device_management_service_, 168 manager_->Initialize(&prefs_, &device_management_service_,
171 USER_AFFILIATION_NONE); 169 USER_AFFILIATION_NONE);
172 EXPECT_FALSE(manager_->IsInitializationComplete()); 170 EXPECT_FALSE(manager_->IsInitializationComplete());
173 171
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 336
339 // Cancelling the initial fetch should flip the flag. 337 // Cancelling the initial fetch should flip the flag.
340 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); 338 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
341 manager_->CancelWaitForPolicyFetch(); 339 manager_->CancelWaitForPolicyFetch();
342 EXPECT_TRUE(manager_->IsInitializationComplete()); 340 EXPECT_TRUE(manager_->IsInitializationComplete());
343 Mock::VerifyAndClearExpectations(&observer_); 341 Mock::VerifyAndClearExpectations(&observer_);
344 } 342 }
345 343
346 } // namespace 344 } // namespace
347 } // namespace policy 345 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698