OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_manager_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 state_keys.push_back("1"); | 87 state_keys.push_back("1"); |
88 state_keys.push_back("2"); | 88 state_keys.push_back("2"); |
89 state_keys.push_back("3"); | 89 state_keys.push_back("3"); |
90 fake_session_manager_client_.set_server_backed_state_keys(state_keys); | 90 fake_session_manager_client_.set_server_backed_state_keys(state_keys); |
91 } | 91 } |
92 | 92 |
93 virtual ~DeviceCloudPolicyManagerChromeOSTest() { | 93 virtual ~DeviceCloudPolicyManagerChromeOSTest() { |
94 chromeos::system::StatisticsProvider::SetTestProvider(NULL); | 94 chromeos::system::StatisticsProvider::SetTestProvider(NULL); |
95 } | 95 } |
96 | 96 |
97 virtual void SetUp() OVERRIDE { | 97 virtual void SetUp() override { |
98 DeviceSettingsTestBase::SetUp(); | 98 DeviceSettingsTestBase::SetUp(); |
99 dbus_setter_->SetCryptohomeClient( | 99 dbus_setter_->SetCryptohomeClient( |
100 scoped_ptr<chromeos::CryptohomeClient>(fake_cryptohome_client_)); | 100 scoped_ptr<chromeos::CryptohomeClient>(fake_cryptohome_client_)); |
101 | 101 |
102 install_attributes_.reset( | 102 install_attributes_.reset( |
103 new EnterpriseInstallAttributes(fake_cryptohome_client_)); | 103 new EnterpriseInstallAttributes(fake_cryptohome_client_)); |
104 store_ = | 104 store_ = |
105 new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, | 105 new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, |
106 install_attributes_.get(), | 106 install_attributes_.get(), |
107 base::MessageLoopProxy::current()); | 107 base::MessageLoopProxy::current()); |
(...skipping 15 matching lines...) Expand all Loading... |
123 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 123 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
124 // SystemSaltGetter is used in DeviceOAuth2TokenService. | 124 // SystemSaltGetter is used in DeviceOAuth2TokenService. |
125 chromeos::SystemSaltGetter::Initialize(); | 125 chromeos::SystemSaltGetter::Initialize(); |
126 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); | 126 chromeos::DeviceOAuth2TokenServiceFactory::Initialize(); |
127 url_fetcher_response_code_ = 200; | 127 url_fetcher_response_code_ = 200; |
128 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," | 128 url_fetcher_response_string_ = "{\"access_token\":\"accessToken4Test\"," |
129 "\"expires_in\":1234," | 129 "\"expires_in\":1234," |
130 "\"refresh_token\":\"refreshToken4Test\"}"; | 130 "\"refresh_token\":\"refreshToken4Test\"}"; |
131 } | 131 } |
132 | 132 |
133 virtual void TearDown() OVERRIDE { | 133 virtual void TearDown() override { |
134 manager_->Shutdown(); | 134 manager_->Shutdown(); |
135 if (initializer_) | 135 if (initializer_) |
136 initializer_->Shutdown(); | 136 initializer_->Shutdown(); |
137 DeviceSettingsTestBase::TearDown(); | 137 DeviceSettingsTestBase::TearDown(); |
138 | 138 |
139 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); | 139 chromeos::DeviceOAuth2TokenServiceFactory::Shutdown(); |
140 chromeos::SystemSaltGetter::Shutdown(); | 140 chromeos::SystemSaltGetter::Shutdown(); |
141 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 141 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
142 } | 142 } |
143 | 143 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 DeviceCloudPolicyManagerChromeOSEnrollmentTest() | 302 DeviceCloudPolicyManagerChromeOSEnrollmentTest() |
303 : is_auto_enrollment_(false), | 303 : is_auto_enrollment_(false), |
304 management_mode_(em::PolicyData::ENTERPRISE_MANAGED), | 304 management_mode_(em::PolicyData::ENTERPRISE_MANAGED), |
305 register_status_(DM_STATUS_SUCCESS), | 305 register_status_(DM_STATUS_SUCCESS), |
306 policy_fetch_status_(DM_STATUS_SUCCESS), | 306 policy_fetch_status_(DM_STATUS_SUCCESS), |
307 robot_auth_fetch_status_(DM_STATUS_SUCCESS), | 307 robot_auth_fetch_status_(DM_STATUS_SUCCESS), |
308 store_result_(true), | 308 store_result_(true), |
309 status_(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS)), | 309 status_(EnrollmentStatus::ForStatus(EnrollmentStatus::STATUS_SUCCESS)), |
310 done_(false) {} | 310 done_(false) {} |
311 | 311 |
312 virtual void SetUp() OVERRIDE { | 312 virtual void SetUp() override { |
313 DeviceCloudPolicyManagerChromeOSTest::SetUp(); | 313 DeviceCloudPolicyManagerChromeOSTest::SetUp(); |
314 | 314 |
315 // Set up test data. | 315 // Set up test data. |
316 device_policy_.SetDefaultNewSigningKey(); | 316 device_policy_.SetDefaultNewSigningKey(); |
317 device_policy_.policy_data().set_timestamp( | 317 device_policy_.policy_data().set_timestamp( |
318 (base::Time::NowFromSystemTime() - | 318 (base::Time::NowFromSystemTime() - |
319 base::Time::UnixEpoch()).InMilliseconds()); | 319 base::Time::UnixEpoch()).InMilliseconds()); |
320 device_policy_.Build(); | 320 device_policy_.Build(); |
321 | 321 |
322 register_response_.mutable_register_response()->set_device_management_token( | 322 register_response_.mutable_register_response()->set_device_management_token( |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 | 620 |
621 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, | 621 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, |
622 RobotRefreshSaveFailed) { | 622 RobotRefreshSaveFailed) { |
623 // Without the system salt, the robot token can't be stored. | 623 // Without the system salt, the robot token can't be stored. |
624 RunTest(); | 624 RunTest(); |
625 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); | 625 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); |
626 } | 626 } |
627 | 627 |
628 } // namespace | 628 } // namespace |
629 } // namespace policy | 629 } // namespace policy |
OLD | NEW |