| 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/device_cloud_policy_initializer.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/policy/enrollment_config.h" | 10 #include "chrome/browser/chromeos/policy/enrollment_config.h" |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 local_state_.SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); | 164 local_state_.SetBoolean(prefs::kDeviceEnrollmentAutoStart, true); |
| 165 statistics_provider_.SetMachineFlag( | 165 statistics_provider_.SetMachineFlag( |
| 166 chromeos::system::kOemIsEnterpriseManagedKey, true); | 166 chromeos::system::kOemIsEnterpriseManagedKey, true); |
| 167 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); | 167 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); |
| 168 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode); | 168 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode); |
| 169 EXPECT_TRUE(config.management_domain.empty()); | 169 EXPECT_TRUE(config.management_domain.empty()); |
| 170 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); | 170 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); |
| 171 | 171 |
| 172 // If the device is enterprise-managed, the management domain gets pulled from | 172 // If the device is enterprise-managed, the management domain gets pulled from |
| 173 // install attributes. | 173 // install attributes. |
| 174 install_attributes_.SetEnterprise("example.com", "fake-id"); | 174 install_attributes_.SetCloudManaged("example.com", "fake-id"); |
| 175 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); | 175 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); |
| 176 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode); | 176 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode); |
| 177 EXPECT_EQ("example.com", config.management_domain); | 177 EXPECT_EQ("example.com", config.management_domain); |
| 178 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); | 178 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); |
| 179 | 179 |
| 180 // If enrollment recovery is on, this is signaled in |config.mode|. | 180 // If enrollment recovery is on, this is signaled in |config.mode|. |
| 181 local_state_.SetBoolean(prefs::kEnrollmentRecoveryRequired, true); | 181 local_state_.SetBoolean(prefs::kEnrollmentRecoveryRequired, true); |
| 182 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); | 182 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); |
| 183 EXPECT_EQ(EnrollmentConfig::MODE_RECOVERY, config.mode); | 183 EXPECT_EQ(EnrollmentConfig::MODE_RECOVERY, config.mode); |
| 184 EXPECT_EQ("example.com", config.management_domain); | 184 EXPECT_EQ("example.com", config.management_domain); |
| 185 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); | 185 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); |
| 186 } | 186 } |
| 187 | 187 |
| 188 INSTANTIATE_TEST_CASE_P( | 188 INSTANTIATE_TEST_CASE_P( |
| 189 ZeroTouchFlag, | 189 ZeroTouchFlag, |
| 190 DeviceCloudPolicyInitializerTest, | 190 DeviceCloudPolicyInitializerTest, |
| 191 ::testing::Values( | 191 ::testing::Values( |
| 192 ZeroTouchParam(nullptr, // No flag set. | 192 ZeroTouchParam(nullptr, // No flag set. |
| 193 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE, | 193 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE, |
| 194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), | 194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), |
| 195 ZeroTouchParam("", // Flag set without a set value. | 195 ZeroTouchParam("", // Flag set without a set value. |
| 196 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE, | 196 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE, |
| 197 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), | 197 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), |
| 198 ZeroTouchParam("forced", | 198 ZeroTouchParam("forced", |
| 199 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION, | 199 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION, |
| 200 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); | 200 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); |
| 201 | 201 |
| 202 } // namespace policy | 202 } // namespace policy |
| OLD | NEW |