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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc

Issue 2677563005: Chromad: Use DM server reply to determine enrollment type (Closed)
Patch Set: More comments Created 3 years, 10 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 "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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 chromeos::ScopedTestCrosSettings test_cros_settings_; 263 chromeos::ScopedTestCrosSettings test_cros_settings_;
264 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_; 264 chromeos::system::ScopedFakeStatisticsProvider fake_statistics_provider_;
265 chromeos::FakeSessionManagerClient fake_session_manager_client_; 265 chromeos::FakeSessionManagerClient fake_session_manager_client_;
266 chromeos::FakeCryptohomeClient* fake_cryptohome_client_; 266 chromeos::FakeCryptohomeClient* fake_cryptohome_client_;
267 ServerBackedStateKeysBroker state_keys_broker_; 267 ServerBackedStateKeysBroker state_keys_broker_;
268 268
269 DeviceCloudPolicyStoreChromeOS* store_; 269 DeviceCloudPolicyStoreChromeOS* store_;
270 SchemaRegistry schema_registry_; 270 SchemaRegistry schema_registry_;
271 std::unique_ptr<TestingDeviceCloudPolicyManagerChromeOS> manager_; 271 std::unique_ptr<TestingDeviceCloudPolicyManagerChromeOS> manager_;
272 std::unique_ptr<DeviceCloudPolicyInitializer> initializer_; 272 std::unique_ptr<DeviceCloudPolicyInitializer> initializer_;
273
273 private: 274 private:
274 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); 275 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest);
275 }; 276 };
276 277
277 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) { 278 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) {
278 owner_key_util_->Clear(); 279 owner_key_util_->Clear();
279 FlushDeviceSettings(); 280 FlushDeviceSettings();
280 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 281 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
281 282
282 manager_->Initialize(&local_state_); 283 manager_->Initialize(&local_state_);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 profile_.get()); 498 profile_.get());
498 ASSERT_TRUE(owner_settings_service); 499 ASSERT_TRUE(owner_settings_service);
499 500
500 EnrollmentConfig enrollment_config; 501 EnrollmentConfig enrollment_config;
501 enrollment_config.auth_mechanism = 502 enrollment_config.auth_mechanism =
502 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE; 503 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE;
503 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION 504 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION
504 : EnrollmentConfig::MODE_MANUAL; 505 : EnrollmentConfig::MODE_MANUAL;
505 std::string token = with_cert ? "" : "auth token"; 506 std::string token = with_cert ? "" : "auth token";
506 initializer_->StartEnrollment( 507 initializer_->StartEnrollment(
507 &device_management_service_, enrollment_config, token, 508 &device_management_service_, nullptr, enrollment_config, token,
508 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, 509 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done,
509 base::Unretained(this))); 510 base::Unretained(this)));
510 base::RunLoop().RunUntilIdle(); 511 base::RunLoop().RunUntilIdle();
511 Mock::VerifyAndClearExpectations(&device_management_service_); 512 Mock::VerifyAndClearExpectations(&device_management_service_);
512 AllowUninterestingRemoteCommandFetches(); 513 AllowUninterestingRemoteCommandFetches();
513 514
514 if (done_) 515 if (done_)
515 return; 516 return;
516 517
517 // Process registration. 518 // Process registration.
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 DeviceCloudPolicyManagerChromeOSEnrollmentTest, 822 DeviceCloudPolicyManagerChromeOSEnrollmentTest,
822 ::testing::Values(false, true)); 823 ::testing::Values(false, true));
823 824
824 INSTANTIATE_TEST_CASE_P( 825 INSTANTIATE_TEST_CASE_P(
825 Cert, 826 Cert,
826 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, 827 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest,
827 ::testing::Values(false, true)); 828 ::testing::Values(false, true));
828 829
829 } // namespace 830 } // namespace
830 } // namespace policy 831 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698