OLD | NEW |
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 "base/base64.h" | 5 #include "base/base64.h" |
6 #include "base/json/json_reader.h" | 6 #include "base/json/json_reader.h" |
7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
9 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" | 10 #include "components/policy/core/common/cloud/mock_cloud_policy_store.h" |
10 #include "components/policy/core/common/cloud/policy_header_io_helper.h" | 11 #include "components/policy/core/common/cloud/policy_header_io_helper.h" |
11 #include "components/policy/core/common/cloud/policy_header_service.h" | 12 #include "components/policy/core/common/cloud/policy_header_service.h" |
12 #include "net/http/http_request_headers.h" | 13 #include "net/http/http_request_headers.h" |
13 #include "net/url_request/url_request_test_util.h" | 14 #include "net/url_request/url_request_test_util.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
15 | 16 |
16 namespace policy { | 17 namespace policy { |
17 using enterprise_management::PolicyData; | 18 using enterprise_management::PolicyData; |
18 | 19 |
(...skipping 11 matching lines...) Expand all Loading... |
30 }; | 31 }; |
31 | 32 |
32 class PolicyHeaderServiceTest : public testing::Test { | 33 class PolicyHeaderServiceTest : public testing::Test { |
33 public: | 34 public: |
34 PolicyHeaderServiceTest() { | 35 PolicyHeaderServiceTest() { |
35 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner()); | 36 task_runner_ = make_scoped_refptr(new base::TestSimpleTaskRunner()); |
36 } | 37 } |
37 virtual ~PolicyHeaderServiceTest() {} | 38 virtual ~PolicyHeaderServiceTest() {} |
38 | 39 |
39 virtual void SetUp() OVERRIDE { | 40 virtual void SetUp() OVERRIDE { |
40 service_.reset(new PolicyHeaderService( | 41 service_.reset(new PolicyHeaderService(kDMServerURL, |
41 kDMServerURL, &user_store_, &device_store_)); | 42 kPolicyVerificationKeyHash, |
| 43 &user_store_, |
| 44 &device_store_)); |
42 helper_ = service_->CreatePolicyHeaderIOHelper(task_runner_).Pass(); | 45 helper_ = service_->CreatePolicyHeaderIOHelper(task_runner_).Pass(); |
43 } | 46 } |
44 | 47 |
45 virtual void TearDown() OVERRIDE { | 48 virtual void TearDown() OVERRIDE { |
46 task_runner_->RunUntilIdle(); | 49 task_runner_->RunUntilIdle(); |
47 // Helper should outlive the service. | 50 // Helper should outlive the service. |
48 service_.reset(); | 51 service_.reset(); |
49 helper_.reset(); | 52 helper_.reset(); |
50 } | 53 } |
51 | 54 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 user_store_.SetPolicy(scoped_ptr<PolicyData>()); | 109 user_store_.SetPolicy(scoped_ptr<PolicyData>()); |
107 task_runner_->RunUntilIdle(); | 110 task_runner_->RunUntilIdle(); |
108 | 111 |
109 net::TestURLRequest request2( | 112 net::TestURLRequest request2( |
110 GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL, &context); | 113 GURL(kDMServerURL), net::DEFAULT_PRIORITY, NULL, &context); |
111 helper_->AddPolicyHeaders(&request2); | 114 helper_->AddPolicyHeaders(&request2); |
112 ValidateHeader(request2.extra_request_headers(), ""); | 115 ValidateHeader(request2.extra_request_headers(), ""); |
113 } | 116 } |
114 | 117 |
115 } // namespace policy | 118 } // namespace policy |
OLD | NEW |