| 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 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/callback.h" | 11 #include "base/callback.h" |
| 11 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 12 #include "base/macros.h" | 13 #include "base/macros.h" |
| 13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 14 #include "base/test/scoped_path_override.h" | 15 #include "base/test/scoped_path_override.h" |
| 15 #include "base/values.h" | 16 #include "base/values.h" |
| 16 #include "chrome/browser/chromeos/policy/device_local_account.h" | 17 #include "chrome/browser/chromeos/policy/device_local_account.h" |
| 17 #include "chrome/browser/chromeos/policy/device_policy_builder.h" | 18 #include "chrome/browser/chromeos/policy/device_policy_builder.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 Mock::VerifyAndClearExpectations(this); | 398 Mock::VerifyAndClearExpectations(this); |
| 398 | 399 |
| 399 // On load, the deprecated spec should have been converted to the new format. | 400 // On load, the deprecated spec should have been converted to the new format. |
| 400 base::ListValue expected_accounts; | 401 base::ListValue expected_accounts; |
| 401 std::unique_ptr<base::DictionaryValue> entry_dict( | 402 std::unique_ptr<base::DictionaryValue> entry_dict( |
| 402 new base::DictionaryValue()); | 403 new base::DictionaryValue()); |
| 403 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, | 404 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, |
| 404 policy::PolicyBuilder::kFakeUsername); | 405 policy::PolicyBuilder::kFakeUsername); |
| 405 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, | 406 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, |
| 406 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); | 407 policy::DeviceLocalAccount::TYPE_PUBLIC_SESSION); |
| 407 expected_accounts.Append(entry_dict.release()); | 408 expected_accounts.Append(std::move(entry_dict)); |
| 408 const base::Value* actual_accounts = | 409 const base::Value* actual_accounts = |
| 409 provider_->Get(kAccountsPrefDeviceLocalAccounts); | 410 provider_->Get(kAccountsPrefDeviceLocalAccounts); |
| 410 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); | 411 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); |
| 411 } | 412 } |
| 412 | 413 |
| 413 TEST_F(DeviceSettingsProviderTest, DecodeDeviceState) { | 414 TEST_F(DeviceSettingsProviderTest, DecodeDeviceState) { |
| 414 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); | 415 EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1)); |
| 415 device_policy_.policy_data().mutable_device_state()->set_device_mode( | 416 device_policy_.policy_data().mutable_device_state()->set_device_mode( |
| 416 em::DeviceState::DEVICE_MODE_DISABLED); | 417 em::DeviceState::DEVICE_MODE_DISABLED); |
| 417 device_policy_.policy_data().mutable_device_state()-> | 418 device_policy_.policy_data().mutable_device_state()-> |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 } | 484 } |
| 484 | 485 |
| 485 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { | 486 TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) { |
| 486 SetLogUploadSettings(true); | 487 SetLogUploadSettings(true); |
| 487 VerifyLogUploadSettings(true); | 488 VerifyLogUploadSettings(true); |
| 488 | 489 |
| 489 SetLogUploadSettings(false); | 490 SetLogUploadSettings(false); |
| 490 VerifyLogUploadSettings(false); | 491 VerifyLogUploadSettings(false); |
| 491 } | 492 } |
| 492 } // namespace chromeos | 493 } // namespace chromeos |
| OLD | NEW |