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

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

Issue 15580002: Make use of InvalidationService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/stl_util.h" 14 #include "base/stl_util.h"
15 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
16 #include "chrome/browser/invalidation/invalidation_service_factory.h"
16 #include "chrome/browser/prefs/pref_model_associator.h" 17 #include "chrome/browser/prefs/pref_model_associator.h"
17 #include "chrome/browser/prefs/scoped_user_pref_update.h" 18 #include "chrome/browser/prefs/scoped_user_pref_update.h"
18 #include "chrome/browser/signin/signin_manager.h" 19 #include "chrome/browser/signin/signin_manager.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 20 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "chrome/browser/signin/token_service_factory.h" 21 #include "chrome/browser/signin/token_service_factory.h"
21 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 22 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
22 #include "chrome/browser/sync/glue/generic_change_processor.h" 23 #include "chrome/browser/sync/glue/generic_change_processor.h"
23 #include "chrome/browser/sync/glue/sync_backend_host.h" 24 #include "chrome/browser/sync/glue/sync_backend_host.h"
24 #include "chrome/browser/sync/glue/ui_data_type_controller.h" 25 #include "chrome/browser/sync/glue/ui_data_type_controller.h"
25 #include "chrome/browser/sync/profile_sync_service_factory.h" 26 #include "chrome/browser/sync/profile_sync_service_factory.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 example_url1_("http://example.com/1"), 118 example_url1_("http://example.com/1"),
118 example_url2_("http://example.com/2"), 119 example_url2_("http://example.com/2"),
119 not_synced_preference_name_("nonsense_pref_name"), 120 not_synced_preference_name_("nonsense_pref_name"),
120 not_synced_preference_default_value_("default"), 121 not_synced_preference_default_value_("default"),
121 non_default_charset_value_("foo") {} 122 non_default_charset_value_("foo") {}
122 123
123 virtual void SetUp() { 124 virtual void SetUp() {
124 AbstractProfileSyncServiceTest::SetUp(); 125 AbstractProfileSyncServiceTest::SetUp();
125 profile_.reset(new TestingProfile()); 126 profile_.reset(new TestingProfile());
126 profile_->CreateRequestContext(); 127 profile_->CreateRequestContext();
128 invalidation::InvalidationServiceFactory::GetInstance()->
129 SetBuildOnlyFakeInvalidatorsForTest(true);
127 prefs_ = profile_->GetTestingPrefService(); 130 prefs_ = profile_->GetTestingPrefService();
128 131
129 prefs_->registry()->RegisterStringPref( 132 prefs_->registry()->RegisterStringPref(
130 not_synced_preference_name_.c_str(), 133 not_synced_preference_name_.c_str(),
131 not_synced_preference_default_value_, 134 not_synced_preference_default_value_,
132 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 135 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
133 } 136 }
134 137
135 virtual void TearDown() { 138 virtual void TearDown() {
136 profile_.reset(); 139 profile_.reset();
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 EXPECT_FALSE(pref->IsDefaultValue()); 685 EXPECT_FALSE(pref->IsDefaultValue());
683 // There should be no synced value. 686 // There should be no synced value.
684 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 687 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
685 // Switch kHomePage back to unmanaged. 688 // Switch kHomePage back to unmanaged.
686 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); 689 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage);
687 // The original value should be picked up. 690 // The original value should be picked up.
688 EXPECT_TRUE(pref->IsDefaultValue()); 691 EXPECT_TRUE(pref->IsDefaultValue());
689 // There should still be no synced value. 692 // There should still be no synced value.
690 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 693 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
691 } 694 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698