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

Side by Side Diff: chrome/browser/chromeos/policy/cloud_external_data_manager_base_unittest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cloud_external_data_manager_base.h" 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void CloudExternalDataManagerBaseTest::SetUp() { 149 void CloudExternalDataManagerBaseTest::SetUp() {
150 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 150 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
151 resource_cache_.reset( 151 resource_cache_.reset(
152 new ResourceCache(temp_dir_.path(), message_loop_.task_runner())); 152 new ResourceCache(temp_dir_.path(), message_loop_.task_runner()));
153 SetUpExternalDataManager(); 153 SetUpExternalDataManager();
154 154
155 // Set |kStringPolicy| to a string value. 155 // Set |kStringPolicy| to a string value.
156 cloud_policy_store_.policy_map_.Set(kStringPolicy, 156 cloud_policy_store_.policy_map_.Set(kStringPolicy,
157 POLICY_LEVEL_MANDATORY, 157 POLICY_LEVEL_MANDATORY,
158 POLICY_SCOPE_USER, 158 POLICY_SCOPE_USER,
159 POLICY_SOURCE_CLOUD,
160 new base::StringValue(std::string()), 159 new base::StringValue(std::string()),
161 NULL); 160 NULL);
162 // Make |k10BytePolicy| reference 10 bytes of external data. 161 // Make |k10BytePolicy| reference 10 bytes of external data.
163 SetExternalDataReference( 162 SetExternalDataReference(
164 k10BytePolicy, 163 k10BytePolicy,
165 ConstructMetadata(k10BytePolicyURL, 164 ConstructMetadata(k10BytePolicyURL,
166 crypto::SHA256HashString(k10ByteData))); 165 crypto::SHA256HashString(k10ByteData)));
167 // Make |k20BytePolicy| reference 20 bytes of external data. 166 // Make |k20BytePolicy| reference 20 bytes of external data.
168 SetExternalDataReference( 167 SetExternalDataReference(
169 k20BytePolicy, 168 k20BytePolicy,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 return metadata.Pass(); 205 return metadata.Pass();
207 } 206 }
208 207
209 void CloudExternalDataManagerBaseTest::SetExternalDataReference( 208 void CloudExternalDataManagerBaseTest::SetExternalDataReference(
210 const std::string& policy, 209 const std::string& policy,
211 scoped_ptr<base::DictionaryValue> metadata) { 210 scoped_ptr<base::DictionaryValue> metadata) {
212 cloud_policy_store_.policy_map_.Set( 211 cloud_policy_store_.policy_map_.Set(
213 policy, 212 policy,
214 POLICY_LEVEL_MANDATORY, 213 POLICY_LEVEL_MANDATORY,
215 POLICY_SCOPE_USER, 214 POLICY_SCOPE_USER,
216 POLICY_SOURCE_CLOUD,
217 metadata.release(), 215 metadata.release(),
218 new ExternalDataFetcher( 216 new ExternalDataFetcher(
219 external_data_manager_->weak_factory_.GetWeakPtr(), policy)); 217 external_data_manager_->weak_factory_.GetWeakPtr(), policy));
220 } 218 }
221 219
222 ExternalDataFetcher::FetchCallback 220 ExternalDataFetcher::FetchCallback
223 CloudExternalDataManagerBaseTest::ConstructFetchCallback(int id) { 221 CloudExternalDataManagerBaseTest::ConstructFetchCallback(int id) {
224 return base::Bind(&CloudExternalDataManagerBaseTest::OnFetchDone, 222 return base::Bind(&CloudExternalDataManagerBaseTest::OnFetchDone,
225 base::Unretained(this), 223 base::Unretained(this),
226 id); 224 id);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 crypto::SHA256HashString(k10ByteData))); 759 crypto::SHA256HashString(k10ByteData)));
762 cloud_policy_store_.NotifyStoreLoaded(); 760 cloud_policy_store_.NotifyStoreLoaded();
763 base::RunLoop().RunUntilIdle(); 761 base::RunLoop().RunUntilIdle();
764 EXPECT_EQ(1u, callback_data_.size()); 762 EXPECT_EQ(1u, callback_data_.size());
765 ASSERT_TRUE(callback_data_[1]); 763 ASSERT_TRUE(callback_data_[1]);
766 EXPECT_EQ(k10ByteData, *callback_data_[1]); 764 EXPECT_EQ(k10ByteData, *callback_data_[1]);
767 ResetCallbackData(); 765 ResetCallbackData();
768 } 766 }
769 767
770 } // namespace policy 768 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698