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 "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_invalidator.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "chrome/browser/browser_process_platform_part.h" | |
12 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | |
15 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | |
16 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" | |
17 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | |
18 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | |
13 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
14 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " | 20 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " |
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 21 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
22 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | |
23 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" | |
24 #include "chrome/browser/invalidation/fake_invalidation_service.h" | |
16 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" | 25 #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" |
26 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h" | |
17 #include "chrome/browser/profiles/profile.h" | 27 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/test/base/testing_browser_process.h" | 28 #include "chrome/test/base/testing_browser_process.h" |
19 #include "chrome/test/base/testing_profile_manager.h" | 29 #include "chrome/test/base/testing_profile_manager.h" |
20 #include "chromeos/cryptohome/system_salt_getter.h" | 30 #include "chromeos/cryptohome/system_salt_getter.h" |
21 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
32 #include "components/invalidation/invalidation_service.h" | |
22 #include "components/invalidation/invalidator_state.h" | 33 #include "components/invalidation/invalidator_state.h" |
23 #include "components/invalidation/profile_invalidation_provider.h" | 34 #include "components/invalidation/profile_invalidation_provider.h" |
24 #include "components/invalidation/ticl_invalidation_service.h" | 35 #include "components/invalidation/ticl_invalidation_service.h" |
36 #include "components/keyed_service/core/keyed_service.h" | |
37 #include "components/policy/core/common/cloud/cloud_policy_client.h" | |
38 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | |
39 #include "components/policy/core/common/cloud/cloud_policy_core.h" | |
40 #include "components/policy/core/common/cloud/mock_cloud_policy_client.h" | |
41 #include "content/public/browser/browser_context.h" | |
25 #include "content/public/browser/notification_details.h" | 42 #include "content/public/browser/notification_details.h" |
26 #include "content/public/browser/notification_service.h" | 43 #include "content/public/browser/notification_service.h" |
27 #include "content/public/test/test_browser_thread_bundle.h" | 44 #include "content/public/test/test_browser_thread_bundle.h" |
28 #include "net/url_request/url_request_context_getter.h" | 45 #include "net/url_request/url_request_context_getter.h" |
29 #include "net/url_request/url_request_test_util.h" | 46 #include "net/url_request/url_request_test_util.h" |
47 #include "policy/proto/device_management_backend.pb.h" | |
48 #include "testing/gmock/include/gmock/gmock.h" | |
30 #include "testing/gtest/include/gtest/gtest.h" | 49 #include "testing/gtest/include/gtest/gtest.h" |
31 | 50 |
32 namespace policy { | 51 namespace policy { |
33 | 52 |
53 namespace { | |
54 | |
55 KeyedService* BuildProfileInvalidationProvider( | |
56 content::BrowserContext* context) { | |
57 scoped_ptr<invalidation::FakeInvalidationService> invalidation_service( | |
58 new invalidation::FakeInvalidationService); | |
59 invalidation_service->SetInvalidatorState( | |
60 syncer::TRANSIENT_INVALIDATION_ERROR); | |
61 return new invalidation::ProfileInvalidationProvider( | |
62 invalidation_service.PassAs<invalidation::InvalidationService>()); | |
63 } | |
64 | |
65 } // namespace | |
66 | |
34 class DeviceCloudPolicyInvalidatorTest : public testing::Test { | 67 class DeviceCloudPolicyInvalidatorTest : public testing::Test { |
35 public: | 68 public: |
36 DeviceCloudPolicyInvalidatorTest(); | 69 DeviceCloudPolicyInvalidatorTest(); |
37 virtual ~DeviceCloudPolicyInvalidatorTest(); | 70 virtual ~DeviceCloudPolicyInvalidatorTest(); |
38 | 71 |
39 // testing::Test: | 72 // testing::Test: |
40 virtual void SetUp() OVERRIDE; | 73 virtual void SetUp() OVERRIDE; |
41 virtual void TearDown() OVERRIDE; | 74 virtual void TearDown() OVERRIDE; |
42 | 75 |
43 // Ownership is not passed. The Profile is owned by the global ProfileManager. | 76 // Ownership is not passed. The Profile is owned by the global ProfileManager. |
44 Profile *CreateProfile(const std::string& profile_name); | 77 Profile *CreateProfile(const std::string& profile_name); |
45 | 78 |
46 invalidation::TiclInvalidationService* GetDeviceInvalidationService(); | 79 invalidation::TiclInvalidationService* GetDeviceInvalidationService(); |
47 bool HasDeviceInvalidationServiceObserver() const; | 80 bool HasDeviceInvalidationServiceObserver() const; |
48 | 81 |
49 invalidation::TiclInvalidationService* GetProfileInvalidationService( | 82 invalidation::FakeInvalidationService* GetProfileInvalidationService( |
50 Profile* profile); | 83 Profile* profile); |
51 int GetProfileInvalidationServiceObserverCount() const; | 84 int GetProfileInvalidationServiceObserverCount() const; |
52 | 85 |
53 const invalidation::TiclInvalidationService* GetInvalidationService() const; | 86 const invalidation::InvalidationService* GetInvalidationService() const; |
54 bool HasCloudPolicyInvalidator() const; | 87 CloudPolicyInvalidator* GetCloudPolicyInvalidator() const; |
55 | 88 |
56 void ConnectDeviceInvalidationService(); | 89 void ConnectDeviceInvalidationService(); |
57 | 90 |
91 protected: | |
92 DevicePolicyBuilder device_policy_; | |
93 | |
58 private: | 94 private: |
59 content::TestBrowserThreadBundle thread_bundle_; | 95 content::TestBrowserThreadBundle thread_bundle_; |
60 scoped_refptr<net::URLRequestContextGetter> system_request_context_; | 96 scoped_refptr<net::URLRequestContextGetter> system_request_context_; |
61 TestingProfileManager profile_manager_; | 97 TestingProfileManager profile_manager_; |
98 ScopedStubEnterpriseInstallAttributes install_attributes_; | |
62 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> | 99 scoped_ptr<chromeos::ScopedTestDeviceSettingsService> |
63 test_device_settings_service_; | 100 test_device_settings_service_; |
64 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; | 101 scoped_ptr<chromeos::ScopedTestCrosSettings> test_cros_settings_; |
102 chromeos::DeviceSettingsTestHelper device_settings_test_helper_; | |
65 | 103 |
66 scoped_ptr<DeviceCloudPolicyInvalidator> invalidator_; | 104 scoped_ptr<DeviceCloudPolicyInvalidator> invalidator_; |
67 }; | 105 }; |
68 | 106 |
69 DeviceCloudPolicyInvalidatorTest::DeviceCloudPolicyInvalidatorTest() | 107 DeviceCloudPolicyInvalidatorTest::DeviceCloudPolicyInvalidatorTest() |
70 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 108 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
71 system_request_context_(new net::TestURLRequestContextGetter( | 109 system_request_context_(new net::TestURLRequestContextGetter( |
72 base::MessageLoopProxy::current())), | 110 base::MessageLoopProxy::current())), |
73 profile_manager_(TestingBrowserProcess::GetGlobal()) { | 111 profile_manager_(TestingBrowserProcess::GetGlobal()), |
112 install_attributes_("example.com", | |
113 "user@example.com", | |
114 "device_id", | |
115 DEVICE_MODE_ENTERPRISE) { | |
74 } | 116 } |
75 | 117 |
76 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { | 118 DeviceCloudPolicyInvalidatorTest::~DeviceCloudPolicyInvalidatorTest() { |
77 } | 119 } |
78 | 120 |
79 void DeviceCloudPolicyInvalidatorTest::SetUp() { | 121 void DeviceCloudPolicyInvalidatorTest::SetUp() { |
80 chromeos::SystemSaltGetter::Initialize(); | 122 chromeos::SystemSaltGetter::Initialize(); |
81 chromeos::DBusThreadManager::InitializeWithStub(); | 123 chromeos::DBusThreadManager::InitializeWithStub(); |
82 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | 124 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
83 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( | 125 TestingBrowserProcess::GetGlobal()->SetSystemRequestContext( |
84 system_request_context_.get()); | 126 system_request_context_.get()); |
85 ASSERT_TRUE(profile_manager_.SetUp()); | 127 ASSERT_TRUE(profile_manager_.SetUp()); |
128 | |
86 test_device_settings_service_.reset(new | 129 test_device_settings_service_.reset(new |
87 chromeos::ScopedTestDeviceSettingsService); | 130 chromeos::ScopedTestDeviceSettingsService); |
88 test_cros_settings_.reset(new chromeos::ScopedTestCrosSettings); | 131 test_cros_settings_.reset(new chromeos::ScopedTestCrosSettings); |
132 scoped_refptr<chromeos::MockOwnerKeyUtil> owner_key_util( | |
133 new chromeos::MockOwnerKeyUtil); | |
134 owner_key_util->SetPublicKeyFromPrivateKey( | |
135 *device_policy_.GetSigningKey()); | |
Joao da Silva
2014/08/13 13:01:38
nit: indent
bartfab (slow)
2014/08/13 13:37:47
Done.
| |
136 chromeos::DeviceSettingsService::Get()->SetSessionManager( | |
137 &device_settings_test_helper_, | |
138 owner_key_util); | |
139 | |
140 device_policy_.policy_data().set_invalidation_source(123); | |
141 device_policy_.policy_data().set_invalidation_name("invalidation"); | |
142 device_policy_.Build(); | |
143 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); | |
144 device_settings_test_helper_.Flush(); | |
145 | |
146 scoped_ptr<MockCloudPolicyClient> policy_client(new MockCloudPolicyClient); | |
147 EXPECT_CALL(*policy_client, SetupRegistration("token", "device-id")); | |
148 CloudPolicyCore* core = TestingBrowserProcess::GetGlobal()->platform_part()-> | |
149 browser_policy_connector_chromeos()->GetDeviceCloudPolicyManager()-> | |
150 core(); | |
151 core->Connect(policy_client.PassAs<CloudPolicyClient>()); | |
152 core->StartRefreshScheduler(); | |
153 | |
154 invalidation::ProfileInvalidationProviderFactory::GetInstance()-> | |
155 RegisterTestingFactory(BuildProfileInvalidationProvider); | |
89 | 156 |
90 invalidator_.reset(new DeviceCloudPolicyInvalidator); | 157 invalidator_.reset(new DeviceCloudPolicyInvalidator); |
91 } | 158 } |
92 | 159 |
93 void DeviceCloudPolicyInvalidatorTest::TearDown() { | 160 void DeviceCloudPolicyInvalidatorTest::TearDown() { |
94 invalidator_.reset(); | 161 invalidator_.reset(); |
95 base::RunLoop().RunUntilIdle(); | 162 base::RunLoop().RunUntilIdle(); |
96 | 163 |
164 invalidation::ProfileInvalidationProviderFactory::GetInstance()-> | |
165 RegisterTestingFactory(NULL); | |
166 chromeos::DeviceSettingsService::Get()->UnsetSessionManager(); | |
97 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); | 167 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); |
98 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); | 168 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); |
99 chromeos::DBusThreadManager::Shutdown(); | 169 chromeos::DBusThreadManager::Shutdown(); |
100 chromeos::SystemSaltGetter::Shutdown(); | 170 chromeos::SystemSaltGetter::Shutdown(); |
101 } | 171 } |
102 | 172 |
103 Profile *DeviceCloudPolicyInvalidatorTest::CreateProfile( | 173 Profile *DeviceCloudPolicyInvalidatorTest::CreateProfile( |
104 const std::string& profile_name) { | 174 const std::string& profile_name) { |
105 Profile* profile = profile_manager_.CreateTestingProfile(profile_name); | 175 Profile* profile = profile_manager_.CreateTestingProfile(profile_name); |
106 content::NotificationService::current()->Notify( | 176 content::NotificationService::current()->Notify( |
107 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, | 177 chrome::NOTIFICATION_LOGIN_USER_PROFILE_PREPARED, |
108 content::NotificationService::AllSources(), | 178 content::NotificationService::AllSources(), |
109 content::Details<Profile>(profile)); | 179 content::Details<Profile>(profile)); |
110 return profile; | 180 return profile; |
111 } | 181 } |
112 | 182 |
113 invalidation::TiclInvalidationService* | 183 invalidation::TiclInvalidationService* |
114 DeviceCloudPolicyInvalidatorTest::GetDeviceInvalidationService() { | 184 DeviceCloudPolicyInvalidatorTest::GetDeviceInvalidationService() { |
115 return invalidator_->device_invalidation_service_.get(); | 185 return invalidator_->device_invalidation_service_.get(); |
116 } | 186 } |
117 | 187 |
118 bool DeviceCloudPolicyInvalidatorTest::HasDeviceInvalidationServiceObserver( | 188 bool DeviceCloudPolicyInvalidatorTest::HasDeviceInvalidationServiceObserver( |
119 ) const { | 189 ) const { |
120 return invalidator_->device_invalidation_service_observer_.get(); | 190 return invalidator_->device_invalidation_service_observer_.get(); |
121 } | 191 } |
122 | 192 |
123 invalidation::TiclInvalidationService* | 193 invalidation::FakeInvalidationService* |
124 DeviceCloudPolicyInvalidatorTest::GetProfileInvalidationService( | 194 DeviceCloudPolicyInvalidatorTest::GetProfileInvalidationService( |
125 Profile* profile) { | 195 Profile* profile) { |
126 invalidation::ProfileInvalidationProvider* invalidation_provider = | 196 invalidation::ProfileInvalidationProvider* invalidation_provider = |
127 static_cast<invalidation::ProfileInvalidationProvider*>( | 197 static_cast<invalidation::ProfileInvalidationProvider*>( |
128 invalidation::ProfileInvalidationProviderFactory::GetInstance()-> | 198 invalidation::ProfileInvalidationProviderFactory::GetInstance()-> |
129 GetServiceForBrowserContext(profile, false)); | 199 GetServiceForBrowserContext(profile, false)); |
130 if (!invalidation_provider) | 200 if (!invalidation_provider) |
131 return NULL; | 201 return NULL; |
132 return static_cast<invalidation::TiclInvalidationService*>( | 202 return static_cast<invalidation::FakeInvalidationService*>( |
133 invalidation_provider->GetInvalidationService()); | 203 invalidation_provider->GetInvalidationService()); |
134 } | 204 } |
135 | 205 |
136 int DeviceCloudPolicyInvalidatorTest:: | 206 int DeviceCloudPolicyInvalidatorTest:: |
137 GetProfileInvalidationServiceObserverCount() const { | 207 GetProfileInvalidationServiceObserverCount() const { |
138 return invalidator_->profile_invalidation_service_observers_.size(); | 208 return invalidator_->profile_invalidation_service_observers_.size(); |
139 } | 209 } |
140 | 210 |
141 const invalidation::TiclInvalidationService* | 211 const invalidation::InvalidationService* |
142 DeviceCloudPolicyInvalidatorTest::GetInvalidationService() const { | 212 DeviceCloudPolicyInvalidatorTest::GetInvalidationService() const { |
143 return static_cast<invalidation::TiclInvalidationService*>( | 213 return invalidator_->invalidation_service_; |
144 invalidator_->invalidation_service_); | |
145 } | 214 } |
146 | 215 |
147 bool DeviceCloudPolicyInvalidatorTest::HasCloudPolicyInvalidator() const { | 216 CloudPolicyInvalidator* |
217 DeviceCloudPolicyInvalidatorTest::GetCloudPolicyInvalidator() const { | |
148 return invalidator_->invalidator_.get(); | 218 return invalidator_->invalidator_.get(); |
149 } | 219 } |
150 | 220 |
151 void DeviceCloudPolicyInvalidatorTest::ConnectDeviceInvalidationService() { | 221 void DeviceCloudPolicyInvalidatorTest::ConnectDeviceInvalidationService() { |
152 // Verify that a device-global invalidation service has been created. | 222 // Verify that a device-global invalidation service has been created. |
153 ASSERT_TRUE(GetDeviceInvalidationService()); | 223 ASSERT_TRUE(GetDeviceInvalidationService()); |
154 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 224 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
155 | 225 |
156 // Verify that no per-profile invalidation service observers have been | 226 // Verify that no per-profile invalidation service observers have been |
157 // created. | 227 // created. |
158 EXPECT_EQ(0, GetProfileInvalidationServiceObserverCount()); | 228 EXPECT_EQ(0, GetProfileInvalidationServiceObserverCount()); |
159 | 229 |
160 // Verify that no invalidator exists yet | 230 // Verify that no invalidator exists yet |
161 EXPECT_FALSE(HasCloudPolicyInvalidator()); | 231 EXPECT_FALSE(GetCloudPolicyInvalidator()); |
162 EXPECT_FALSE(GetInvalidationService()); | 232 EXPECT_FALSE(GetInvalidationService()); |
163 | 233 |
164 // Indicate that the device-global invalidation service has connected. | 234 // Indicate that the device-global invalidation service has connected. |
165 GetDeviceInvalidationService()->OnInvalidatorStateChange( | 235 GetDeviceInvalidationService()->OnInvalidatorStateChange( |
166 syncer::INVALIDATIONS_ENABLED); | 236 syncer::INVALIDATIONS_ENABLED); |
167 base::RunLoop().RunUntilIdle(); | 237 base::RunLoop().RunUntilIdle(); |
168 | 238 |
169 // Verify that the device-global invalidation service still exists. | 239 // Verify that the device-global invalidation service still exists. |
170 EXPECT_TRUE(GetDeviceInvalidationService()); | 240 EXPECT_TRUE(GetDeviceInvalidationService()); |
171 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 241 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
172 | 242 |
173 // Verify that an invalidator backed by the device-global invalidation service | 243 // Verify that an invalidator backed by the device-global invalidation service |
174 // has been created. | 244 // has been created. |
175 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 245 EXPECT_TRUE(GetCloudPolicyInvalidator()); |
176 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); | 246 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); |
177 } | 247 } |
178 | 248 |
179 // Verifies that a DeviceCloudPolicyInvalidator backed by a device-global | 249 // Verifies that a DeviceCloudPolicyInvalidator backed by a device-global |
180 // invalidation service is created/destroyed as the service | 250 // invalidation service is created/destroyed as the service |
181 // connects/disconnects. | 251 // connects/disconnects. |
182 TEST_F(DeviceCloudPolicyInvalidatorTest, UseDeviceInvalidationService) { | 252 TEST_F(DeviceCloudPolicyInvalidatorTest, UseDeviceInvalidationService) { |
183 // Verify that an invalidator backed by the device-global invalidation service | 253 // Verify that an invalidator backed by the device-global invalidation service |
184 // is created when the service connects. | 254 // is created when the service connects. |
185 ConnectDeviceInvalidationService(); | 255 ConnectDeviceInvalidationService(); |
186 ASSERT_TRUE(GetDeviceInvalidationService()); | 256 ASSERT_TRUE(GetDeviceInvalidationService()); |
187 | 257 |
188 // Indicate that the device-global invalidation service has disconnected. | 258 // Indicate that the device-global invalidation service has disconnected. |
189 GetDeviceInvalidationService()->OnInvalidatorStateChange( | 259 GetDeviceInvalidationService()->OnInvalidatorStateChange( |
190 syncer::INVALIDATION_CREDENTIALS_REJECTED); | 260 syncer::INVALIDATION_CREDENTIALS_REJECTED); |
191 base::RunLoop().RunUntilIdle(); | 261 base::RunLoop().RunUntilIdle(); |
192 | 262 |
193 // Verify that the device-global invalidation service still exists. | 263 // Verify that the device-global invalidation service still exists. |
194 EXPECT_TRUE(GetDeviceInvalidationService()); | 264 EXPECT_TRUE(GetDeviceInvalidationService()); |
195 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 265 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
196 | 266 |
197 // Verify that the invalidator has been destroyed. | 267 // Verify that the invalidator has been destroyed. |
198 EXPECT_FALSE(HasCloudPolicyInvalidator()); | 268 EXPECT_FALSE(GetCloudPolicyInvalidator()); |
199 EXPECT_FALSE(GetInvalidationService()); | 269 EXPECT_FALSE(GetInvalidationService()); |
200 } | 270 } |
201 | 271 |
202 // Verifies that a DeviceCloudPolicyInvalidator backed by a per-profile | 272 // Verifies that a DeviceCloudPolicyInvalidator backed by a per-profile |
203 // invalidation service is created/destroyed as the service | 273 // invalidation service is created/destroyed as the service |
204 // connects/disconnects. | 274 // connects/disconnects. |
205 TEST_F(DeviceCloudPolicyInvalidatorTest, UseProfileInvalidationService) { | 275 TEST_F(DeviceCloudPolicyInvalidatorTest, UseProfileInvalidationService) { |
206 // Create a user profile. | 276 // Create a user profile. |
207 Profile* profile = CreateProfile("test"); | 277 Profile* profile = CreateProfile("test"); |
208 ASSERT_TRUE(profile); | 278 ASSERT_TRUE(profile); |
209 | 279 |
210 // Verify that a device-global invalidation service has been created. | 280 // Verify that a device-global invalidation service has been created. |
211 EXPECT_TRUE(GetDeviceInvalidationService()); | 281 EXPECT_TRUE(GetDeviceInvalidationService()); |
212 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 282 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
213 | 283 |
214 // Verify that a per-profile invalidation service has been created. | 284 // Verify that a per-profile invalidation service has been created. |
215 invalidation::TiclInvalidationService* profile_invalidation_service = | 285 invalidation::FakeInvalidationService* profile_invalidation_service = |
216 GetProfileInvalidationService(profile); | 286 GetProfileInvalidationService(profile); |
217 ASSERT_TRUE(profile_invalidation_service); | 287 ASSERT_TRUE(profile_invalidation_service); |
218 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); | 288 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); |
219 | 289 |
220 // Verify that no invalidator exists yet | 290 // Verify that no invalidator exists yet |
221 EXPECT_FALSE(HasCloudPolicyInvalidator()); | 291 EXPECT_FALSE(GetCloudPolicyInvalidator()); |
222 EXPECT_FALSE(GetInvalidationService()); | 292 EXPECT_FALSE(GetInvalidationService()); |
223 | 293 |
224 // Indicate that the per-profile invalidation service has connected. | 294 // Indicate that the per-profile invalidation service has connected. |
225 profile_invalidation_service->OnInvalidatorStateChange( | 295 profile_invalidation_service->SetInvalidatorState( |
226 syncer::INVALIDATIONS_ENABLED); | 296 syncer::INVALIDATIONS_ENABLED); |
227 base::RunLoop().RunUntilIdle(); | |
228 | 297 |
229 // Verify that the device-global invalidator has been destroyed. | 298 // Verify that the device-global invalidator has been destroyed. |
230 EXPECT_FALSE(GetDeviceInvalidationService()); | 299 EXPECT_FALSE(GetDeviceInvalidationService()); |
231 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); | 300 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); |
232 | 301 |
233 // Verify that a per-profile invalidation service still exists. | 302 // Verify that a per-profile invalidation service still exists. |
234 profile_invalidation_service = GetProfileInvalidationService(profile); | 303 profile_invalidation_service = GetProfileInvalidationService(profile); |
235 ASSERT_TRUE(profile_invalidation_service); | 304 ASSERT_TRUE(profile_invalidation_service); |
236 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); | 305 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); |
237 | 306 |
238 // Verify that an invalidator backed by the per-profile invalidation service | 307 // Verify that an invalidator backed by the per-profile invalidation service |
239 // has been created. | 308 // has been created. |
240 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 309 EXPECT_TRUE(GetCloudPolicyInvalidator()); |
241 EXPECT_EQ(profile_invalidation_service, GetInvalidationService()); | 310 EXPECT_EQ(profile_invalidation_service, GetInvalidationService()); |
242 | 311 |
243 // Indicate that the per-profile invalidation service has disconnected. | 312 // Indicate that the per-profile invalidation service has disconnected. |
244 profile_invalidation_service->OnInvalidatorStateChange( | 313 profile_invalidation_service->SetInvalidatorState( |
245 syncer::INVALIDATION_CREDENTIALS_REJECTED); | 314 syncer::INVALIDATION_CREDENTIALS_REJECTED); |
246 base::RunLoop().RunUntilIdle(); | |
247 | 315 |
248 // Verify that a device-global invalidation service has been created. | 316 // Verify that a device-global invalidation service has been created. |
249 EXPECT_TRUE(GetDeviceInvalidationService()); | 317 EXPECT_TRUE(GetDeviceInvalidationService()); |
250 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 318 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
251 | 319 |
252 // Verify that a per-profile invalidation service still exists. | 320 // Verify that a per-profile invalidation service still exists. |
253 profile_invalidation_service = GetProfileInvalidationService(profile); | 321 profile_invalidation_service = GetProfileInvalidationService(profile); |
254 EXPECT_TRUE(profile_invalidation_service); | 322 EXPECT_TRUE(profile_invalidation_service); |
255 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); | 323 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); |
256 | 324 |
257 // Verify that the invalidator has been destroyed. | 325 // Verify that the invalidator has been destroyed. |
258 EXPECT_FALSE(HasCloudPolicyInvalidator()); | 326 EXPECT_FALSE(GetCloudPolicyInvalidator()); |
259 EXPECT_FALSE(GetInvalidationService()); | 327 EXPECT_FALSE(GetInvalidationService()); |
260 } | 328 } |
261 | 329 |
262 // Verifies that a DeviceCloudPolicyInvalidator exists whenever a connected | 330 // Verifies that a DeviceCloudPolicyInvalidator exists whenever a connected |
263 // invalidation service is available, automatically switching between | 331 // invalidation service is available, automatically switching between |
264 // device-global and per-profile invalidation services as they | 332 // device-global and per-profile invalidation services as they |
265 // connect/disconnect, giving priority to per-profile invalidation services. | 333 // connect/disconnect, giving priority to per-profile invalidation services. |
334 // Also verifies that the highest handled invalidation version is preserved when | |
335 // switching invalidation services. | |
266 TEST_F(DeviceCloudPolicyInvalidatorTest, SwitchInvalidationServices) { | 336 TEST_F(DeviceCloudPolicyInvalidatorTest, SwitchInvalidationServices) { |
337 CloudPolicyStore* store = static_cast<CloudPolicyStore*>( | |
338 TestingBrowserProcess::GetGlobal()->platform_part()-> | |
339 browser_policy_connector_chromeos()->GetDeviceCloudPolicyManager()-> | |
340 device_store()); | |
341 ASSERT_TRUE(store); | |
342 | |
267 // Verify that an invalidator backed by the device-global invalidation service | 343 // Verify that an invalidator backed by the device-global invalidation service |
268 // is created when the service connects. | 344 // is created when the service connects. |
269 ConnectDeviceInvalidationService(); | 345 ConnectDeviceInvalidationService(); |
346 CloudPolicyInvalidator* invalidator = GetCloudPolicyInvalidator(); | |
347 ASSERT_TRUE(invalidator); | |
270 ASSERT_TRUE(GetDeviceInvalidationService()); | 348 ASSERT_TRUE(GetDeviceInvalidationService()); |
271 | 349 |
350 // Verify that the invalidator's highest handled invalidation version starts | |
351 // out as zero. | |
352 EXPECT_EQ(0, invalidator->highest_handled_invalidation_version()); | |
353 | |
272 // Create a first user profile. | 354 // Create a first user profile. |
273 Profile* profile_1 = CreateProfile("test_1"); | 355 Profile* profile_1 = CreateProfile("test_1"); |
274 ASSERT_TRUE(profile_1); | 356 ASSERT_TRUE(profile_1); |
275 | 357 |
276 // Verify that the device-global invalidation service still exists. | 358 // Verify that the device-global invalidation service still exists. |
277 EXPECT_TRUE(GetDeviceInvalidationService()); | 359 EXPECT_TRUE(GetDeviceInvalidationService()); |
278 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 360 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
279 | 361 |
280 // Verify that a per-profile invalidation service has been created for the | 362 // Verify that a per-profile invalidation service has been created for the |
281 // first user profile. | 363 // first user profile. |
282 invalidation::TiclInvalidationService* profile_1_invalidation_service = | 364 invalidation::FakeInvalidationService* profile_1_invalidation_service = |
283 GetProfileInvalidationService(profile_1); | 365 GetProfileInvalidationService(profile_1); |
284 ASSERT_TRUE(profile_1_invalidation_service); | 366 ASSERT_TRUE(profile_1_invalidation_service); |
285 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); | 367 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); |
286 | 368 |
287 // Verify that an invalidator backed by the device-global invalidation service | 369 // Verify that an invalidator backed by the device-global invalidation service |
288 // still exists. | 370 // still exists. |
289 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 371 EXPECT_TRUE(GetCloudPolicyInvalidator()); |
290 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); | 372 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); |
291 | 373 |
292 // Indicate that the first user profile's per-profile invalidation service has | 374 // Indicate that the first user profile's per-profile invalidation service has |
293 // connected. | 375 // connected. |
294 profile_1_invalidation_service->OnInvalidatorStateChange( | 376 profile_1_invalidation_service->SetInvalidatorState( |
295 syncer::INVALIDATIONS_ENABLED); | 377 syncer::INVALIDATIONS_ENABLED); |
296 base::RunLoop().RunUntilIdle(); | |
297 | 378 |
298 // Verify that the device-global invalidator has been destroyed. | 379 // Verify that the device-global invalidator has been destroyed. |
299 EXPECT_FALSE(GetDeviceInvalidationService()); | 380 EXPECT_FALSE(GetDeviceInvalidationService()); |
300 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); | 381 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); |
301 | 382 |
302 // Verify that a per-profile invalidation service still exists for the first | 383 // Verify that a per-profile invalidation service still exists for the first |
303 // user profile. | 384 // user profile. |
304 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 385 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
305 EXPECT_TRUE(profile_1_invalidation_service); | 386 EXPECT_TRUE(profile_1_invalidation_service); |
306 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); | 387 EXPECT_EQ(1, GetProfileInvalidationServiceObserverCount()); |
307 | 388 |
308 // Verify that an invalidator backed by the per-profile invalidation service | 389 // Verify that an invalidator backed by the per-profile invalidation service |
309 // for the first user profile has been created. | 390 // for the first user profile has been created. |
310 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 391 invalidator = GetCloudPolicyInvalidator(); |
392 ASSERT_TRUE(invalidator); | |
311 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); | 393 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); |
312 | 394 |
395 // Verify that the invalidator's highest handled invalidation version starts | |
396 // out as zero. | |
397 EXPECT_EQ(0, invalidator->highest_handled_invalidation_version()); | |
398 | |
399 // Handle an invalidation with version 1. Verify that the invalidator's | |
400 // highest handled invalidation version is updated accordingly. | |
401 store->Store(device_policy_.policy(), 1); | |
402 invalidator->OnStoreLoaded(store); | |
403 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); | |
404 | |
313 // Create a second user profile. | 405 // Create a second user profile. |
314 Profile* profile_2 = CreateProfile("test_2"); | 406 Profile* profile_2 = CreateProfile("test_2"); |
315 ASSERT_TRUE(profile_2); | 407 ASSERT_TRUE(profile_2); |
316 | 408 |
317 // Verify that the device-global invalidator still does not exist. | 409 // Verify that the device-global invalidator still does not exist. |
318 EXPECT_FALSE(GetDeviceInvalidationService()); | 410 EXPECT_FALSE(GetDeviceInvalidationService()); |
319 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); | 411 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); |
320 | 412 |
321 // Verify that a per-profile invalidation service still exists for the first | 413 // Verify that a per-profile invalidation service still exists for the first |
322 // user profile and one has been created for the second user profile. | 414 // user profile and one has been created for the second user profile. |
323 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 415 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
324 EXPECT_TRUE(profile_1_invalidation_service); | 416 EXPECT_TRUE(profile_1_invalidation_service); |
325 invalidation::TiclInvalidationService* profile_2_invalidation_service = | 417 invalidation::FakeInvalidationService* profile_2_invalidation_service = |
326 GetProfileInvalidationService(profile_2); | 418 GetProfileInvalidationService(profile_2); |
327 ASSERT_TRUE(profile_2_invalidation_service); | 419 ASSERT_TRUE(profile_2_invalidation_service); |
328 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); | 420 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); |
329 | 421 |
330 // Verify that an invalidator backed by the per-profile invalidation service | 422 // Verify that an invalidator backed by the per-profile invalidation service |
331 // for the first user profile still exists. | 423 // for the first user profile still exists. |
332 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 424 EXPECT_TRUE(GetCloudPolicyInvalidator()); |
333 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); | 425 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); |
334 | 426 |
335 // Indicate that the second user profile's per-profile invalidation service | 427 // Indicate that the second user profile's per-profile invalidation service |
336 // has connected. | 428 // has connected. |
337 profile_2_invalidation_service->OnInvalidatorStateChange( | 429 profile_2_invalidation_service->SetInvalidatorState( |
338 syncer::INVALIDATIONS_ENABLED); | 430 syncer::INVALIDATIONS_ENABLED); |
339 base::RunLoop().RunUntilIdle(); | |
340 | 431 |
341 // Verify that the device-global invalidator still does not exist. | 432 // Verify that the device-global invalidator still does not exist. |
342 EXPECT_FALSE(GetDeviceInvalidationService()); | 433 EXPECT_FALSE(GetDeviceInvalidationService()); |
343 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); | 434 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); |
344 | 435 |
345 // Verify that per-profile invalidation services still exist for both user | 436 // Verify that per-profile invalidation services still exist for both user |
346 // profiles. | 437 // profiles. |
347 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 438 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
348 ASSERT_TRUE(profile_1_invalidation_service); | 439 ASSERT_TRUE(profile_1_invalidation_service); |
349 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); | 440 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); |
350 EXPECT_TRUE(profile_2_invalidation_service); | 441 EXPECT_TRUE(profile_2_invalidation_service); |
351 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); | 442 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); |
352 | 443 |
353 // Verify that an invalidator backed by the per-profile invalidation service | 444 // Verify that an invalidator backed by the per-profile invalidation service |
354 // for the first user profile still exists. | 445 // for the first user profile still exists. |
355 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 446 EXPECT_TRUE(GetCloudPolicyInvalidator()); |
356 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); | 447 EXPECT_EQ(profile_1_invalidation_service, GetInvalidationService()); |
357 | 448 |
358 // Indicate that the per-profile invalidation service for the first user | 449 // Indicate that the per-profile invalidation service for the first user |
359 // profile has disconnected. | 450 // profile has disconnected. |
360 profile_1_invalidation_service->OnInvalidatorStateChange( | 451 profile_1_invalidation_service->SetInvalidatorState( |
361 syncer::INVALIDATION_CREDENTIALS_REJECTED); | 452 syncer::INVALIDATION_CREDENTIALS_REJECTED); |
362 base::RunLoop().RunUntilIdle(); | |
363 | 453 |
364 // Verify that the device-global invalidator still does not exist. | 454 // Verify that the device-global invalidator still does not exist. |
365 EXPECT_FALSE(GetDeviceInvalidationService()); | 455 EXPECT_FALSE(GetDeviceInvalidationService()); |
366 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); | 456 EXPECT_FALSE(HasDeviceInvalidationServiceObserver()); |
367 | 457 |
368 // Verify that per-profile invalidation services still exist for both user | 458 // Verify that per-profile invalidation services still exist for both user |
369 // profiles. | 459 // profiles. |
370 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 460 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
371 EXPECT_TRUE(profile_1_invalidation_service); | 461 EXPECT_TRUE(profile_1_invalidation_service); |
372 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); | 462 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); |
373 ASSERT_TRUE(profile_2_invalidation_service); | 463 ASSERT_TRUE(profile_2_invalidation_service); |
374 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); | 464 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); |
375 | 465 |
376 // Verify that an invalidator backed by the per-profile invalidation service | 466 // Verify that an invalidator backed by the per-profile invalidation service |
377 // for the second user profile has been created. | 467 // for the second user profile has been created. |
378 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 468 invalidator = GetCloudPolicyInvalidator(); |
469 ASSERT_TRUE(invalidator); | |
379 EXPECT_EQ(profile_2_invalidation_service, GetInvalidationService()); | 470 EXPECT_EQ(profile_2_invalidation_service, GetInvalidationService()); |
380 | 471 |
472 // Verify that the invalidator's highest handled invalidation version starts | |
473 // out as 1. | |
474 EXPECT_EQ(1, invalidator->highest_handled_invalidation_version()); | |
475 | |
476 // Handle an invalidation with version 2. Verify that the invalidator's | |
477 // highest handled invalidation version is updated accordingly. | |
478 store->Store(device_policy_.policy(), 2); | |
479 invalidator->OnStoreLoaded(store); | |
480 EXPECT_EQ(2, invalidator->highest_handled_invalidation_version()); | |
481 | |
381 // Indicate that the per-profile invalidation service for the second user | 482 // Indicate that the per-profile invalidation service for the second user |
382 // profile has disconnected. | 483 // profile has disconnected. |
383 profile_2_invalidation_service->OnInvalidatorStateChange( | 484 profile_2_invalidation_service->SetInvalidatorState( |
384 syncer::INVALIDATION_CREDENTIALS_REJECTED); | 485 syncer::INVALIDATION_CREDENTIALS_REJECTED); |
385 base::RunLoop().RunUntilIdle(); | |
386 | 486 |
387 // Verify that a device-global invalidation service has been created. | 487 // Verify that a device-global invalidation service has been created. |
388 ASSERT_TRUE(GetDeviceInvalidationService()); | 488 ASSERT_TRUE(GetDeviceInvalidationService()); |
389 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 489 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
390 | 490 |
391 // Verify that per-profile invalidation services still exist for both user | 491 // Verify that per-profile invalidation services still exist for both user |
392 // profiles. | 492 // profiles. |
393 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 493 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
394 EXPECT_TRUE(profile_1_invalidation_service); | 494 EXPECT_TRUE(profile_1_invalidation_service); |
395 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); | 495 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); |
396 EXPECT_TRUE(profile_2_invalidation_service); | 496 EXPECT_TRUE(profile_2_invalidation_service); |
397 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); | 497 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); |
398 | 498 |
399 // Verify that the invalidator has been destroyed. | 499 // Verify that the invalidator has been destroyed. |
400 EXPECT_FALSE(HasCloudPolicyInvalidator()); | 500 EXPECT_FALSE(GetCloudPolicyInvalidator()); |
401 EXPECT_FALSE(GetInvalidationService()); | 501 EXPECT_FALSE(GetInvalidationService()); |
402 | 502 |
403 // Indicate that the device-global invalidation service has connected. | 503 // Indicate that the device-global invalidation service has connected. |
404 GetDeviceInvalidationService()->OnInvalidatorStateChange( | 504 GetDeviceInvalidationService()->OnInvalidatorStateChange( |
405 syncer::INVALIDATIONS_ENABLED); | 505 syncer::INVALIDATIONS_ENABLED); |
406 base::RunLoop().RunUntilIdle(); | 506 base::RunLoop().RunUntilIdle(); |
407 | 507 |
408 // Verify that the device-global invalidation service still exists. | 508 // Verify that the device-global invalidation service still exists. |
409 EXPECT_TRUE(GetDeviceInvalidationService()); | 509 EXPECT_TRUE(GetDeviceInvalidationService()); |
410 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); | 510 EXPECT_TRUE(HasDeviceInvalidationServiceObserver()); |
411 | 511 |
412 // Verify that per-profile invalidation services still exist for both user | 512 // Verify that per-profile invalidation services still exist for both user |
413 // profiles. | 513 // profiles. |
414 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); | 514 profile_1_invalidation_service = GetProfileInvalidationService(profile_1); |
415 EXPECT_TRUE(profile_1_invalidation_service); | 515 EXPECT_TRUE(profile_1_invalidation_service); |
416 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); | 516 profile_2_invalidation_service = GetProfileInvalidationService(profile_2); |
417 EXPECT_TRUE(profile_2_invalidation_service); | 517 EXPECT_TRUE(profile_2_invalidation_service); |
418 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); | 518 EXPECT_EQ(2, GetProfileInvalidationServiceObserverCount()); |
419 | 519 |
420 // Verify that an invalidator backed by the device-global invalidation service | 520 // Verify that an invalidator backed by the device-global invalidation service |
421 // has been created. | 521 // has been created. |
422 EXPECT_TRUE(HasCloudPolicyInvalidator()); | 522 invalidator = GetCloudPolicyInvalidator(); |
523 ASSERT_TRUE(invalidator); | |
423 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); | 524 EXPECT_EQ(GetDeviceInvalidationService(), GetInvalidationService()); |
525 | |
526 // Verify that the invalidator's highest handled invalidation version starts | |
527 // out as 2. | |
528 EXPECT_EQ(2, invalidator->highest_handled_invalidation_version()); | |
424 } | 529 } |
425 | 530 |
426 } // namespace policy | 531 } // namespace policy |
OLD | NEW |