| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |