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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 EXPECT_EQ(std::string(), device_settings_test_helper_.policy_blob()); | 256 EXPECT_EQ(std::string(), device_settings_test_helper_.policy_blob()); |
257 | 257 |
258 // Verify that migration has kicked in. | 258 // Verify that migration has kicked in. |
259 const base::Value* saved_value = provider_->Get(kStatsReportingPref); | 259 const base::Value* saved_value = provider_->Get(kStatsReportingPref); |
260 ASSERT_TRUE(saved_value); | 260 ASSERT_TRUE(saved_value); |
261 bool bool_value; | 261 bool bool_value; |
262 EXPECT_TRUE(saved_value->GetAsBoolean(&bool_value)); | 262 EXPECT_TRUE(saved_value->GetAsBoolean(&bool_value)); |
263 EXPECT_FALSE(bool_value); | 263 EXPECT_FALSE(bool_value); |
264 } | 264 } |
265 | 265 |
| 266 TEST_F(DeviceSettingsProviderTest, LegacyDeviceLocalAccounts) { |
| 267 EXPECT_CALL(*this, SettingChanged(_)).Times(AnyNumber()); |
| 268 em::DeviceLocalAccountInfoProto* account = |
| 269 device_policy_.payload().mutable_device_local_accounts()->add_account(); |
| 270 account->set_id(policy::PolicyBuilder::kFakeUsername); |
| 271 device_policy_.Build(); |
| 272 device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob()); |
| 273 ReloadDeviceSettings(); |
| 274 Mock::VerifyAndClearExpectations(this); |
| 275 |
| 276 // On load, the deprecated spec should have been converted to the new format. |
| 277 base::ListValue expected_accounts; |
| 278 scoped_ptr<base::DictionaryValue> entry_dict(new base::DictionaryValue()); |
| 279 entry_dict->SetString(kAccountsPrefDeviceLocalAccountsKeyId, |
| 280 policy::PolicyBuilder::kFakeUsername); |
| 281 entry_dict->SetInteger(kAccountsPrefDeviceLocalAccountsKeyType, |
| 282 DEVICE_LOCAL_ACCOUNT_TYPE_PUBLIC_SESSION); |
| 283 expected_accounts.Append(entry_dict.release()); |
| 284 const base::Value* actual_accounts = |
| 285 provider_->Get(kAccountsPrefDeviceLocalAccounts); |
| 286 EXPECT_TRUE(base::Value::Equals(&expected_accounts, actual_accounts)); |
| 287 } |
| 288 |
266 } // namespace chromeos | 289 } // namespace chromeos |
OLD | NEW |