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 <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/string_piece.h" | 15 #include "base/string_piece.h" |
16 #include "chrome/browser/prefs/pref_model_associator.h" | 16 #include "chrome/browser/prefs/pref_model_associator.h" |
| 17 #include "chrome/browser/prefs/pref_registry_syncable.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" |
26 #include "chrome/browser/sync/profile_sync_test_util.h" | 27 #include "chrome/browser/sync/profile_sync_test_util.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 not_synced_preference_name_("nonsense_pref_name"), | 117 not_synced_preference_name_("nonsense_pref_name"), |
117 not_synced_preference_default_value_("default"), | 118 not_synced_preference_default_value_("default"), |
118 non_default_charset_value_("foo") {} | 119 non_default_charset_value_("foo") {} |
119 | 120 |
120 virtual void SetUp() { | 121 virtual void SetUp() { |
121 AbstractProfileSyncServiceTest::SetUp(); | 122 AbstractProfileSyncServiceTest::SetUp(); |
122 profile_.reset(new TestingProfile()); | 123 profile_.reset(new TestingProfile()); |
123 profile_->CreateRequestContext(); | 124 profile_->CreateRequestContext(); |
124 prefs_ = profile_->GetTestingPrefService(); | 125 prefs_ = profile_->GetTestingPrefService(); |
125 | 126 |
126 prefs_->RegisterStringPref(not_synced_preference_name_.c_str(), | 127 prefs_->registry()->RegisterStringPref( |
127 not_synced_preference_default_value_, | 128 not_synced_preference_name_.c_str(), |
128 PrefServiceSyncable::UNSYNCABLE_PREF); | 129 not_synced_preference_default_value_, |
| 130 PrefRegistrySyncable::UNSYNCABLE_PREF); |
129 } | 131 } |
130 | 132 |
131 virtual void TearDown() { | 133 virtual void TearDown() { |
132 profile_.reset(); | 134 profile_.reset(); |
133 AbstractProfileSyncServiceTest::TearDown(); | 135 AbstractProfileSyncServiceTest::TearDown(); |
134 } | 136 } |
135 | 137 |
136 int GetSyncPreferenceCount() { | 138 int GetSyncPreferenceCount() { |
137 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); | 139 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); |
138 syncer::ReadNode node(&trans); | 140 syncer::ReadNode node(&trans); |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 EXPECT_FALSE(pref->IsDefaultValue()); | 675 EXPECT_FALSE(pref->IsDefaultValue()); |
674 // There should be no synced value. | 676 // There should be no synced value. |
675 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 677 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
676 // Switch kHomePage back to unmanaged. | 678 // Switch kHomePage back to unmanaged. |
677 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 679 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
678 // The original value should be picked up. | 680 // The original value should be picked up. |
679 EXPECT_TRUE(pref->IsDefaultValue()); | 681 EXPECT_TRUE(pref->IsDefaultValue()); |
680 // There should still be no synced value. | 682 // There should still be no synced value. |
681 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 683 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
682 } | 684 } |
OLD | NEW |