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

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

Issue 136723009: Move UbertokenFetcher from //chrome to //google_apis. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 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 | Annotate | Revision Log
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/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/profile_oauth2_token_service_factory.h" 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
21 #include "chrome/browser/signin/signin_manager.h" 21 #include "chrome/browser/signin/signin_manager.h"
22 #include "chrome/browser/signin/signin_manager_factory.h" 22 #include "chrome/browser/signin/signin_manager_factory.h"
23 #include "chrome/browser/sync/abstract_profile_sync_service_test.h" 23 #include "chrome/browser/sync/abstract_profile_sync_service_test.h"
24 #include "chrome/browser/sync/fake_oauth2_token_service.h" 24 #include "chrome/browser/sync/fake_oauth2_token_service_for_sync.h"
25 #include "chrome/browser/sync/glue/generic_change_processor.h" 25 #include "chrome/browser/sync/glue/generic_change_processor.h"
26 #include "chrome/browser/sync/glue/sync_backend_host.h" 26 #include "chrome/browser/sync/glue/sync_backend_host.h"
27 #include "chrome/browser/sync/glue/ui_data_type_controller.h" 27 #include "chrome/browser/sync/glue/ui_data_type_controller.h"
28 #include "chrome/browser/sync/profile_sync_service_factory.h" 28 #include "chrome/browser/sync/profile_sync_service_factory.h"
29 #include "chrome/browser/sync/profile_sync_test_util.h" 29 #include "chrome/browser/sync/profile_sync_test_util.h"
30 #include "chrome/browser/sync/test_profile_sync_service.h" 30 #include "chrome/browser/sync/test_profile_sync_service.h"
31 #include "chrome/common/pref_names.h" 31 #include "chrome/common/pref_names.h"
32 #include "chrome/test/base/testing_pref_service_syncable.h" 32 #include "chrome/test/base/testing_pref_service_syncable.h"
33 #include "chrome/test/base/testing_profile.h" 33 #include "chrome/test/base/testing_profile.h"
34 #include "components/user_prefs/pref_registry_syncable.h" 34 #include "components/user_prefs/pref_registry_syncable.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 example_url1_("http://example.com/1"), 119 example_url1_("http://example.com/1"),
120 example_url2_("http://example.com/2"), 120 example_url2_("http://example.com/2"),
121 not_synced_preference_name_("nonsense_pref_name"), 121 not_synced_preference_name_("nonsense_pref_name"),
122 not_synced_preference_default_value_("default"), 122 not_synced_preference_default_value_("default"),
123 non_default_charset_value_("foo") {} 123 non_default_charset_value_("foo") {}
124 124
125 virtual void SetUp() { 125 virtual void SetUp() {
126 AbstractProfileSyncServiceTest::SetUp(); 126 AbstractProfileSyncServiceTest::SetUp();
127 TestingProfile::Builder builder; 127 TestingProfile::Builder builder;
128 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), 128 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(),
129 FakeOAuth2TokenService::BuildTokenService); 129 FakeOAuth2TokenServiceForSync::BuildTokenService);
130 profile_ = builder.Build().Pass(); 130 profile_ = builder.Build().Pass();
131 invalidation::InvalidationServiceFactory::GetInstance()-> 131 invalidation::InvalidationServiceFactory::GetInstance()->
132 SetBuildOnlyFakeInvalidatorsForTest(true); 132 SetBuildOnlyFakeInvalidatorsForTest(true);
133 prefs_ = profile_->GetTestingPrefService(); 133 prefs_ = profile_->GetTestingPrefService();
134 134
135 prefs_->registry()->RegisterStringPref( 135 prefs_->registry()->RegisterStringPref(
136 not_synced_preference_name_.c_str(), 136 not_synced_preference_name_.c_str(),
137 not_synced_preference_default_value_, 137 not_synced_preference_default_value_,
138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); 138 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
139 } 139 }
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 EXPECT_FALSE(pref->IsDefaultValue()); 895 EXPECT_FALSE(pref->IsDefaultValue());
896 // There should be no synced value. 896 // There should be no synced value.
897 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 897 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
898 // Switch kHomePage back to unmanaged. 898 // Switch kHomePage back to unmanaged.
899 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); 899 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage);
900 // The original value should be picked up. 900 // The original value should be picked up.
901 EXPECT_TRUE(pref->IsDefaultValue()); 901 EXPECT_TRUE(pref->IsDefaultValue());
902 // There should still be no synced value. 902 // There should still be no synced value.
903 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); 903 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL);
904 } 904 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698