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

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

Issue 2403053003: Remove unused email from install attributes and add support for AD. (Closed)
Patch Set: Address Maksim's comments. Created 4 years, 2 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 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
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_.SetRegistrationUser("user@example.com"); 174 install_attributes_.SetEnterprise("example.com", "fake-id");
175 install_attributes_.SetDomain("example.com");
176 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); 175 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig();
177 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode); 176 EXPECT_EQ(EnrollmentConfig::MODE_NONE, config.mode);
178 EXPECT_EQ("example.com", config.management_domain); 177 EXPECT_EQ("example.com", config.management_domain);
179 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); 178 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism);
180 179
181 // If enrollment recovery is on, this is signaled in |config.mode|. 180 // If enrollment recovery is on, this is signaled in |config.mode|.
182 local_state_.SetBoolean(prefs::kEnrollmentRecoveryRequired, true); 181 local_state_.SetBoolean(prefs::kEnrollmentRecoveryRequired, true);
183 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig(); 182 config = device_cloud_policy_initializer_.GetPrescribedEnrollmentConfig();
184 EXPECT_EQ(EnrollmentConfig::MODE_RECOVERY, config.mode); 183 EXPECT_EQ(EnrollmentConfig::MODE_RECOVERY, config.mode);
185 EXPECT_EQ("example.com", config.management_domain); 184 EXPECT_EQ("example.com", config.management_domain);
186 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism); 185 EXPECT_EQ(GetParam().auth_mechanism_after_oobe, config.auth_mechanism);
187 } 186 }
188 187
189 INSTANTIATE_TEST_CASE_P( 188 INSTANTIATE_TEST_CASE_P(
190 ZeroTouchFlag, 189 ZeroTouchFlag,
191 DeviceCloudPolicyInitializerTest, 190 DeviceCloudPolicyInitializerTest,
192 ::testing::Values( 191 ::testing::Values(
193 ZeroTouchParam(nullptr, // No flag set. 192 ZeroTouchParam(nullptr, // No flag set.
194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE, 193 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE,
195 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), 194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE),
196 ZeroTouchParam("", // Flag set without a set value. 195 ZeroTouchParam("", // Flag set without a set value.
197 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE, 196 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE,
198 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), 197 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE),
199 ZeroTouchParam("forced", 198 ZeroTouchParam("forced",
200 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION, 199 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION,
201 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); 200 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION)));
202 201
203 } // namespace policy 202 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698