| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/callback.h" | 6 #include "base/callback.h" |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/prefs/testing_pref_store.h" | 8 #include "base/prefs/testing_pref_store.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "chrome/browser/managed_mode/managed_user_settings_service.h" | 10 #include "chrome/browser/managed_mode/managed_user_settings_service.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 expected_value = atomic_setting_value_.get(); | 128 expected_value = atomic_setting_value_.get(); |
| 129 } else { | 129 } else { |
| 130 EXPECT_TRUE(StartsWithASCII(managed_user_setting.name(), | 130 EXPECT_TRUE(StartsWithASCII(managed_user_setting.name(), |
| 131 std::string(kSplitItemName) + ':', | 131 std::string(kSplitItemName) + ':', |
| 132 true)); | 132 true)); |
| 133 std::string key = | 133 std::string key = |
| 134 managed_user_setting.name().substr(strlen(kSplitItemName) + 1); | 134 managed_user_setting.name().substr(strlen(kSplitItemName) + 1); |
| 135 EXPECT_TRUE(split_items_.GetWithoutPathExpansion(key, &expected_value)); | 135 EXPECT_TRUE(split_items_.GetWithoutPathExpansion(key, &expected_value)); |
| 136 } | 136 } |
| 137 | 137 |
| 138 scoped_ptr<Value> value( | 138 scoped_ptr<base::Value> value( |
| 139 base::JSONReader::Read(managed_user_setting.value())); | 139 base::JSONReader::Read(managed_user_setting.value())); |
| 140 EXPECT_TRUE(expected_value->Equals(value.get())); | 140 EXPECT_TRUE(expected_value->Equals(value.get())); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void OnNewSettingsAvailable(const base::DictionaryValue* settings) { | 143 void OnNewSettingsAvailable(const base::DictionaryValue* settings) { |
| 144 if (!settings) | 144 if (!settings) |
| 145 settings_.reset(); | 145 settings_.reset(); |
| 146 else | 146 else |
| 147 settings_.reset(settings->DeepCopy()); | 147 settings_.reset(settings->DeepCopy()); |
| 148 } | 148 } |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 // The uploaded items should not show up as settings. | 316 // The uploaded items should not show up as settings. |
| 317 const base::Value* value = NULL; | 317 const base::Value* value = NULL; |
| 318 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value)); | 318 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kAtomicItemName, &value)); |
| 319 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value)); | 319 EXPECT_FALSE(settings_->GetWithoutPathExpansion(kSplitItemName, &value)); |
| 320 | 320 |
| 321 // Restarting sync should not create any new changes. | 321 // Restarting sync should not create any new changes. |
| 322 settings_service_.StopSyncing(syncer::MANAGED_USER_SETTINGS); | 322 settings_service_.StopSyncing(syncer::MANAGED_USER_SETTINGS); |
| 323 StartSyncing(sync_data); | 323 StartSyncing(sync_data); |
| 324 ASSERT_EQ(0u, sync_processor_->changes().size()); | 324 ASSERT_EQ(0u, sync_processor_->changes().size()); |
| 325 } | 325 } |
| OLD | NEW |