| 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/settings/device_settings_test_helper.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.h" |
| 10 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" | 10 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" |
| 11 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" | 11 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos_fact
ory.h" |
| 12 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 12 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
| 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 13 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 14 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 15 #include "chrome/test/base/testing_browser_process.h" | 15 #include "chrome/test/base/testing_browser_process.h" |
| 16 #include "chrome/test/base/testing_profile.h" | 16 #include "chrome/test/base/testing_profile.h" |
| 17 #include "chromeos/cryptohome/cryptohome_parameters.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "components/ownership/mock_owner_key_util.h" | 19 #include "components/ownership/mock_owner_key_util.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/test/test_utils.h" | 21 #include "content/public/test/test_utils.h" |
| 21 | 22 |
| 22 namespace chromeos { | 23 namespace chromeos { |
| 23 | 24 |
| 24 DeviceSettingsTestHelper::DeviceSettingsTestHelper() {} | 25 DeviceSettingsTestHelper::DeviceSettingsTestHelper() {} |
| 25 | 26 |
| 26 DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {} | 27 DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {} |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 return false; | 105 return false; |
| 105 } | 106 } |
| 106 | 107 |
| 107 bool DeviceSettingsTestHelper::IsScreenLocked() const { return false; } | 108 bool DeviceSettingsTestHelper::IsScreenLocked() const { return false; } |
| 108 | 109 |
| 109 void DeviceSettingsTestHelper::EmitLoginPromptVisible() {} | 110 void DeviceSettingsTestHelper::EmitLoginPromptVisible() {} |
| 110 | 111 |
| 111 void DeviceSettingsTestHelper::RestartJob( | 112 void DeviceSettingsTestHelper::RestartJob( |
| 112 const std::vector<std::string>& argv) {} | 113 const std::vector<std::string>& argv) {} |
| 113 | 114 |
| 114 void DeviceSettingsTestHelper::StartSession(const std::string& user_email) {} | 115 void DeviceSettingsTestHelper::StartSession( |
| 116 const cryptohome::Identification& cryptohome_id) {} |
| 115 | 117 |
| 116 void DeviceSettingsTestHelper::StopSession() {} | 118 void DeviceSettingsTestHelper::StopSession() {} |
| 117 | 119 |
| 118 void DeviceSettingsTestHelper::NotifySupervisedUserCreationStarted() {} | 120 void DeviceSettingsTestHelper::NotifySupervisedUserCreationStarted() {} |
| 119 | 121 |
| 120 void DeviceSettingsTestHelper::NotifySupervisedUserCreationFinished() {} | 122 void DeviceSettingsTestHelper::NotifySupervisedUserCreationFinished() {} |
| 121 | 123 |
| 122 void DeviceSettingsTestHelper::StartDeviceWipe() {} | 124 void DeviceSettingsTestHelper::StartDeviceWipe() {} |
| 123 | 125 |
| 124 void DeviceSettingsTestHelper::RequestLockScreen() {} | 126 void DeviceSettingsTestHelper::RequestLockScreen() {} |
| 125 | 127 |
| 126 void DeviceSettingsTestHelper::NotifyLockScreenShown() {} | 128 void DeviceSettingsTestHelper::NotifyLockScreenShown() {} |
| 127 | 129 |
| 128 void DeviceSettingsTestHelper::NotifyLockScreenDismissed() {} | 130 void DeviceSettingsTestHelper::NotifyLockScreenDismissed() {} |
| 129 | 131 |
| 130 void DeviceSettingsTestHelper::RetrieveActiveSessions( | 132 void DeviceSettingsTestHelper::RetrieveActiveSessions( |
| 131 const ActiveSessionsCallback& callback) {} | 133 const ActiveSessionsCallback& callback) {} |
| 132 | 134 |
| 133 void DeviceSettingsTestHelper::RetrieveDevicePolicy( | 135 void DeviceSettingsTestHelper::RetrieveDevicePolicy( |
| 134 const RetrievePolicyCallback& callback) { | 136 const RetrievePolicyCallback& callback) { |
| 135 device_policy_.retrieve_callbacks_.push_back(callback); | 137 device_policy_.retrieve_callbacks_.push_back(callback); |
| 136 } | 138 } |
| 137 | 139 |
| 138 void DeviceSettingsTestHelper::RetrievePolicyForUser( | 140 void DeviceSettingsTestHelper::RetrievePolicyForUser( |
| 139 const std::string& username, | 141 const cryptohome::Identification& cryptohome_id, |
| 140 const RetrievePolicyCallback& callback) { | 142 const RetrievePolicyCallback& callback) {} |
| 141 } | |
| 142 | 143 |
| 143 std::string DeviceSettingsTestHelper::BlockingRetrievePolicyForUser( | 144 std::string DeviceSettingsTestHelper::BlockingRetrievePolicyForUser( |
| 144 const std::string& username) { | 145 const cryptohome::Identification& cryptohome_id) { |
| 145 return ""; | 146 return ""; |
| 146 } | 147 } |
| 147 | 148 |
| 148 void DeviceSettingsTestHelper::RetrieveDeviceLocalAccountPolicy( | 149 void DeviceSettingsTestHelper::RetrieveDeviceLocalAccountPolicy( |
| 149 const std::string& account_id, | 150 const std::string& account_id, |
| 150 const RetrievePolicyCallback& callback) { | 151 const RetrievePolicyCallback& callback) { |
| 151 device_local_account_policy_[account_id].retrieve_callbacks_.push_back( | 152 device_local_account_policy_[account_id].retrieve_callbacks_.push_back( |
| 152 callback); | 153 callback); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void DeviceSettingsTestHelper::StoreDevicePolicy( | 156 void DeviceSettingsTestHelper::StoreDevicePolicy( |
| 156 const std::string& policy_blob, | 157 const std::string& policy_blob, |
| 157 const StorePolicyCallback& callback) { | 158 const StorePolicyCallback& callback) { |
| 158 device_policy_.policy_blob_ = policy_blob; | 159 device_policy_.policy_blob_ = policy_blob; |
| 159 device_policy_.store_callbacks_.push_back(callback); | 160 device_policy_.store_callbacks_.push_back(callback); |
| 160 } | 161 } |
| 161 | 162 |
| 162 void DeviceSettingsTestHelper::StorePolicyForUser( | 163 void DeviceSettingsTestHelper::StorePolicyForUser( |
| 163 const std::string& username, | 164 const cryptohome::Identification& cryptohome_id, |
| 164 const std::string& policy_blob, | 165 const std::string& policy_blob, |
| 165 const StorePolicyCallback& callback) { | 166 const StorePolicyCallback& callback) {} |
| 166 } | |
| 167 | 167 |
| 168 void DeviceSettingsTestHelper::StoreDeviceLocalAccountPolicy( | 168 void DeviceSettingsTestHelper::StoreDeviceLocalAccountPolicy( |
| 169 const std::string& account_id, | 169 const std::string& account_id, |
| 170 const std::string& policy_blob, | 170 const std::string& policy_blob, |
| 171 const StorePolicyCallback& callback) { | 171 const StorePolicyCallback& callback) { |
| 172 device_local_account_policy_[account_id].policy_blob_ = policy_blob; | 172 device_local_account_policy_[account_id].policy_blob_ = policy_blob; |
| 173 device_local_account_policy_[account_id].store_callbacks_.push_back(callback); | 173 device_local_account_policy_[account_id].store_callbacks_.push_back(callback); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void DeviceSettingsTestHelper::SetFlagsForUser( | 176 void DeviceSettingsTestHelper::SetFlagsForUser( |
| 177 const std::string& account_id, | 177 const cryptohome::Identification& cryptohome_id, |
| 178 const std::vector<std::string>& flags) {} | 178 const std::vector<std::string>& flags) {} |
| 179 | 179 |
| 180 void DeviceSettingsTestHelper::GetServerBackedStateKeys( | 180 void DeviceSettingsTestHelper::GetServerBackedStateKeys( |
| 181 const StateKeysCallback& callback) {} | 181 const StateKeysCallback& callback) {} |
| 182 | 182 |
| 183 void DeviceSettingsTestHelper::CheckArcAvailability( | 183 void DeviceSettingsTestHelper::CheckArcAvailability( |
| 184 const ArcCallback& callback) {} | 184 const ArcCallback& callback) {} |
| 185 | 185 |
| 186 void DeviceSettingsTestHelper::StartArcInstance(const std::string& socket_path, | 186 void DeviceSettingsTestHelper::StartArcInstance(const std::string& socket_path, |
| 187 const ArcCallback& callback) {} | 187 const ArcCallback& callback) {} |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 const_cast<user_manager::User*>(user)); | 267 const_cast<user_manager::User*>(user)); |
| 268 } | 268 } |
| 269 OwnerSettingsServiceChromeOS* service = | 269 OwnerSettingsServiceChromeOS* service = |
| 270 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile_.get()); | 270 OwnerSettingsServiceChromeOSFactory::GetForBrowserContext(profile_.get()); |
| 271 CHECK(service); | 271 CHECK(service); |
| 272 if (tpm_is_ready) | 272 if (tpm_is_ready) |
| 273 service->OnTPMTokenReady(true /* token is enabled */); | 273 service->OnTPMTokenReady(true /* token is enabled */); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace chromeos | 276 } // namespace chromeos |
| OLD | NEW |