| 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_provider.h" | 5 #include "chrome/browser/chromeos/settings/device_settings_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // Helper routine to check value of the LoginScreenDomainAutoComplete policy. | 188 // Helper routine to check value of the LoginScreenDomainAutoComplete policy. |
| 189 void VerifyDomainAutoComplete( | 189 void VerifyDomainAutoComplete( |
| 190 const base::StringValue* const ptr_to_expected_value) { | 190 const base::StringValue* const ptr_to_expected_value) { |
| 191 EXPECT_TRUE(base::Value::Equals( | 191 EXPECT_TRUE(base::Value::Equals( |
| 192 provider_->Get(kAccountsPrefLoginScreenDomainAutoComplete), | 192 provider_->Get(kAccountsPrefLoginScreenDomainAutoComplete), |
| 193 ptr_to_expected_value)); | 193 ptr_to_expected_value)); |
| 194 } | 194 } |
| 195 | 195 |
| 196 ScopedTestingLocalState local_state_; | 196 ScopedTestingLocalState local_state_; |
| 197 | 197 |
| 198 scoped_ptr<DeviceSettingsProvider> provider_; | 198 std::unique_ptr<DeviceSettingsProvider> provider_; |
| 199 | 199 |
| 200 base::ScopedPathOverride user_data_dir_override_; | 200 base::ScopedPathOverride user_data_dir_override_; |
| 201 | 201 |
| 202 private: | 202 private: |
| 203 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProviderTest); | 203 DISALLOW_COPY_AND_ASSIGN(DeviceSettingsProviderTest); |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 TEST_F(DeviceSettingsProviderTest, InitializationTest) { | 206 TEST_F(DeviceSettingsProviderTest, InitializationTest) { |
| 207 // Have the service load a settings blob. | 207 // Have the service load a settings blob. |
| 208 EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber()); | 208 EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber()); |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 device_policy_.payload().mutable_device_local_accounts()->add_account(); | 387 device_policy_.payload().mutable_device_local_accounts()->add_account(); |
| 388 account->set_deprecated_public_session_id( | 388 account->set_deprecated_public_session_id( |
| 389 policy::PolicyBuilder::kFakeUsername); | 389 policy::PolicyBuilder::kFakeUsername); |
| 390 device_policy_.Build(); | 390 device_policy_.Build(); |
| 391 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); | 391 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); |
| 392 ReloadDeviceSettings(); | 392 ReloadDeviceSettings(); |
| 393 Mock::VerifyAndClearExpectations(this); | 393 Mock::VerifyAndClearExpectations(this); |
| 394 | 394 |
| 395 // On load, the deprecated spec should have been converted to the new format. | 395 // On load, the deprecated spec should have been converted to the new format. |
| 396 base::ListValue expected_accounts; | 396 base::ListValue expected_accounts; |
| 397 scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue()); | 397 std::unique_ptr<base::DictionaryValue> entry_dict( |
| 398 new base::DictionaryValue()); |
| 398 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, | 399 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, |
| 399 policy::PolicyBuilder::kFakeUsername); | 400 policy::PolicyBuilder::kFakeUsername); |
| 400 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, | 401 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, |
| 401 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); | 402 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); |
| 402 expected_accounts.Append(entry_dict.release()); | 403 expected_accounts.Append(entry_dict.release()); |
| 403 const base::Value* actual_accounts = | 404 const base::Value* actual_accounts = |
| 404 provider_->Get(kAccountsPrefDeviceLocalAccounts); | 405 provider_->Get(kAccountsPrefDeviceLocalAccounts); |
| 405 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); | 406 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); |
| 406 } | 407 } |
| 407 | 408 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 498 } |
| 498 | 499 |
| 499 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { | 500 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { |
| 500 SetLogUploadSettings(true); | 501 SetLogUploadSettings(true); |
| 501 VerifyLogUploadSettings(true); | 502 VerifyLogUploadSettings(true); |
| 502 | 503 |
| 503 SetLogUploadSettings(false); | 504 SetLogUploadSettings(false); |
| 504 VerifyLogUploadSettings(false); | 505 VerifyLogUploadSettings(false); |
| 505 } | 506 } |
| 506 } // namespace chromeos | 507 } // namespace chromeos |
| OLD | NEW |