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

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

Issue 2329303002: Delete obsolete AllowedDeviceModes enrollment parameter. (Closed)
Patch Set: Fix tests. Created 4 years, 3 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 421
422 // Set up test data. 422 // Set up test data.
423 device_policy_.SetDefaultNewSigningKey(); 423 device_policy_.SetDefaultNewSigningKey();
424 device_policy_.policy_data().set_timestamp( 424 device_policy_.policy_data().set_timestamp(
425 (base::Time::NowFromSystemTime() - 425 (base::Time::NowFromSystemTime() -
426 base::Time::UnixEpoch()).InMilliseconds()); 426 base::Time::UnixEpoch()).InMilliseconds());
427 device_policy_.Build(); 427 device_policy_.Build();
428 428
429 register_response_.mutable_register_response()->set_device_management_token( 429 register_response_.mutable_register_response()->set_device_management_token(
430 PolicyBuilder::kFakeToken); 430 PolicyBuilder::kFakeToken);
431 register_response_.mutable_register_response()->set_enrollment_type(
432 em::DeviceRegisterResponse::ENTERPRISE);
431 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom( 433 policy_fetch_response_.mutable_policy_response()->add_response()->CopyFrom(
432 device_policy_.policy()); 434 device_policy_.policy());
433 robot_auth_fetch_response_.mutable_service_api_access_response() 435 robot_auth_fetch_response_.mutable_service_api_access_response()
434 ->set_auth_code("auth_code_for_test"); 436 ->set_auth_code("auth_code_for_test");
435 loaded_blob_ = device_policy_.GetBlob(); 437 loaded_blob_ = device_policy_.GetBlob();
436 438
437 // Initialize the manager. 439 // Initialize the manager.
438 FlushDeviceSettings(); 440 FlushDeviceSettings();
439 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status()); 441 EXPECT_EQ(CloudPolicyStore::STATUS_BAD_STATE, store_->status());
440 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME)); 442 EXPECT_TRUE(manager_->IsInitializationComplete(POLICY_DOMAIN_CHROME));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 _)) 476 _))
475 .Times(AtMost(1)) 477 .Times(AtMost(1))
476 .WillOnce(device_management_service_.CreateAsyncJob(&register_job)); 478 .WillOnce(device_management_service_.CreateAsyncJob(&register_job));
477 EXPECT_CALL(device_management_service_, 479 EXPECT_CALL(device_management_service_,
478 StartJob(with_cert ? dm_protocol::kValueRequestCertBasedRegister 480 StartJob(with_cert ? dm_protocol::kValueRequestCertBasedRegister
479 : dm_protocol::kValueRequestRegister, 481 : dm_protocol::kValueRequestRegister,
480 _, _, _, _, _)) 482 _, _, _, _, _))
481 .Times(AtMost(1)) 483 .Times(AtMost(1))
482 .WillOnce( 484 .WillOnce(
483 DoAll(SaveArg<4>(&client_id_), SaveArg<5>(&register_request_))); 485 DoAll(SaveArg<4>(&client_id_), SaveArg<5>(&register_request_)));
484 DeviceCloudPolicyInitializer::AllowedDeviceModes modes;
485 modes[DEVICE_MODE_ENTERPRISE] = true;
486 486
487 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service = 487 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service =
488 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext( 488 chromeos::OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(
489 profile_.get()); 489 profile_.get());
490 ASSERT_TRUE(owner_settings_service); 490 ASSERT_TRUE(owner_settings_service);
491 491
492 EnrollmentConfig enrollment_config; 492 EnrollmentConfig enrollment_config;
493 enrollment_config.auth_mechanism = 493 enrollment_config.auth_mechanism =
494 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE; 494 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE;
495 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION 495 enrollment_config.mode = with_cert ? EnrollmentConfig::MODE_ATTESTATION
496 : EnrollmentConfig::MODE_MANUAL; 496 : EnrollmentConfig::MODE_MANUAL;
497 std::string token = with_cert ? "" : "auth token"; 497 std::string token = with_cert ? "" : "auth token";
498 initializer_->StartEnrollment( 498 initializer_->StartEnrollment(
499 &device_management_service_, enrollment_config, token, modes, 499 &device_management_service_, enrollment_config, token,
500 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done, 500 base::Bind(&DeviceCloudPolicyManagerChromeOSEnrollmentTest::Done,
501 base::Unretained(this))); 501 base::Unretained(this)));
502 base::RunLoop().RunUntilIdle(); 502 base::RunLoop().RunUntilIdle();
503 Mock::VerifyAndClearExpectations(&device_management_service_); 503 Mock::VerifyAndClearExpectations(&device_management_service_);
504 AllowUninterestingRemoteCommandFetches(); 504 AllowUninterestingRemoteCommandFetches();
505 505
506 if (done_) 506 if (done_)
507 return; 507 return;
508 508
509 // Process registration. 509 // Process registration.
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
793 DeviceCloudPolicyManagerChromeOSEnrollmentTest, 793 DeviceCloudPolicyManagerChromeOSEnrollmentTest,
794 ::testing::Values(false, true)); 794 ::testing::Values(false, true));
795 795
796 INSTANTIATE_TEST_CASE_P( 796 INSTANTIATE_TEST_CASE_P(
797 Cert, 797 Cert,
798 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, 798 DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest,
799 ::testing::Values(false, true)); 799 ::testing::Values(false, true));
800 800
801 } // namespace 801 } // namespace
802 } // namespace policy 802 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698