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 "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros
.h" | 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros
.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chromeos/cros/mock_network_library.h" | 13 #include "chrome/browser/chromeos/cros/mock_network_library.h" |
14 #include "chrome/browser/policy/external_data_fetcher.h" | 14 #include "chrome/browser/policy/external_data_fetcher.h" |
15 #include "chrome/browser/policy/mock_configuration_policy_provider.h" | 15 #include "chrome/browser/policy/mock_configuration_policy_provider.h" |
16 #include "chrome/browser/policy/policy_map.h" | 16 #include "chrome/browser/policy/policy_map.h" |
17 #include "chrome/browser/policy/policy_service_impl.h" | 17 #include "chrome/browser/policy/policy_service_impl.h" |
18 #include "chromeos/network/mock_certificate_handler.h" | 18 #include "chromeos/network/onc/mock_certificate_importer.h" |
19 #include "chromeos/network/onc/onc_constants.h" | 19 #include "chromeos/network/onc/onc_constants.h" |
20 #include "chromeos/network/onc/onc_test_utils.h" | 20 #include "chromeos/network/onc/onc_test_utils.h" |
21 #include "chromeos/network/onc/onc_utils.h" | 21 #include "chromeos/network/onc/onc_utils.h" |
22 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread.h" |
23 #include "content/public/test/test_utils.h" | 23 #include "content/public/test/test_utils.h" |
24 #include "net/base/test_data_directory.h" | 24 #include "net/base/test_data_directory.h" |
25 #include "net/cert/cert_trust_anchor_provider.h" | 25 #include "net/cert/cert_trust_anchor_provider.h" |
26 #include "net/cert/x509_certificate.h" | 26 #include "net/cert/x509_certificate.h" |
27 #include "net/test/cert_test_util.h" | 27 #include "net/test/cert_test_util.h" |
28 #include "policy/policy_constants.h" | 28 #include "policy/policy_constants.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 PolicyMap policy; | 174 PolicyMap policy; |
175 policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, | 175 policy.Set(key::kOpenNetworkConfiguration, POLICY_LEVEL_MANDATORY, |
176 POLICY_SCOPE_USER, Value::CreateStringValue(onc_policy), NULL); | 176 POLICY_SCOPE_USER, Value::CreateStringValue(onc_policy), NULL); |
177 UpdateProviderPolicy(policy); | 177 UpdateProviderPolicy(policy); |
178 | 178 |
179 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); | 179 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); |
180 | 180 |
181 // Ignore the device policy update. | 181 // Ignore the device policy update. |
182 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)); | 182 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)); |
183 StrictMock<chromeos::MockCertificateHandler>* certificate_handler = | 183 StrictMock<chromeos::onc::MockCertificateImporter>* certificate_importer = |
184 new StrictMock<chromeos::MockCertificateHandler>(); | 184 new StrictMock<chromeos::onc::MockCertificateImporter>(); |
185 EXPECT_CALL(*certificate_handler, ImportCertificates(_, _, _)); | 185 EXPECT_CALL(*certificate_importer, ImportCertificates(_, _, _)); |
186 | 186 |
187 NetworkConfigurationUpdaterImplCros updater( | 187 NetworkConfigurationUpdaterImplCros updater( |
188 policy_service_.get(), | 188 policy_service_.get(), |
189 &network_library_, | 189 &network_library_, |
190 make_scoped_ptr<chromeos::CertificateHandler>(certificate_handler)); | 190 make_scoped_ptr<chromeos::onc::CertificateImporter>( |
| 191 certificate_importer)); |
191 Mock::VerifyAndClearExpectations(&network_library_); | 192 Mock::VerifyAndClearExpectations(&network_library_); |
192 Mock::VerifyAndClearExpectations(&certificate_handler); | 193 Mock::VerifyAndClearExpectations(&certificate_importer); |
193 | 194 |
194 // After the user policy is initialized, we always push both policies to the | 195 // After the user policy is initialized, we always push both policies to the |
195 // NetworkLibrary. Ignore the device policy. | 196 // NetworkLibrary. Ignore the device policy. |
196 EXPECT_CALL(network_library_, LoadOncNetworks( | 197 EXPECT_CALL(network_library_, LoadOncNetworks( |
197 _, onc::ONC_SOURCE_DEVICE_POLICY)); | 198 _, onc::ONC_SOURCE_DEVICE_POLICY)); |
198 EXPECT_CALL(network_library_, LoadOncNetworks( | 199 EXPECT_CALL(network_library_, LoadOncNetworks( |
199 IsEqualTo(network_configs_repaired), | 200 IsEqualTo(network_configs_repaired), |
200 onc::ONC_SOURCE_USER_POLICY)); | 201 onc::ONC_SOURCE_USER_POLICY)); |
201 EXPECT_CALL(*certificate_handler, | 202 EXPECT_CALL(*certificate_importer, |
202 ImportCertificates(_, chromeos::onc::ONC_SOURCE_DEVICE_POLICY, | 203 ImportCertificates(_, chromeos::onc::ONC_SOURCE_DEVICE_POLICY, |
203 _)); | 204 _)); |
204 EXPECT_CALL(*certificate_handler, | 205 EXPECT_CALL(*certificate_importer, |
205 ImportCertificates(_, chromeos::onc::ONC_SOURCE_USER_POLICY, | 206 ImportCertificates(_, chromeos::onc::ONC_SOURCE_USER_POLICY, |
206 _)); | 207 _)); |
207 | 208 |
208 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); | 209 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); |
209 | 210 |
210 updater.SetUserPolicyService(false, "hash", policy_service_.get()); | 211 updater.SetUserPolicyService(false, "hash", policy_service_.get()); |
211 updater.UnsetUserPolicyService(); | 212 updater.UnsetUserPolicyService(); |
212 } | 213 } |
213 | 214 |
214 class NetworkConfigurationUpdaterTestWithParam | 215 class NetworkConfigurationUpdaterTestWithParam |
(...skipping 22 matching lines...) Expand all Loading... |
237 user_certs = empty_certificates_.get(); | 238 user_certs = empty_certificates_.get(); |
238 } else { | 239 } else { |
239 device_networks = empty_network_configs_.get(); | 240 device_networks = empty_network_configs_.get(); |
240 device_certs = empty_certificates_.get(); | 241 device_certs = empty_certificates_.get(); |
241 user_networks = fake_network_configs_.get(); | 242 user_networks = fake_network_configs_.get(); |
242 user_certs = fake_certificates_.get(); | 243 user_certs = fake_certificates_.get(); |
243 } | 244 } |
244 | 245 |
245 EXPECT_CALL(network_library_, LoadOncNetworks( | 246 EXPECT_CALL(network_library_, LoadOncNetworks( |
246 IsEqualTo(device_networks), onc::ONC_SOURCE_DEVICE_POLICY)); | 247 IsEqualTo(device_networks), onc::ONC_SOURCE_DEVICE_POLICY)); |
247 StrictMock<chromeos::MockCertificateHandler>* certificate_handler = | 248 StrictMock<chromeos::onc::MockCertificateImporter>* certificate_importer = |
248 new StrictMock<chromeos::MockCertificateHandler>(); | 249 new StrictMock<chromeos::onc::MockCertificateImporter>(); |
249 EXPECT_CALL(*certificate_handler, ImportCertificates( | 250 EXPECT_CALL(*certificate_importer, ImportCertificates( |
250 IsEqualTo(device_certs), onc::ONC_SOURCE_DEVICE_POLICY, _)); | 251 IsEqualTo(device_certs), onc::ONC_SOURCE_DEVICE_POLICY, _)); |
251 | 252 |
252 NetworkConfigurationUpdaterImplCros updater( | 253 NetworkConfigurationUpdaterImplCros updater( |
253 policy_service_.get(), | 254 policy_service_.get(), |
254 &network_library_, | 255 &network_library_, |
255 make_scoped_ptr<chromeos::CertificateHandler>(certificate_handler)); | 256 make_scoped_ptr<chromeos::onc::CertificateImporter>( |
| 257 certificate_importer)); |
256 Mock::VerifyAndClearExpectations(&network_library_); | 258 Mock::VerifyAndClearExpectations(&network_library_); |
257 Mock::VerifyAndClearExpectations(&certificate_handler); | 259 Mock::VerifyAndClearExpectations(&certificate_importer); |
258 | 260 |
259 // After the user policy is initialized, we always push both policies to the | 261 // After the user policy is initialized, we always push both policies to the |
260 // NetworkLibrary. | 262 // NetworkLibrary. |
261 EXPECT_CALL(network_library_, LoadOncNetworks( | 263 EXPECT_CALL(network_library_, LoadOncNetworks( |
262 IsEqualTo(device_networks), onc::ONC_SOURCE_DEVICE_POLICY)); | 264 IsEqualTo(device_networks), onc::ONC_SOURCE_DEVICE_POLICY)); |
263 EXPECT_CALL(*certificate_handler, ImportCertificates( | 265 EXPECT_CALL(*certificate_importer, ImportCertificates( |
264 IsEqualTo(device_certs), onc::ONC_SOURCE_DEVICE_POLICY, _)); | 266 IsEqualTo(device_certs), onc::ONC_SOURCE_DEVICE_POLICY, _)); |
265 | 267 |
266 EXPECT_CALL(network_library_, LoadOncNetworks( | 268 EXPECT_CALL(network_library_, LoadOncNetworks( |
267 IsEqualTo(user_networks), onc::ONC_SOURCE_USER_POLICY)); | 269 IsEqualTo(user_networks), onc::ONC_SOURCE_USER_POLICY)); |
268 EXPECT_CALL(*certificate_handler, ImportCertificates( | 270 EXPECT_CALL(*certificate_importer, ImportCertificates( |
269 IsEqualTo(user_certs), onc::ONC_SOURCE_USER_POLICY, _)); | 271 IsEqualTo(user_certs), onc::ONC_SOURCE_USER_POLICY, _)); |
270 | 272 |
271 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); | 273 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); |
272 | 274 |
273 // We just need an initialized PolicyService, so we can reuse | 275 // We just need an initialized PolicyService, so we can reuse |
274 // |policy_service_|. | 276 // |policy_service_|. |
275 updater.SetUserPolicyService(false, "hash", policy_service_.get()); | 277 updater.SetUserPolicyService(false, "hash", policy_service_.get()); |
276 updater.UnsetUserPolicyService(); | 278 updater.UnsetUserPolicyService(); |
277 } | 279 } |
278 | 280 |
279 TEST_P(NetworkConfigurationUpdaterTestWithParam, | 281 TEST_P(NetworkConfigurationUpdaterTestWithParam, |
280 AllowTrustedCertificatesFromPolicy) { | 282 AllowTrustedCertificatesFromPolicy) { |
281 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); | 283 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); |
282 | 284 |
283 const net::CertificateList empty_cert_list; | 285 const net::CertificateList empty_cert_list; |
284 | 286 |
285 const net::CertificateList cert_list = | 287 const net::CertificateList cert_list = |
286 net::CreateCertificateListFromFile(net::GetTestCertsDirectory(), | 288 net::CreateCertificateListFromFile(net::GetTestCertsDirectory(), |
287 "ok_cert.pem", | 289 "ok_cert.pem", |
288 net::X509Certificate::FORMAT_AUTO); | 290 net::X509Certificate::FORMAT_AUTO); |
289 ASSERT_EQ(1u, cert_list.size()); | 291 ASSERT_EQ(1u, cert_list.size()); |
290 | 292 |
291 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)).Times(AnyNumber()); | 293 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)).Times(AnyNumber()); |
292 StrictMock<chromeos::MockCertificateHandler>* certificate_handler = | 294 StrictMock<chromeos::onc::MockCertificateImporter>* certificate_importer = |
293 new StrictMock<chromeos::MockCertificateHandler>(); | 295 new StrictMock<chromeos::onc::MockCertificateImporter>(); |
294 EXPECT_CALL(*certificate_handler, ImportCertificates(_, _, _)) | 296 EXPECT_CALL(*certificate_importer, ImportCertificates(_, _, _)) |
295 .WillRepeatedly(SetCertificateList(empty_cert_list)); | 297 .WillRepeatedly(SetCertificateList(empty_cert_list)); |
296 NetworkConfigurationUpdaterImplCros updater( | 298 NetworkConfigurationUpdaterImplCros updater( |
297 policy_service_.get(), | 299 policy_service_.get(), |
298 &network_library_, | 300 &network_library_, |
299 make_scoped_ptr<chromeos::CertificateHandler>(certificate_handler)); | 301 make_scoped_ptr<chromeos::onc::CertificateImporter>( |
| 302 certificate_importer)); |
300 net::CertTrustAnchorProvider* trust_provider = | 303 net::CertTrustAnchorProvider* trust_provider = |
301 updater.GetCertTrustAnchorProvider(); | 304 updater.GetCertTrustAnchorProvider(); |
302 ASSERT_TRUE(trust_provider); | 305 ASSERT_TRUE(trust_provider); |
303 // The initial list of trust anchors is empty. | 306 // The initial list of trust anchors is empty. |
304 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); | 307 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
305 EXPECT_TRUE(trust_provider->GetAdditionalTrustAnchors().empty()); | 308 EXPECT_TRUE(trust_provider->GetAdditionalTrustAnchors().empty()); |
306 | 309 |
307 // Initially, certificates imported from policy don't have trust flags. | 310 // Initially, certificates imported from policy don't have trust flags. |
308 updater.SetUserPolicyService(false, "hash", policy_service_.get()); | 311 updater.SetUserPolicyService(false, "hash", policy_service_.get()); |
309 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); | 312 content::RunAllPendingInMessageLoop(content::BrowserThread::IO); |
310 Mock::VerifyAndClearExpectations(&network_library_); | 313 Mock::VerifyAndClearExpectations(&network_library_); |
311 Mock::VerifyAndClearExpectations(&certificate_handler); | 314 Mock::VerifyAndClearExpectations(&certificate_importer); |
312 EXPECT_TRUE(trust_provider->GetAdditionalTrustAnchors().empty()); | 315 EXPECT_TRUE(trust_provider->GetAdditionalTrustAnchors().empty()); |
313 | 316 |
314 // Certificates with the "Web" trust flag set should be forwarded to the | 317 // Certificates with the "Web" trust flag set should be forwarded to the |
315 // trust provider. | 318 // trust provider. |
316 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)); | 319 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)); |
317 EXPECT_CALL(*certificate_handler, ImportCertificates(_, _, _)) | 320 EXPECT_CALL(*certificate_importer, ImportCertificates(_, _, _)) |
318 .WillRepeatedly(SetCertificateList(empty_cert_list)); | 321 .WillRepeatedly(SetCertificateList(empty_cert_list)); |
319 onc::ONCSource current_source = NameToONCSource(GetParam()); | 322 onc::ONCSource current_source = NameToONCSource(GetParam()); |
320 EXPECT_CALL(network_library_, LoadOncNetworks(_, current_source)); | 323 EXPECT_CALL(network_library_, LoadOncNetworks(_, current_source)); |
321 EXPECT_CALL(*certificate_handler, ImportCertificates(_, current_source, _)) | 324 EXPECT_CALL(*certificate_importer, ImportCertificates(_, current_source, _)) |
322 .WillRepeatedly(SetCertificateList(cert_list)); | 325 .WillRepeatedly(SetCertificateList(cert_list)); |
323 // Trigger a new policy load, and spin the IO message loop to pass the | 326 // Trigger a new policy load, and spin the IO message loop to pass the |
324 // certificates to the |trust_provider| on the IO thread. | 327 // certificates to the |trust_provider| on the IO thread. |
325 updater.SetUserPolicyService(true, "hash", policy_service_.get()); | 328 updater.SetUserPolicyService(true, "hash", policy_service_.get()); |
326 base::RunLoop loop; | 329 base::RunLoop loop; |
327 loop.RunUntilIdle(); | 330 loop.RunUntilIdle(); |
328 Mock::VerifyAndClearExpectations(&network_library_); | 331 Mock::VerifyAndClearExpectations(&network_library_); |
329 Mock::VerifyAndClearExpectations(&certificate_handler); | 332 Mock::VerifyAndClearExpectations(&certificate_importer); |
330 | 333 |
331 // Certificates are only provided as trust anchors if they come from user | 334 // Certificates are only provided as trust anchors if they come from user |
332 // policy. | 335 // policy. |
333 size_t expected_certs = 0u; | 336 size_t expected_certs = 0u; |
334 if (GetParam() == key::kOpenNetworkConfiguration) | 337 if (GetParam() == key::kOpenNetworkConfiguration) |
335 expected_certs = 1u; | 338 expected_certs = 1u; |
336 EXPECT_EQ(expected_certs, | 339 EXPECT_EQ(expected_certs, |
337 trust_provider->GetAdditionalTrustAnchors().size()); | 340 trust_provider->GetAdditionalTrustAnchors().size()); |
338 | 341 |
339 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); | 342 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); |
340 updater.UnsetUserPolicyService(); | 343 updater.UnsetUserPolicyService(); |
341 } | 344 } |
342 | 345 |
343 TEST_P(NetworkConfigurationUpdaterTestWithParam, PolicyChange) { | 346 TEST_P(NetworkConfigurationUpdaterTestWithParam, PolicyChange) { |
344 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); | 347 EXPECT_CALL(network_library_, AddNetworkProfileObserver(_)); |
345 | 348 |
346 // Ignore the initial updates. | 349 // Ignore the initial updates. |
347 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)) | 350 EXPECT_CALL(network_library_, LoadOncNetworks(_, _)) |
348 .Times(AnyNumber()); | 351 .Times(AnyNumber()); |
349 StrictMock<chromeos::MockCertificateHandler>* certificate_handler = | 352 StrictMock<chromeos::onc::MockCertificateImporter>* certificate_importer = |
350 new StrictMock<chromeos::MockCertificateHandler>(); | 353 new StrictMock<chromeos::onc::MockCertificateImporter>(); |
351 EXPECT_CALL(*certificate_handler, ImportCertificates(_, _, _)) | 354 EXPECT_CALL(*certificate_importer, ImportCertificates(_, _, _)) |
352 .Times(AnyNumber()); | 355 .Times(AnyNumber()); |
353 NetworkConfigurationUpdaterImplCros updater( | 356 NetworkConfigurationUpdaterImplCros updater( |
354 policy_service_.get(), | 357 policy_service_.get(), |
355 &network_library_, | 358 &network_library_, |
356 make_scoped_ptr<chromeos::CertificateHandler>(certificate_handler)); | 359 make_scoped_ptr<chromeos::onc::CertificateImporter>( |
| 360 certificate_importer)); |
357 updater.SetUserPolicyService(false, "hash", policy_service_.get()); | 361 updater.SetUserPolicyService(false, "hash", policy_service_.get()); |
358 Mock::VerifyAndClearExpectations(&network_library_); | 362 Mock::VerifyAndClearExpectations(&network_library_); |
359 Mock::VerifyAndClearExpectations(&certificate_handler); | 363 Mock::VerifyAndClearExpectations(&certificate_importer); |
360 | 364 |
361 // We should update if policy changes. | 365 // We should update if policy changes. |
362 EXPECT_CALL(network_library_, LoadOncNetworks( | 366 EXPECT_CALL(network_library_, LoadOncNetworks( |
363 IsEqualTo(fake_network_configs_.get()), NameToONCSource(GetParam()))); | 367 IsEqualTo(fake_network_configs_.get()), NameToONCSource(GetParam()))); |
364 EXPECT_CALL(*certificate_handler, ImportCertificates( | 368 EXPECT_CALL(*certificate_importer, ImportCertificates( |
365 IsEqualTo(fake_certificates_.get()), NameToONCSource(GetParam()), _)); | 369 IsEqualTo(fake_certificates_.get()), NameToONCSource(GetParam()), _)); |
366 | 370 |
367 // In the current implementation, we always apply both policies. | 371 // In the current implementation, we always apply both policies. |
368 EXPECT_CALL(network_library_, LoadOncNetworks( | 372 EXPECT_CALL(network_library_, LoadOncNetworks( |
369 IsEqualTo(empty_network_configs_.get()), | 373 IsEqualTo(empty_network_configs_.get()), |
370 Ne(NameToONCSource(GetParam())))); | 374 Ne(NameToONCSource(GetParam())))); |
371 EXPECT_CALL(*certificate_handler, ImportCertificates( | 375 EXPECT_CALL(*certificate_importer, ImportCertificates( |
372 IsEqualTo(empty_certificates_.get()), | 376 IsEqualTo(empty_certificates_.get()), |
373 Ne(NameToONCSource(GetParam())), | 377 Ne(NameToONCSource(GetParam())), |
374 _)); | 378 _)); |
375 | 379 |
376 PolicyMap policy; | 380 PolicyMap policy; |
377 policy.Set(GetParam(), POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 381 policy.Set(GetParam(), POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
378 Value::CreateStringValue(kFakeONC), NULL); | 382 Value::CreateStringValue(kFakeONC), NULL); |
379 UpdateProviderPolicy(policy); | 383 UpdateProviderPolicy(policy); |
380 Mock::VerifyAndClearExpectations(&network_library_); | 384 Mock::VerifyAndClearExpectations(&network_library_); |
381 Mock::VerifyAndClearExpectations(&certificate_handler); | 385 Mock::VerifyAndClearExpectations(&certificate_importer); |
382 | 386 |
383 // Another update is expected if the policy goes away. In the current | 387 // Another update is expected if the policy goes away. In the current |
384 // implementation, we always apply both policies. | 388 // implementation, we always apply both policies. |
385 EXPECT_CALL(network_library_, LoadOncNetworks( | 389 EXPECT_CALL(network_library_, LoadOncNetworks( |
386 IsEqualTo(empty_network_configs_.get()), | 390 IsEqualTo(empty_network_configs_.get()), |
387 onc::ONC_SOURCE_DEVICE_POLICY)); | 391 onc::ONC_SOURCE_DEVICE_POLICY)); |
388 EXPECT_CALL(*certificate_handler, ImportCertificates( | 392 EXPECT_CALL(*certificate_importer, ImportCertificates( |
389 IsEqualTo(empty_certificates_.get()), | 393 IsEqualTo(empty_certificates_.get()), |
390 onc::ONC_SOURCE_DEVICE_POLICY, | 394 onc::ONC_SOURCE_DEVICE_POLICY, |
391 _)); | 395 _)); |
392 | 396 |
393 EXPECT_CALL(network_library_, LoadOncNetworks( | 397 EXPECT_CALL(network_library_, LoadOncNetworks( |
394 IsEqualTo(empty_network_configs_.get()), | 398 IsEqualTo(empty_network_configs_.get()), |
395 onc::ONC_SOURCE_USER_POLICY)); | 399 onc::ONC_SOURCE_USER_POLICY)); |
396 EXPECT_CALL(*certificate_handler, ImportCertificates( | 400 EXPECT_CALL(*certificate_importer, ImportCertificates( |
397 IsEqualTo(empty_certificates_.get()), | 401 IsEqualTo(empty_certificates_.get()), |
398 onc::ONC_SOURCE_USER_POLICY, | 402 onc::ONC_SOURCE_USER_POLICY, |
399 _)); | 403 _)); |
400 | 404 |
401 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); | 405 EXPECT_CALL(network_library_, RemoveNetworkProfileObserver(_)); |
402 | 406 |
403 policy.Erase(GetParam()); | 407 policy.Erase(GetParam()); |
404 UpdateProviderPolicy(policy); | 408 UpdateProviderPolicy(policy); |
405 updater.UnsetUserPolicyService(); | 409 updater.UnsetUserPolicyService(); |
406 } | 410 } |
407 | 411 |
408 INSTANTIATE_TEST_CASE_P( | 412 INSTANTIATE_TEST_CASE_P( |
409 NetworkConfigurationUpdaterTestWithParamInstance, | 413 NetworkConfigurationUpdaterTestWithParamInstance, |
410 NetworkConfigurationUpdaterTestWithParam, | 414 NetworkConfigurationUpdaterTestWithParam, |
411 testing::Values(key::kDeviceOpenNetworkConfiguration, | 415 testing::Values(key::kDeviceOpenNetworkConfiguration, |
412 key::kOpenNetworkConfiguration)); | 416 key::kOpenNetworkConfiguration)); |
413 | 417 |
414 } // namespace policy | 418 } // namespace policy |
OLD | NEW |