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

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

Issue 2276593004: Device registration using an enrollment certificate from the PCA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed constant. 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 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/values.h" 9 #include "base/values.h"
9 #include "chrome/browser/chromeos/policy/enrollment_config.h" 10 #include "chrome/browser/chromeos/policy/enrollment_config.h"
10 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" 11 #include "chrome/browser/chromeos/policy/server_backed_device_state.h"
11 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" 12 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h"
12 #include "chrome/browser/prefs/browser_prefs.h" 13 #include "chrome/browser/prefs/browser_prefs.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chromeos/attestation/mock_attestation_flow.h"
14 #include "chromeos/chromeos_switches.h" 16 #include "chromeos/chromeos_switches.h"
15 #include "chromeos/system/fake_statistics_provider.h" 17 #include "chromeos/system/fake_statistics_provider.h"
16 #include "chromeos/system/statistics_provider.h" 18 #include "chromeos/system/statistics_provider.h"
17 #include "components/prefs/testing_pref_service.h" 19 #include "components/prefs/testing_pref_service.h"
18 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
19 21
20 namespace policy { 22 namespace policy {
21 23
22 struct ZeroTouchParam { 24 struct ZeroTouchParam {
23 const char* enable_zero_touch_flag; 25 const char* enable_zero_touch_flag;
24 EnrollmentConfig::AuthMechanism auth_mechanism; 26 EnrollmentConfig::AuthMechanism auth_mechanism;
25 27
26 ZeroTouchParam(const char* flag, EnrollmentConfig::AuthMechanism auth) 28 ZeroTouchParam(const char* flag, EnrollmentConfig::AuthMechanism auth)
27 : enable_zero_touch_flag(flag), auth_mechanism(auth) {} 29 : enable_zero_touch_flag(flag), auth_mechanism(auth) {}
28 }; 30 };
29 31
30 class DeviceCloudPolicyInitializerTest 32 class DeviceCloudPolicyInitializerTest
31 : public testing::TestWithParam<ZeroTouchParam> { 33 : public testing::TestWithParam<ZeroTouchParam> {
32 protected: 34 protected:
33 DeviceCloudPolicyInitializerTest() 35 DeviceCloudPolicyInitializerTest()
34 : device_cloud_policy_initializer_(&local_state_, 36 : device_cloud_policy_initializer_(
35 nullptr, 37 &local_state_,
36 nullptr, 38 nullptr,
37 &install_attributes_, 39 nullptr,
38 nullptr, 40 &install_attributes_,
39 nullptr, 41 nullptr,
40 nullptr, 42 nullptr,
41 nullptr, 43 nullptr,
42 nullptr) { 44 nullptr,
45 base::MakeUnique<chromeos::attestation::MockAttestationFlow>()) {
43 chrome::RegisterLocalState(local_state_.registry()); 46 chrome::RegisterLocalState(local_state_.registry());
44 statistics_provider_.SetMachineStatistic("serial_number", "fake-serial"); 47 statistics_provider_.SetMachineStatistic("serial_number", "fake-serial");
45 } 48 }
46 49
47 void SetupZeroTouchFlag(); 50 void SetupZeroTouchFlag();
48 51
49 chromeos::system::ScopedFakeStatisticsProvider statistics_provider_; 52 chromeos::system::ScopedFakeStatisticsProvider statistics_provider_;
50 TestingPrefServiceSimple local_state_; 53 TestingPrefServiceSimple local_state_;
51 StubEnterpriseInstallAttributes install_attributes_; 54 StubEnterpriseInstallAttributes install_attributes_;
52 DeviceCloudPolicyInitializer device_cloud_policy_initializer_; 55 DeviceCloudPolicyInitializer device_cloud_policy_initializer_;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 DeviceCloudPolicyInitializerTest, 182 DeviceCloudPolicyInitializerTest,
180 ::testing::Values( 183 ::testing::Values(
181 ZeroTouchParam(nullptr, // No flag set. 184 ZeroTouchParam(nullptr, // No flag set.
182 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), 185 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE),
183 ZeroTouchParam("", // Flag set without a set value. 186 ZeroTouchParam("", // Flag set without a set value.
184 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE), 187 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE),
185 ZeroTouchParam("forced", 188 ZeroTouchParam("forced",
186 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); 189 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION)));
187 190
188 } // namespace policy 191 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698