| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" | 23 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" |
| 24 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" | 24 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h
" |
| 25 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 25 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 26 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" | 26 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 27 #include "chrome/browser/prefs/browser_prefs.h" | 27 #include "chrome/browser/prefs/browser_prefs.h" |
| 28 #include "chrome/test/base/testing_browser_process.h" | 28 #include "chrome/test/base/testing_browser_process.h" |
| 29 #include "chromeos/cryptohome/system_salt_getter.h" | 29 #include "chromeos/cryptohome/system_salt_getter.h" |
| 30 #include "chromeos/dbus/dbus_client_implementation_type.h" | 30 #include "chromeos/dbus/dbus_client_implementation_type.h" |
| 31 #include "chromeos/dbus/dbus_thread_manager.h" | 31 #include "chromeos/dbus/dbus_thread_manager.h" |
| 32 #include "chromeos/dbus/fake_cryptohome_client.h" | 32 #include "chromeos/dbus/fake_cryptohome_client.h" |
| 33 #include "chromeos/dbus/fake_dbus_thread_manager.h" | |
| 34 #include "chromeos/dbus/fake_session_manager_client.h" | 33 #include "chromeos/dbus/fake_session_manager_client.h" |
| 35 #include "chromeos/system/mock_statistics_provider.h" | 34 #include "chromeos/system/mock_statistics_provider.h" |
| 36 #include "chromeos/system/statistics_provider.h" | 35 #include "chromeos/system/statistics_provider.h" |
| 37 #include "components/policy/core/common/cloud/cloud_policy_client.h" | 36 #include "components/policy/core/common/cloud/cloud_policy_client.h" |
| 38 #include "components/policy/core/common/cloud/mock_device_management_service.h" | 37 #include "components/policy/core/common/cloud/mock_device_management_service.h" |
| 39 #include "components/policy/core/common/external_data_fetcher.h" | 38 #include "components/policy/core/common/external_data_fetcher.h" |
| 40 #include "components/policy/core/common/schema_registry.h" | 39 #include "components/policy/core/common/schema_registry.h" |
| 41 #include "google_apis/gaia/gaia_oauth_client.h" | 40 #include "google_apis/gaia/gaia_oauth_client.h" |
| 42 #include "net/url_request/test_url_fetcher_factory.h" | 41 #include "net/url_request/test_url_fetcher_factory.h" |
| 43 #include "net/url_request/url_request_test_util.h" | 42 #include "net/url_request/url_request_test_util.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 GetMachineStatistic("serial_number", _)) | 81 GetMachineStatistic("serial_number", _)) |
| 83 .WillRepeatedly(DoAll(SetArgumentPointee<1>(std::string("test_sn")), | 82 .WillRepeatedly(DoAll(SetArgumentPointee<1>(std::string("test_sn")), |
| 84 Return(true))); | 83 Return(true))); |
| 85 chromeos::system::StatisticsProvider::SetTestProvider( | 84 chromeos::system::StatisticsProvider::SetTestProvider( |
| 86 &mock_statistics_provider_); | 85 &mock_statistics_provider_); |
| 87 std::vector<std::string> state_keys; | 86 std::vector<std::string> state_keys; |
| 88 state_keys.push_back("1"); | 87 state_keys.push_back("1"); |
| 89 state_keys.push_back("2"); | 88 state_keys.push_back("2"); |
| 90 state_keys.push_back("3"); | 89 state_keys.push_back("3"); |
| 91 fake_session_manager_client_.set_server_backed_state_keys(state_keys); | 90 fake_session_manager_client_.set_server_backed_state_keys(state_keys); |
| 92 fake_dbus_thread_manager_->SetCryptohomeClient( | |
| 93 scoped_ptr<chromeos::CryptohomeClient>(fake_cryptohome_client_)); | |
| 94 } | 91 } |
| 95 | 92 |
| 96 virtual ~DeviceCloudPolicyManagerChromeOSTest() { | 93 virtual ~DeviceCloudPolicyManagerChromeOSTest() { |
| 97 chromeos::system::StatisticsProvider::SetTestProvider(NULL); | 94 chromeos::system::StatisticsProvider::SetTestProvider(NULL); |
| 98 } | 95 } |
| 99 | 96 |
| 100 virtual void SetUp() OVERRIDE { | 97 virtual void SetUp() OVERRIDE { |
| 101 DeviceSettingsTestBase::SetUp(); | 98 DeviceSettingsTestBase::SetUp(); |
| 99 dbus_helper_->SetCryptohomeClient( |
| 100 scoped_ptr<chromeos::CryptohomeClient>(fake_cryptohome_client_)); |
| 102 | 101 |
| 103 install_attributes_.reset( | 102 install_attributes_.reset( |
| 104 new EnterpriseInstallAttributes(fake_cryptohome_client_)); | 103 new EnterpriseInstallAttributes(fake_cryptohome_client_)); |
| 105 store_ = | 104 store_ = |
| 106 new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, | 105 new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, |
| 107 install_attributes_.get(), | 106 install_attributes_.get(), |
| 108 base::MessageLoopProxy::current()); | 107 base::MessageLoopProxy::current()); |
| 109 manager_.reset(new DeviceCloudPolicyManagerChromeOS( | 108 manager_.reset(new DeviceCloudPolicyManagerChromeOS( |
| 110 make_scoped_ptr(store_), | 109 make_scoped_ptr(store_), |
| 111 base::MessageLoopProxy::current(), | 110 base::MessageLoopProxy::current(), |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 | 619 |
| 621 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, | 620 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentBlankSystemSaltTest, |
| 622 RobotRefreshSaveFailed) { | 621 RobotRefreshSaveFailed) { |
| 623 // Without the system salt, the robot token can't be stored. | 622 // Without the system salt, the robot token can't be stored. |
| 624 RunTest(); | 623 RunTest(); |
| 625 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); | 624 ExpectFailedEnrollment(EnrollmentStatus::STATUS_ROBOT_REFRESH_STORE_FAILED); |
| 626 } | 625 } |
| 627 | 626 |
| 628 } // namespace | 627 } // namespace |
| 629 } // namespace policy | 628 } // namespace policy |
| OLD | NEW |