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/policy/cloud/cloud_policy_manager.h" | 5 #include "chrome/browser/policy/cloud/cloud_policy_manager.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 void TestHarness::SetUp() {} | 71 void TestHarness::SetUp() {} |
72 | 72 |
73 ConfigurationPolicyProvider* TestHarness::CreateProvider( | 73 ConfigurationPolicyProvider* TestHarness::CreateProvider( |
74 SchemaRegistry* registry, | 74 SchemaRegistry* registry, |
75 scoped_refptr<base::SequencedTaskRunner> task_runner) { | 75 scoped_refptr<base::SequencedTaskRunner> task_runner) { |
76 // Create and initialize the store. | 76 // Create and initialize the store. |
77 store_.NotifyStoreLoaded(); | 77 store_.NotifyStoreLoaded(); |
78 ConfigurationPolicyProvider* provider = new CloudPolicyManager( | 78 ConfigurationPolicyProvider* provider = new CloudPolicyManager( |
79 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), | 79 PolicyNamespaceKey(dm_protocol::kChromeUserPolicyType, std::string()), |
80 &store_, | 80 &store_, |
| 81 task_runner, |
| 82 task_runner, |
81 task_runner); | 83 task_runner); |
82 Mock::VerifyAndClearExpectations(&store_); | 84 Mock::VerifyAndClearExpectations(&store_); |
83 return provider; | 85 return provider; |
84 } | 86 } |
85 | 87 |
86 void TestHarness::InstallEmptyPolicy() {} | 88 void TestHarness::InstallEmptyPolicy() {} |
87 | 89 |
88 void TestHarness::InstallStringPolicy(const std::string& policy_name, | 90 void TestHarness::InstallStringPolicy(const std::string& policy_name, |
89 const std::string& policy_value) { | 91 const std::string& policy_value) { |
90 store_.policy_map_.Set(policy_name, policy_level(), policy_scope(), | 92 store_.policy_map_.Set(policy_name, policy_level(), policy_scope(), |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 | 137 |
136 class TestCloudPolicyManager : public CloudPolicyManager { | 138 class TestCloudPolicyManager : public CloudPolicyManager { |
137 public: | 139 public: |
138 TestCloudPolicyManager( | 140 TestCloudPolicyManager( |
139 CloudPolicyStore* store, | 141 CloudPolicyStore* store, |
140 const scoped_refptr<base::SequencedTaskRunner>& task_runner) | 142 const scoped_refptr<base::SequencedTaskRunner>& task_runner) |
141 : CloudPolicyManager(PolicyNamespaceKey( | 143 : CloudPolicyManager(PolicyNamespaceKey( |
142 dm_protocol::kChromeUserPolicyType, | 144 dm_protocol::kChromeUserPolicyType, |
143 std::string()), | 145 std::string()), |
144 store, | 146 store, |
| 147 task_runner, |
| 148 task_runner, |
145 task_runner) {} | 149 task_runner) {} |
146 virtual ~TestCloudPolicyManager() {} | 150 virtual ~TestCloudPolicyManager() {} |
147 | 151 |
148 // Publish the protected members for testing. | 152 // Publish the protected members for testing. |
149 using CloudPolicyManager::client; | 153 using CloudPolicyManager::client; |
150 using CloudPolicyManager::store; | 154 using CloudPolicyManager::store; |
151 using CloudPolicyManager::service; | 155 using CloudPolicyManager::service; |
152 using CloudPolicyManager::CheckAndPublishPolicy; | 156 using CloudPolicyManager::CheckAndPublishPolicy; |
153 | 157 |
154 private: | 158 private: |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); | 345 store_.policy_.reset(new em::PolicyData(policy_.policy_data())); |
342 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); | 346 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); |
343 store_.NotifyStoreError(); | 347 store_.NotifyStoreError(); |
344 Mock::VerifyAndClearExpectations(&observer_); | 348 Mock::VerifyAndClearExpectations(&observer_); |
345 | 349 |
346 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); | 350 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); |
347 } | 351 } |
348 | 352 |
349 } // namespace | 353 } // namespace |
350 } // namespace policy | 354 } // namespace policy |
OLD | NEW |