OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/consumer_unenrollment_handler.h" | 5 #include "chrome/browser/chromeos/policy/consumer_unenrollment_handler.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 base::Bind(&ConsumerUnenrollmentHandlerTest::OnManagementSettingsSet, | 71 base::Bind(&ConsumerUnenrollmentHandlerTest::OnManagementSettingsSet, |
72 base::Unretained(this))); | 72 base::Unretained(this))); |
73 } | 73 } |
74 | 74 |
75 void OnManagementSettingsSet(bool success) { | 75 void OnManagementSettingsSet(bool success) { |
76 EXPECT_TRUE(success); | 76 EXPECT_TRUE(success); |
77 } | 77 } |
78 | 78 |
79 void RunUnenrollment() { | 79 void RunUnenrollment() { |
80 handler_.reset(new ConsumerUnenrollmentHandler( | 80 handler_.reset(new ConsumerUnenrollmentHandler( |
81 &device_settings_service_, | 81 fake_service_.get(), fake_manager_.get(), |
82 fake_service_.get(), | |
83 fake_manager_.get(), | |
84 fake_owner_settings_service_.get())); | 82 fake_owner_settings_service_.get())); |
85 handler_->Start(); | 83 handler_->Start(); |
86 FlushDeviceSettings(); | 84 FlushDeviceSettings(); |
87 } | 85 } |
88 | 86 |
89 std::unique_ptr<FakeConsumerManagementService> fake_service_; | 87 std::unique_ptr<FakeConsumerManagementService> fake_service_; |
90 std::unique_ptr<chromeos::FakeCryptohomeClient> fake_cryptohome_client_; | 88 std::unique_ptr<chromeos::FakeCryptohomeClient> fake_cryptohome_client_; |
91 std::unique_ptr<EnterpriseInstallAttributes> install_attributes_; | 89 std::unique_ptr<EnterpriseInstallAttributes> install_attributes_; |
92 std::unique_ptr<FakeDeviceCloudPolicyManager> fake_manager_; | 90 std::unique_ptr<FakeDeviceCloudPolicyManager> fake_manager_; |
93 std::unique_ptr<chromeos::FakeOwnerSettingsService> | 91 std::unique_ptr<chromeos::FakeOwnerSettingsService> |
(...skipping 26 matching lines...) Expand all Loading... |
120 EXPECT_EQ(ConsumerManagementStage::UnenrollmentDMServerFailed(), | 118 EXPECT_EQ(ConsumerManagementStage::UnenrollmentDMServerFailed(), |
121 fake_service_->GetStage()); | 119 fake_service_->GetStage()); |
122 const chromeos::OwnerSettingsServiceChromeOS::ManagementSettings& settings = | 120 const chromeos::OwnerSettingsServiceChromeOS::ManagementSettings& settings = |
123 fake_owner_settings_service_->last_settings(); | 121 fake_owner_settings_service_->last_settings(); |
124 EXPECT_EQ(policy::MANAGEMENT_MODE_CONSUMER_MANAGED, settings.management_mode); | 122 EXPECT_EQ(policy::MANAGEMENT_MODE_CONSUMER_MANAGED, settings.management_mode); |
125 EXPECT_EQ("fake_request_token", settings.request_token); | 123 EXPECT_EQ("fake_request_token", settings.request_token); |
126 EXPECT_EQ("fake_device_id", settings.device_id); | 124 EXPECT_EQ("fake_device_id", settings.device_id); |
127 } | 125 } |
128 | 126 |
129 } // namespace policy | 127 } // namespace policy |
OLD | NEW |