OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/policy/mock_configuration_policy_provider.h" | 6 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
7 #include "chrome/browser/policy/proxy_policy_provider.h" | 7 #include "chrome/browser/policy/proxy_policy_provider.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 using testing::Mock; | 11 using testing::Mock; |
12 | 12 |
13 namespace policy { | 13 namespace policy { |
14 | 14 |
15 class ProxyPolicyProviderTest : public testing::Test { | 15 class ProxyPolicyProviderTest : public testing::Test { |
16 protected: | 16 protected: |
17 ProxyPolicyProviderTest() { | 17 ProxyPolicyProviderTest() { |
18 mock_provider_.Init(); | 18 mock_provider_.Init(); |
19 proxy_provider_.Init(); | 19 proxy_provider_.Init(); |
20 proxy_provider_.AddObserver(&observer_); | 20 proxy_provider_.AddObserver(&observer_); |
21 } | 21 } |
22 | 22 |
23 ~ProxyPolicyProviderTest() { | 23 virtual ~ProxyPolicyProviderTest() { |
24 proxy_provider_.RemoveObserver(&observer_); | 24 proxy_provider_.RemoveObserver(&observer_); |
25 proxy_provider_.Shutdown(); | 25 proxy_provider_.Shutdown(); |
26 mock_provider_.Shutdown(); | 26 mock_provider_.Shutdown(); |
27 } | 27 } |
28 | 28 |
29 MockConfigurationPolicyObserver observer_; | 29 MockConfigurationPolicyObserver observer_; |
30 MockConfigurationPolicyProvider mock_provider_; | 30 MockConfigurationPolicyProvider mock_provider_; |
31 ProxyPolicyProvider proxy_provider_; | 31 ProxyPolicyProvider proxy_provider_; |
32 | 32 |
33 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) { | 33 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 proxy_provider_.RefreshPolicies(); | 87 proxy_provider_.RefreshPolicies(); |
88 Mock::VerifyAndClearExpectations(&observer_); | 88 Mock::VerifyAndClearExpectations(&observer_); |
89 Mock::VerifyAndClearExpectations(&mock_provider_); | 89 Mock::VerifyAndClearExpectations(&mock_provider_); |
90 | 90 |
91 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); | 91 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); |
92 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); | 92 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); |
93 Mock::VerifyAndClearExpectations(&observer_); | 93 Mock::VerifyAndClearExpectations(&observer_); |
94 } | 94 } |
95 | 95 |
96 } // namespace policy | 96 } // namespace policy |
OLD | NEW |