Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(530)

Side by Side Diff: chrome/browser/sync/profile_sync_service_preference_unittest.cc

Issue 217063005: Separate SyncData methods into three groups, local, remote, and common. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@syncapi
Patch Set: Rebase. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <map> 5 #include <map>
6 #include <string> 6 #include <string>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 prefs_->SetString(prefs::kHomePage, example_url0_); 322 prefs_->SetString(prefs::kHomePage, example_url0_);
323 CreateRootHelper create_root(this, syncer::PREFERENCES); 323 CreateRootHelper create_root(this, syncer::PREFERENCES);
324 ASSERT_TRUE(StartSyncService(create_root.callback(), false)); 324 ASSERT_TRUE(StartSyncService(create_root.callback(), false));
325 ASSERT_TRUE(create_root.success()); 325 ASSERT_TRUE(create_root.success());
326 326
327 const PrefService::Preference* pref = 327 const PrefService::Preference* pref =
328 prefs_->FindPreference(prefs::kHomePage); 328 prefs_->FindPreference(prefs::kHomePage);
329 syncer::SyncData sync_data; 329 syncer::SyncData sync_data;
330 EXPECT_TRUE(pref_sync_service_->CreatePrefSyncData(pref->name(), 330 EXPECT_TRUE(pref_sync_service_->CreatePrefSyncData(pref->name(),
331 *pref->GetValue(), &sync_data)); 331 *pref->GetValue(), &sync_data));
332 EXPECT_EQ(std::string(prefs::kHomePage), sync_data.GetTag()); 332 EXPECT_EQ(std::string(prefs::kHomePage),
333 syncer::SyncDataLocal(sync_data).GetTag());
333 const sync_pb::PreferenceSpecifics& specifics(sync_data.GetSpecifics(). 334 const sync_pb::PreferenceSpecifics& specifics(sync_data.GetSpecifics().
334 preference()); 335 preference());
335 EXPECT_EQ(std::string(prefs::kHomePage), specifics.name()); 336 EXPECT_EQ(std::string(prefs::kHomePage), specifics.name());
336 337
337 scoped_ptr<base::Value> value(base::JSONReader::Read(specifics.value())); 338 scoped_ptr<base::Value> value(base::JSONReader::Read(specifics.value()));
338 EXPECT_TRUE(pref->GetValue()->Equals(value.get())); 339 EXPECT_TRUE(pref->GetValue()->Equals(value.get()));
339 } 340 }
340 341
341 TEST_F(ProfileSyncServicePreferenceTest, ModelAssociationDoNotSyncDefaults) { 342 TEST_F(ProfileSyncServicePreferenceTest, ModelAssociationDoNotSyncDefaults) {
342 const PrefService::Preference* pref = 343 const PrefService::Preference* pref =
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 EXPECT_FALSE(pref->IsDefaultValue()); 887 EXPECT_FALSE(pref->IsDefaultValue());
887 // There should be no synced value. 888 // There should be no synced value.
888 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 889 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
889 // Switch kHomePage back to unmanaged. 890 // Switch kHomePage back to unmanaged.
890 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); 891 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage);
891 // The original value should be picked up. 892 // The original value should be picked up.
892 EXPECT_TRUE(pref->IsDefaultValue()); 893 EXPECT_TRUE(pref->IsDefaultValue());
893 // There should still be no synced value. 894 // There should still be no synced value.
894 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 895 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
895 } 896 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/generic_change_processor.cc ('k') | chrome/browser/sync/sessions2/sessions_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698