Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: chrome/browser/chromeos/policy/proxy_policy_provider_unittest.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/policy/schema_registry.h"
10 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 using testing::Mock; 14 using testing::Mock;
14 15
15 namespace policy { 16 namespace policy {
16 17
17 class ProxyPolicyProviderTest : public testing::Test { 18 class ProxyPolicyProviderTest : public testing::Test {
18 protected: 19 protected:
19 ProxyPolicyProviderTest() { 20 ProxyPolicyProviderTest() {
20 mock_provider_.Init(); 21 mock_provider_.Init();
21 proxy_provider_.Init(); 22 proxy_provider_.Init(&schema_registry_);
22 proxy_provider_.AddObserver(&observer_); 23 proxy_provider_.AddObserver(&observer_);
23 } 24 }
24 25
25 virtual ~ProxyPolicyProviderTest() { 26 virtual ~ProxyPolicyProviderTest() {
26 proxy_provider_.RemoveObserver(&observer_); 27 proxy_provider_.RemoveObserver(&observer_);
27 proxy_provider_.Shutdown(); 28 proxy_provider_.Shutdown();
28 mock_provider_.Shutdown(); 29 mock_provider_.Shutdown();
29 } 30 }
30 31
32 SchemaRegistry schema_registry_;
31 MockConfigurationPolicyObserver observer_; 33 MockConfigurationPolicyObserver observer_;
32 MockConfigurationPolicyProvider mock_provider_; 34 MockConfigurationPolicyProvider mock_provider_;
33 ProxyPolicyProvider proxy_provider_; 35 ProxyPolicyProvider proxy_provider_;
34 36
35 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) { 37 static scoped_ptr<PolicyBundle> CopyBundle(const PolicyBundle& bundle) {
36 scoped_ptr<PolicyBundle> copy(new PolicyBundle()); 38 scoped_ptr<PolicyBundle> copy(new PolicyBundle());
37 copy->CopyFrom(bundle); 39 copy->CopyFrom(bundle);
38 return copy.Pass(); 40 return copy.Pass();
39 } 41 }
40 42
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 proxy_provider_.RefreshPolicies(); 93 proxy_provider_.RefreshPolicies();
92 Mock::VerifyAndClearExpectations(&observer_); 94 Mock::VerifyAndClearExpectations(&observer_);
93 Mock::VerifyAndClearExpectations(&mock_provider_); 95 Mock::VerifyAndClearExpectations(&mock_provider_);
94 96
95 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_)); 97 EXPECT_CALL(observer_, OnUpdatePolicy(&proxy_provider_));
96 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle())); 98 mock_provider_.UpdatePolicy(scoped_ptr<PolicyBundle>(new PolicyBundle()));
97 Mock::VerifyAndClearExpectations(&observer_); 99 Mock::VerifyAndClearExpectations(&observer_);
98 } 100 }
99 101
100 } // namespace policy 102 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698