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/device_cloud_policy_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 _)) | 474 _)) |
475 .Times(AtMost(1)) | 475 .Times(AtMost(1)) |
476 .WillOnce(device_management_service_.CreateAsyncJob(®ister_job)); | 476 .WillOnce(device_management_service_.CreateAsyncJob(®ister_job)); |
477 EXPECT_CALL(device_management_service_, | 477 EXPECT_CALL(device_management_service_, |
478 StartJob(with_cert ? dm_protocol::kValueRequestCertBasedRegister | 478 StartJob(with_cert ? dm_protocol::kValueRequestCertBasedRegister |
479 : dm_protocol::kValueRequestRegister, | 479 : dm_protocol::kValueRequestRegister, |
480 _, _, _, _, _)) | 480 _, _, _, _, _)) |
481 .Times(AtMost(1)) | 481 .Times(AtMost(1)) |
482 .WillOnce( | 482 .WillOnce( |
483 DoAll(SaveArg<4>(&client_id_), SaveArg<5>(®ister_request_))); | 483 DoAll(SaveArg<4>(&client_id_), SaveArg<5>(®ister_request_))); |
484 DeviceCloudPolicyInitializer::AllowedDeviceModes modes; | |
485 modes[DEVICE_MODE_ENTERPRISE] = true; | |
486 | 484 |
487 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service = | 485 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service = |
488 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( | 486 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( |
489 profile_.get()); | 487 profile_.get()); |
490 ASSERT_TRUE(owner_settings_service); | 488 ASSERT_TRUE(owner_settings_service); |
491 | 489 |
492 EnrollmentConfig enrollment_config; | 490 EnrollmentConfig enrollment_config; |
493 enrollment_config.auth_mechanism = | 491 enrollment_config.auth_mechanism = |
494 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE; | 492 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE; |
495 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION | 493 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION |
496 : EnrollmentConfig::MODE_MANUAL; | 494 : EnrollmentConfig::MODE_MANUAL; |
497 std::string token = with_cert ? "" : "auth token"; | 495 std::string token = with_cert ? "" : "auth token"; |
498 initializer_->StartEnrollment( | 496 initializer_->StartEnrollment( |
499 &device_management_service_, enrollment_config, token, modes, | 497 &device_management_service_, enrollment_config, token, |
500 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, | 498 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, |
501 base::Unretained(this))); | 499 base::Unretained(this))); |
502 base::RunLoop().RunUntilIdle(); | 500 base::RunLoop().RunUntilIdle(); |
503 Mock::VerifyAndClearExpectations(&device_management_service_); | 501 Mock::VerifyAndClearExpectations(&device_management_service_); |
504 AllowUninterestingRemoteCommandFetches(); | 502 AllowUninterestingRemoteCommandFetches(); |
505 | 503 |
506 if (done_) | 504 if (done_) |
507 return; | 505 return; |
508 | 506 |
509 // Process registration. | 507 // Process registration. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 DeviceCloudPolicyManagerChromeOSEnrollmentTest, | 791 DeviceCloudPolicyManagerChromeOSEnrollmentTest, |
794 ::testing::Values(false, true)); | 792 ::testing::Values(false, true)); |
795 | 793 |
796 INSTANTIATE_TEST_CASE_P( | 794 INSTANTIATE_TEST_CASE_P( |
797 Cert, | 795 Cert, |
798 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, | 796 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, |
799 ::testing::Values(false, true)); | 797 ::testing::Values(false, true)); |
800 | 798 |
801 } // namespace | 799 } // namespace |
802 } // namespace policy | 800 } // namespace policy |
OLD | NEW |