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

Side by Side Diff: chrome/browser/policy/cloud/component_cloud_policy_service_unittest.cc

Issue 47513018: Make the internal storage of policy::Schemas ref counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-4-new-generate
Patch Set: rebase Created 7 years, 1 month 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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/policy/cloud/component_cloud_policy_service.h" 5 #include "chrome/browser/policy/cloud/component_cloud_policy_service.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 scoped_ptr<em::PolicyFetchResponse> CreateResponse() { 181 scoped_ptr<em::PolicyFetchResponse> CreateResponse() {
182 builder_.Build(); 182 builder_.Build();
183 return make_scoped_ptr(new em::PolicyFetchResponse(builder_.policy())); 183 return make_scoped_ptr(new em::PolicyFetchResponse(builder_.policy()));
184 } 184 }
185 185
186 std::string CreateSerializedResponse() { 186 std::string CreateSerializedResponse() {
187 builder_.Build(); 187 builder_.Build();
188 return builder_.GetBlob(); 188 return builder_.GetBlob();
189 } 189 }
190 190
191 scoped_ptr<SchemaOwner> CreateTestSchema() { 191 Schema CreateTestSchema() {
192 std::string error; 192 std::string error;
193 scoped_ptr<SchemaOwner> schema = SchemaOwner::Parse(kTestSchema, &error); 193 Schema schema = Schema::Parse(kTestSchema, &error);
194 EXPECT_TRUE(schema) << error; 194 EXPECT_TRUE(schema.valid()) << error;
195 return schema.Pass(); 195 return schema;
196 } 196 }
197 197
198 base::MessageLoop loop_; 198 base::MessageLoop loop_;
199 base::ScopedTempDir temp_dir_; 199 base::ScopedTempDir temp_dir_;
200 scoped_refptr<TestURLRequestContextGetter> request_context_; 200 scoped_refptr<TestURLRequestContextGetter> request_context_;
201 net::TestURLFetcherFactory fetcher_factory_; 201 net::TestURLFetcherFactory fetcher_factory_;
202 MockComponentCloudPolicyDelegate delegate_; 202 MockComponentCloudPolicyDelegate delegate_;
203 // |cache_| is owned by the |service_| and is invalid once the |service_| 203 // |cache_| is owned by the |service_| and is invalid once the |service_|
204 // is destroyed. 204 // is destroyed.
205 ResourceCache* cache_; 205 ResourceCache* cache_;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 Mock::VerifyAndClearExpectations(&delegate_); 510 Mock::VerifyAndClearExpectations(&delegate_);
511 511
512 // The policy is now being served. 512 // The policy is now being served.
513 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension); 513 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension);
514 PolicyBundle expected_bundle; 514 PolicyBundle expected_bundle;
515 expected_bundle.Get(ns).CopyFrom(expected_policy_); 515 expected_bundle.Get(ns).CopyFrom(expected_policy_);
516 EXPECT_TRUE(service_->policy().Equals(expected_bundle)); 516 EXPECT_TRUE(service_->policy().Equals(expected_bundle));
517 } 517 }
518 518
519 } // namespace policy 519 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/generate_policy_source_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698