| 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/json/json_writer.h" | 13 #include "base/json/json_writer.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/prefs/scoped_user_pref_update.h" | 15 #include "base/prefs/scoped_user_pref_update.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "base/strings/string_piece.h" | 17 #include "base/strings/string_piece.h" |
| 18 #include "chrome/browser/invalidation/invalidation_service_factory.h" | 18 #include "chrome/browser/invalidation/invalidation_service_factory.h" |
| 19 #include "chrome/browser/prefs/pref_model_associator.h" | 19 #include "chrome/browser/prefs/pref_model_associator.h" |
| 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 20 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 21 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
| 21 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 22 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 22 #include "chrome/browser/signin/signin_manager.h" | 23 #include "chrome/browser/signin/signin_manager.h" |
| 23 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
| 24 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" | 25 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" |
| 25 #include "chrome/browser/sync/glue/generic_change_processor.h" | 26 #include "chrome/browser/sync/glue/generic_change_processor.h" |
| 26 #include "chrome/browser/sync/glue/sync_backend_host.h" | 27 #include "chrome/browser/sync/glue/sync_backend_host.h" |
| 27 #include "chrome/browser/sync/glue/ui_data_type_controller.h" | 28 #include "chrome/browser/sync/glue/ui_data_type_controller.h" |
| 28 #include "chrome/browser/sync/profile_sync_service_factory.h" | 29 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 29 #include "chrome/browser/sync/profile_sync_test_util.h" | 30 #include "chrome/browser/sync/profile_sync_test_util.h" |
| 30 #include "chrome/browser/sync/test_profile_sync_service.h" | 31 #include "chrome/browser/sync/test_profile_sync_service.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 example_url2_("http://example.com/2"), | 121 example_url2_("http://example.com/2"), |
| 121 not_synced_preference_name_("nonsense_pref_name"), | 122 not_synced_preference_name_("nonsense_pref_name"), |
| 122 not_synced_preference_default_value_("default"), | 123 not_synced_preference_default_value_("default"), |
| 123 non_default_charset_value_("foo") {} | 124 non_default_charset_value_("foo") {} |
| 124 | 125 |
| 125 virtual void SetUp() { | 126 virtual void SetUp() { |
| 126 AbstractProfileSyncServiceTest::SetUp(); | 127 AbstractProfileSyncServiceTest::SetUp(); |
| 127 TestingProfile::Builder builder; | 128 TestingProfile::Builder builder; |
| 128 builder.AddTestingFactory( | 129 builder.AddTestingFactory( |
| 129 ProfileOAuth2TokenServiceFactory::GetInstance(), | 130 ProfileOAuth2TokenServiceFactory::GetInstance(), |
| 130 FakeProfileOAuth2TokenService::BuildAutoIssuingTokenService); | 131 FakeProfileOAuth2TokenServiceWrapper::BuildAutoIssuingTokenService); |
| 131 profile_ = builder.Build().Pass(); | 132 profile_ = builder.Build().Pass(); |
| 132 invalidation::InvalidationServiceFactory::GetInstance()-> | 133 invalidation::InvalidationServiceFactory::GetInstance()-> |
| 133 SetBuildOnlyFakeInvalidatorsForTest(true); | 134 SetBuildOnlyFakeInvalidatorsForTest(true); |
| 134 prefs_ = profile_->GetTestingPrefService(); | 135 prefs_ = profile_->GetTestingPrefService(); |
| 135 | 136 |
| 136 prefs_->registry()->RegisterStringPref( | 137 prefs_->registry()->RegisterStringPref( |
| 137 not_synced_preference_name_.c_str(), | 138 not_synced_preference_name_.c_str(), |
| 138 not_synced_preference_default_value_, | 139 not_synced_preference_default_value_, |
| 139 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 140 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
| 140 } | 141 } |
| (...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 896 EXPECT_FALSE(pref->IsDefaultValue()); | 897 EXPECT_FALSE(pref->IsDefaultValue()); |
| 897 // There should be no synced value. | 898 // There should be no synced value. |
| 898 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 899 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 899 // Switch kHomePage back to unmanaged. | 900 // Switch kHomePage back to unmanaged. |
| 900 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 901 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
| 901 // The original value should be picked up. | 902 // The original value should be picked up. |
| 902 EXPECT_TRUE(pref->IsDefaultValue()); | 903 EXPECT_TRUE(pref->IsDefaultValue()); |
| 903 // There should still be no synced value. | 904 // There should still be no synced value. |
| 904 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 905 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 905 } | 906 } |
| OLD | NEW |