Chromium Code Reviews| 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 "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "chrome/browser/chromeos/policy/proxy_policy_provider.h" | 7 #include "chrome/browser/chromeos/policy/proxy_policy_provider.h" |
| 8 #include "chrome/browser/policy/external_data_fetcher.h" | 8 #include "chrome/browser/policy/external_data_fetcher.h" |
| 9 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 9 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 using testing::Mock; | 13 using testing::Mock; |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 class ProxyPolicyProviderTest : public testing::Test { | 17 class ProxyPolicyProviderTest : public testing::Test { |
| 18 protected: | 18 protected: |
| 19 ProxyPolicyProviderTest() { | 19 ProxyPolicyProviderTest() { |
| 20 mock_provider_.Init(); | 20 mock_provider_.Init(); |
| 21 proxy_provider_.Init(); | 21 proxy_provider_.Init(&schema_registry_); |
| 22 proxy_provider_.AddObserver(&observer_); | 22 proxy_provider_.AddObserver(&observer_); |
| 23 } | 23 } |
| 24 | 24 |
| 25 virtual ~ProxyPolicyProviderTest() { | 25 virtual ~ProxyPolicyProviderTest() { |
| 26 proxy_provider_.RemoveObserver(&observer_); | 26 proxy_provider_.RemoveObserver(&observer_); |
| 27 proxy_provider_.Shutdown(); | 27 proxy_provider_.Shutdown(); |
| 28 mock_provider_.Shutdown(); | 28 mock_provider_.Shutdown(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 SchemaRegistry schema_registry_; | |
|
bartfab (slow)
2013/11/05 15:53:04
#include "chrome/browser/policy/schema_registry.h"
Joao da Silva
2013/11/07 13:15:00
Done.
| |
| 31 MockConfigurationPolicyObserver observer_; | 32 MockConfigurationPolicyObserver observer_; |
| 32 MockConfigurationPolicyProvider mock_provider_; | 33 MockConfigurationPolicyProvider mock_provider_; |
| 33 ProxyPolicyProvider proxy_provider_; | 34 ProxyPolicyProvider proxy_provider_; |
| 34 | 35 |
| 35 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) { | 36 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) { |
| 36 scoped_ptr<PolicyBundle> copy(new PolicyBundle()); | 37 scoped_ptr<PolicyBundle> copy(new PolicyBundle()); |
| 37 copy->CopyFrom(bundle); | 38 copy->CopyFrom(bundle); |
| 38 return copy.Pass(); | 39 return copy.Pass(); |
| 39 } | 40 } |
| 40 | 41 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 proxy_provider_.RefreshPolicies(); | 92 proxy_provider_.RefreshPolicies(); |
| 92 Mock::VerifyAndClearExpectations(&observer_); | 93 Mock::VerifyAndClearExpectations(&observer_); |
| 93 Mock::VerifyAndClearExpectations(&mock_provider_); | 94 Mock::VerifyAndClearExpectations(&mock_provider_); |
| 94 | 95 |
| 95 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); | 96 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); |
| 96 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); | 97 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); |
| 97 Mock::VerifyAndClearExpectations(&observer_); | 98 Mock::VerifyAndClearExpectations(&observer_); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace policy | 101 } // namespace policy |
| OLD | NEW |