OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <utility> |
6 | 7 |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
9 #include "base/callback.h" | 10 #include "base/callback.h" |
10 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 12 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
14 #include "base/values.h" | 15 #include "base/values.h" |
15 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" | 16 #include "chrome/browser/chromeos/policy/device_network_configuration_updater.h" |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 UserNetworkConfigurationUpdater* updater = | 264 UserNetworkConfigurationUpdater* updater = |
264 UserNetworkConfigurationUpdater::CreateForUserPolicy( | 265 UserNetworkConfigurationUpdater::CreateForUserPolicy( |
265 &profile_, | 266 &profile_, |
266 allow_trusted_certs_from_policy, | 267 allow_trusted_certs_from_policy, |
267 fake_user_, | 268 fake_user_, |
268 policy_service_.get(), | 269 policy_service_.get(), |
269 &network_config_handler_).release(); | 270 &network_config_handler_).release(); |
270 if (set_cert_importer) { | 271 if (set_cert_importer) { |
271 EXPECT_TRUE(certificate_importer_owned_); | 272 EXPECT_TRUE(certificate_importer_owned_); |
272 updater->SetCertificateImporterForTest( | 273 updater->SetCertificateImporterForTest( |
273 certificate_importer_owned_.Pass()); | 274 std::move(certificate_importer_owned_)); |
274 } | 275 } |
275 network_configuration_updater_.reset(updater); | 276 network_configuration_updater_.reset(updater); |
276 return updater; | 277 return updater; |
277 } | 278 } |
278 | 279 |
279 void CreateNetworkConfigurationUpdaterForDevicePolicy() { | 280 void CreateNetworkConfigurationUpdaterForDevicePolicy() { |
280 network_configuration_updater_ = | 281 network_configuration_updater_ = |
281 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( | 282 DeviceNetworkConfigurationUpdater::CreateForDevicePolicy( |
282 policy_service_.get(), | 283 policy_service_.get(), |
283 &network_config_handler_, | 284 &network_config_handler_, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 false /* do not set certificate importer */); | 512 false /* do not set certificate importer */); |
512 MarkPolicyProviderInitialized(); | 513 MarkPolicyProviderInitialized(); |
513 | 514 |
514 Mock::VerifyAndClearExpectations(&network_config_handler_); | 515 Mock::VerifyAndClearExpectations(&network_config_handler_); |
515 EXPECT_EQ(0u, certificate_importer_->GetAndResetImportCount()); | 516 EXPECT_EQ(0u, certificate_importer_->GetAndResetImportCount()); |
516 | 517 |
517 certificate_importer_->SetExpectedONCCertificates(fake_certificates_); | 518 certificate_importer_->SetExpectedONCCertificates(fake_certificates_); |
518 certificate_importer_->SetExpectedONCSource(onc::ONC_SOURCE_USER_POLICY); | 519 certificate_importer_->SetExpectedONCSource(onc::ONC_SOURCE_USER_POLICY); |
519 | 520 |
520 ASSERT_TRUE(certificate_importer_owned_); | 521 ASSERT_TRUE(certificate_importer_owned_); |
521 updater->SetCertificateImporterForTest(certificate_importer_owned_.Pass()); | 522 updater->SetCertificateImporterForTest( |
| 523 std::move(certificate_importer_owned_)); |
522 EXPECT_EQ(1u, certificate_importer_->GetAndResetImportCount()); | 524 EXPECT_EQ(1u, certificate_importer_->GetAndResetImportCount()); |
523 } | 525 } |
524 | 526 |
525 class NetworkConfigurationUpdaterTestWithParam | 527 class NetworkConfigurationUpdaterTestWithParam |
526 : public NetworkConfigurationUpdaterTest, | 528 : public NetworkConfigurationUpdaterTest, |
527 public testing::WithParamInterface<const char*> { | 529 public testing::WithParamInterface<const char*> { |
528 protected: | 530 protected: |
529 // Returns the currently tested ONC source. | 531 // Returns the currently tested ONC source. |
530 onc::ONCSource CurrentONCSource() { | 532 onc::ONCSource CurrentONCSource() { |
531 if (GetParam() == key::kOpenNetworkConfiguration) | 533 if (GetParam() == key::kOpenNetworkConfiguration) |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 EXPECT_EQ(ExpectedImportCertificatesCallCount(), | 667 EXPECT_EQ(ExpectedImportCertificatesCallCount(), |
666 certificate_importer_->GetAndResetImportCount()); | 668 certificate_importer_->GetAndResetImportCount()); |
667 } | 669 } |
668 | 670 |
669 INSTANTIATE_TEST_CASE_P(NetworkConfigurationUpdaterTestWithParamInstance, | 671 INSTANTIATE_TEST_CASE_P(NetworkConfigurationUpdaterTestWithParamInstance, |
670 NetworkConfigurationUpdaterTestWithParam, | 672 NetworkConfigurationUpdaterTestWithParam, |
671 testing::Values(key::kDeviceOpenNetworkConfiguration, | 673 testing::Values(key::kDeviceOpenNetworkConfiguration, |
672 key::kOpenNetworkConfiguration)); | 674 key::kOpenNetworkConfiguration)); |
673 | 675 |
674 } // namespace policy | 676 } // namespace policy |
OLD | NEW |