| 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" |
| 11 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" | 11 #include "chrome/browser/chromeos/policy/server_backed_device_state.h" |
| 12 #include "chrome/browser/chromeos/policy/stub_enterprise_install_attributes.h" | 12 #include "chrome/browser/chromeos/settings/stub_install_attributes.h" |
| 13 #include "chrome/browser/prefs/browser_prefs.h" | 13 #include "chrome/browser/prefs/browser_prefs.h" |
| 14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
| 15 #include "chromeos/attestation/mock_attestation_flow.h" | 15 #include "chromeos/attestation/mock_attestation_flow.h" |
| 16 #include "chromeos/chromeos_switches.h" | 16 #include "chromeos/chromeos_switches.h" |
| 17 #include "chromeos/system/fake_statistics_provider.h" | 17 #include "chromeos/system/fake_statistics_provider.h" |
| 18 #include "chromeos/system/statistics_provider.h" | 18 #include "chromeos/system/statistics_provider.h" |
| 19 #include "components/prefs/testing_pref_service.h" | 19 #include "components/prefs/testing_pref_service.h" |
| 20 #include "testing/gtest/include/gtest/gtest.h" | 20 #include "testing/gtest/include/gtest/gtest.h" |
| 21 | 21 |
| 22 namespace policy { | 22 namespace policy { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 49 nullptr, | 49 nullptr, |
| 50 base::MakeUnique<chromeos::attestation::MockAttestationFlow>()) { | 50 base::MakeUnique<chromeos::attestation::MockAttestationFlow>()) { |
| 51 chrome::RegisterLocalState(local_state_.registry()); | 51 chrome::RegisterLocalState(local_state_.registry()); |
| 52 statistics_provider_.SetMachineStatistic("serial_number", "fake-serial"); | 52 statistics_provider_.SetMachineStatistic("serial_number", "fake-serial"); |
| 53 } | 53 } |
| 54 | 54 |
| 55 void SetupZeroTouchFlag(); | 55 void SetupZeroTouchFlag(); |
| 56 | 56 |
| 57 chromeos::system::ScopedFakeStatisticsProvider statistics_provider_; | 57 chromeos::system::ScopedFakeStatisticsProvider statistics_provider_; |
| 58 TestingPrefServiceSimple local_state_; | 58 TestingPrefServiceSimple local_state_; |
| 59 StubEnterpriseInstallAttributes install_attributes_; | 59 chromeos::StubInstallAttributes install_attributes_; |
| 60 DeviceCloudPolicyInitializer device_cloud_policy_initializer_; | 60 DeviceCloudPolicyInitializer device_cloud_policy_initializer_; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 void DeviceCloudPolicyInitializerTest::SetupZeroTouchFlag() { | 63 void DeviceCloudPolicyInitializerTest::SetupZeroTouchFlag() { |
| 64 const ZeroTouchParam& param = GetParam(); | 64 const ZeroTouchParam& param = GetParam(); |
| 65 if (param.enable_zero_touch_flag != nullptr) { | 65 if (param.enable_zero_touch_flag != nullptr) { |
| 66 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 66 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 67 chromeos::switches::kEnterpriseEnableZeroTouchEnrollment, | 67 chromeos::switches::kEnterpriseEnableZeroTouchEnrollment, |
| 68 param.enable_zero_touch_flag); | 68 param.enable_zero_touch_flag); |
| 69 } | 69 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE, | 190 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE, |
| 191 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), | 191 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), |
| 192 ZeroTouchParam("", // Flag set without a set value. | 192 ZeroTouchParam("", // Flag set without a set value. |
| 193 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE, | 193 EnrollmentConfig::AUTH_MECHANISM_BEST_AVAILABLE, |
| 194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), | 194 EnrollmentConfig::AUTH_MECHANISM_INTERACTIVE), |
| 195 ZeroTouchParam("forced", | 195 ZeroTouchParam("forced", |
| 196 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION, | 196 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION, |
| 197 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); | 197 EnrollmentConfig::AUTH_MECHANISM_ATTESTATION))); |
| 198 | 198 |
| 199 } // namespace policy | 199 } // namespace policy |
| OLD | NEW |