OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "components/policy/core/common/external_data_fetcher.h" | 7 #include "components/policy/core/common/external_data_fetcher.h" |
8 #include "components/policy/core/common/mock_configuration_policy_provider.h" | 8 #include "components/policy/core/common/mock_configuration_policy_provider.h" |
9 #include "components/policy/core/common/proxy_policy_provider.h" | 9 #include "components/policy/core/common/proxy_policy_provider.h" |
10 #include "components/policy/core/common/schema_registry.h" | 10 #include "components/policy/core/common/schema_registry.h" |
11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 using testing::Mock; | 14 using testing::Mock; |
15 | 15 |
16 namespace policy { | 16 namespace policy { |
17 | 17 |
18 class ProxyPolicyProviderTest : public testing::Test { | 18 class ProxyPolicyProviderTest : public testing::Test { |
19 protected: | 19 protected: |
20 ProxyPolicyProviderTest() { | 20 ProxyPolicyProviderTest() { |
21 mock_provider_.Init(); | 21 mock_provider_.Init(); |
22 proxy_provider_.Init(&schema_registry_); | 22 proxy_provider_.Init(&schema_registry_); |
23 proxy_provider_.AddObserver(&observer_); | 23 proxy_provider_.AddObserver(&observer_); |
24 } | 24 } |
25 | 25 |
26 virtual ~ProxyPolicyProviderTest() { | 26 ~ProxyPolicyProviderTest() override { |
27 proxy_provider_.RemoveObserver(&observer_); | 27 proxy_provider_.RemoveObserver(&observer_); |
28 proxy_provider_.Shutdown(); | 28 proxy_provider_.Shutdown(); |
29 mock_provider_.Shutdown(); | 29 mock_provider_.Shutdown(); |
30 } | 30 } |
31 | 31 |
32 SchemaRegistry schema_registry_; | 32 SchemaRegistry schema_registry_; |
33 MockConfigurationPolicyObserver observer_; | 33 MockConfigurationPolicyObserver observer_; |
34 MockConfigurationPolicyProvider mock_provider_; | 34 MockConfigurationPolicyProvider mock_provider_; |
35 ProxyPolicyProvider proxy_provider_; | 35 ProxyPolicyProvider proxy_provider_; |
36 | 36 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 proxy_provider_.RefreshPolicies(); | 94 proxy_provider_.RefreshPolicies(); |
95 Mock::VerifyAndClearExpectations(&observer_); | 95 Mock::VerifyAndClearExpectations(&observer_); |
96 Mock::VerifyAndClearExpectations(&mock_provider_); | 96 Mock::VerifyAndClearExpectations(&mock_provider_); |
97 | 97 |
98 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); | 98 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); |
99 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); | 99 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); |
100 Mock::VerifyAndClearExpectations(&observer_); | 100 Mock::VerifyAndClearExpectations(&observer_); |
101 } | 101 } |
102 | 102 |
103 } // namespace policy | 103 } // namespace policy |
OLD | NEW |