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

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

Issue 1304843004: Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed another test. 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,
159 new base::StringValue(std::string()), 160 new base::StringValue(std::string()),
160 NULL); 161 NULL);
161 // Make |k10BytePolicy| reference 10 bytes of external data. 162 // Make |k10BytePolicy| reference 10 bytes of external data.
162 SetExternalDataReference( 163 SetExternalDataReference(
163 k10BytePolicy, 164 k10BytePolicy,
164 ConstructMetadata(k10BytePolicyURL, 165 ConstructMetadata(k10BytePolicyURL,
165 crypto::SHA256HashString(k10ByteData))); 166 crypto::SHA256HashString(k10ByteData)));
166 // Make |k20BytePolicy| reference 20 bytes of external data. 167 // Make |k20BytePolicy| reference 20 bytes of external data.
167 SetExternalDataReference( 168 SetExternalDataReference(
168 k20BytePolicy, 169 k20BytePolicy,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return metadata.Pass(); 206 return metadata.Pass();
206 } 207 }
207 208
208 void CloudExternalDataManagerBaseTest::SetExternalDataReference( 209 void CloudExternalDataManagerBaseTest::SetExternalDataReference(
209 const std::string& policy, 210 const std::string& policy,
210 scoped_ptr<base::DictionaryValue> metadata) { 211 scoped_ptr<base::DictionaryValue> metadata) {
211 cloud_policy_store_.policy_map_.Set( 212 cloud_policy_store_.policy_map_.Set(
212 policy, 213 policy,
213 POLICY_LEVEL_MANDATORY, 214 POLICY_LEVEL_MANDATORY,
214 POLICY_SCOPE_USER, 215 POLICY_SCOPE_USER,
216 POLICY_SOURCE_CLOUD,
215 metadata.release(), 217 metadata.release(),
216 new ExternalDataFetcher( 218 new ExternalDataFetcher(
217 external_data_manager_->weak_factory_.GetWeakPtr(), policy)); 219 external_data_manager_->weak_factory_.GetWeakPtr(), policy));
218 } 220 }
219 221
220 ExternalDataFetcher::FetchCallback 222 ExternalDataFetcher::FetchCallback
221 CloudExternalDataManagerBaseTest::ConstructFetchCallback(int id) { 223 CloudExternalDataManagerBaseTest::ConstructFetchCallback(int id) {
222 return base::Bind(&CloudExternalDataManagerBaseTest::OnFetchDone, 224 return base::Bind(&CloudExternalDataManagerBaseTest::OnFetchDone,
223 base::Unretained(this), 225 base::Unretained(this),
224 id); 226 id);
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 crypto::SHA256HashString(k10ByteData))); 761 crypto::SHA256HashString(k10ByteData)));
760 cloud_policy_store_.NotifyStoreLoaded(); 762 cloud_policy_store_.NotifyStoreLoaded();
761 base::RunLoop().RunUntilIdle(); 763 base::RunLoop().RunUntilIdle();
762 EXPECT_EQ(1u, callback_data_.size()); 764 EXPECT_EQ(1u, callback_data_.size());
763 ASSERT_TRUE(callback_data_[1]); 765 ASSERT_TRUE(callback_data_[1]);
764 EXPECT_EQ(k10ByteData, *callback_data_[1]); 766 EXPECT_EQ(k10ByteData, *callback_data_[1]);
765 ResetCallbackData(); 767 ResetCallbackData();
766 } 768 }
767 769
768 } // namespace policy 770 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698