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

Side by Side Diff: components/policy/core/common/policy_service_impl_unittest.cc

Issue 623133002: replace OVERRIDE and FINAL with override and final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 "components/policy/core/common/policy_service_impl.h" 5 #include "components/policy/core/common/policy_service_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // Observer class that changes the policy in the passed provider when the 70 // Observer class that changes the policy in the passed provider when the
71 // callback is invoked. 71 // callback is invoked.
72 class ChangePolicyObserver : public PolicyService::Observer { 72 class ChangePolicyObserver : public PolicyService::Observer {
73 public: 73 public:
74 explicit ChangePolicyObserver(MockConfigurationPolicyProvider* provider) 74 explicit ChangePolicyObserver(MockConfigurationPolicyProvider* provider)
75 : provider_(provider), 75 : provider_(provider),
76 observer_invoked_(false) {} 76 observer_invoked_(false) {}
77 77
78 virtual void OnPolicyUpdated(const PolicyNamespace&, 78 virtual void OnPolicyUpdated(const PolicyNamespace&,
79 const PolicyMap& previous, 79 const PolicyMap& previous,
80 const PolicyMap& current) OVERRIDE { 80 const PolicyMap& current) override {
81 PolicyMap new_policy; 81 PolicyMap new_policy;
82 new_policy.Set("foo", 82 new_policy.Set("foo",
83 POLICY_LEVEL_MANDATORY, 83 POLICY_LEVEL_MANDATORY,
84 POLICY_SCOPE_USER, 84 POLICY_SCOPE_USER,
85 new base::FundamentalValue(14), 85 new base::FundamentalValue(14),
86 NULL); 86 NULL);
87 provider_->UpdateChromePolicy(new_policy); 87 provider_->UpdateChromePolicy(new_policy);
88 observer_invoked_ = true; 88 observer_invoked_ = true;
89 } 89 }
90 90
91 bool observer_invoked() const { return observer_invoked_; } 91 bool observer_invoked() const { return observer_invoked_; }
92 92
93 private: 93 private:
94 MockConfigurationPolicyProvider* provider_; 94 MockConfigurationPolicyProvider* provider_;
95 bool observer_invoked_; 95 bool observer_invoked_;
96 }; 96 };
97 97
98 } // namespace 98 } // namespace
99 99
100 class PolicyServiceTest : public testing::Test { 100 class PolicyServiceTest : public testing::Test {
101 public: 101 public:
102 PolicyServiceTest() {} 102 PolicyServiceTest() {}
103 virtual void SetUp() OVERRIDE { 103 virtual void SetUp() override {
104 EXPECT_CALL(provider0_, IsInitializationComplete(_)) 104 EXPECT_CALL(provider0_, IsInitializationComplete(_))
105 .WillRepeatedly(Return(true)); 105 .WillRepeatedly(Return(true));
106 EXPECT_CALL(provider1_, IsInitializationComplete(_)) 106 EXPECT_CALL(provider1_, IsInitializationComplete(_))
107 .WillRepeatedly(Return(true)); 107 .WillRepeatedly(Return(true));
108 EXPECT_CALL(provider2_, IsInitializationComplete(_)) 108 EXPECT_CALL(provider2_, IsInitializationComplete(_))
109 .WillRepeatedly(Return(true)); 109 .WillRepeatedly(Return(true));
110 110
111 provider0_.Init(); 111 provider0_.Init();
112 provider1_.Init(); 112 provider1_.Init();
113 provider2_.Init(); 113 provider2_.Init();
114 114
115 policy0_.Set("pre", 115 policy0_.Set("pre",
116 POLICY_LEVEL_MANDATORY, 116 POLICY_LEVEL_MANDATORY,
117 POLICY_SCOPE_USER, 117 POLICY_SCOPE_USER,
118 new base::FundamentalValue(13), 118 new base::FundamentalValue(13),
119 NULL); 119 NULL);
120 provider0_.UpdateChromePolicy(policy0_); 120 provider0_.UpdateChromePolicy(policy0_);
121 121
122 PolicyServiceImpl::Providers providers; 122 PolicyServiceImpl::Providers providers;
123 providers.push_back(&provider0_); 123 providers.push_back(&provider0_);
124 providers.push_back(&provider1_); 124 providers.push_back(&provider1_);
125 providers.push_back(&provider2_); 125 providers.push_back(&provider2_);
126 policy_service_.reset(new PolicyServiceImpl(providers)); 126 policy_service_.reset(new PolicyServiceImpl(providers));
127 } 127 }
128 128
129 virtual void TearDown() OVERRIDE { 129 virtual void TearDown() override {
130 provider0_.Shutdown(); 130 provider0_.Shutdown();
131 provider1_.Shutdown(); 131 provider1_.Shutdown();
132 provider2_.Shutdown(); 132 provider2_.Shutdown();
133 } 133 }
134 134
135 MOCK_METHOD2(OnPolicyValueUpdated, void(const base::Value*, 135 MOCK_METHOD2(OnPolicyValueUpdated, void(const base::Value*,
136 const base::Value*)); 136 const base::Value*));
137 137
138 MOCK_METHOD0(OnPolicyRefresh, void()); 138 MOCK_METHOD0(OnPolicyRefresh, void());
139 139
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 NULL); 733 NULL);
734 734
735 provider0_.UpdatePolicy(policy_bundle.Pass()); 735 provider0_.UpdatePolicy(policy_bundle.Pass());
736 RunUntilIdle(); 736 RunUntilIdle();
737 737
738 EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome)); 738 EXPECT_TRUE(VerifyPolicies(chrome_namespace, expected_chrome));
739 EXPECT_TRUE(VerifyPolicies(extension_namespace, expected_extension)); 739 EXPECT_TRUE(VerifyPolicies(extension_namespace, expected_extension));
740 } 740 }
741 741
742 } // namespace policy 742 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/policy_service_impl.h ('k') | components/policy/core/common/policy_service_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698