| 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" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 dtc_ = new UIDataTypeController(syncer::PREFERENCES, | 178 dtc_ = new UIDataTypeController(syncer::PREFERENCES, |
| 179 components, | 179 components, |
| 180 profile_.get(), | 180 profile_.get(), |
| 181 sync_service_); | 181 sync_service_); |
| 182 EXPECT_CALL(*components, CreateSharedChangeProcessor()). | 182 EXPECT_CALL(*components, CreateSharedChangeProcessor()). |
| 183 WillOnce(Return(new SharedChangeProcessor())); | 183 WillOnce(Return(new SharedChangeProcessor())); |
| 184 EXPECT_CALL(*components, CreateGenericChangeProcessor(_, _, _, _)). | 184 EXPECT_CALL(*components, CreateGenericChangeProcessor(_, _, _, _)). |
| 185 WillOnce(CreateAndSaveChangeProcessor( | 185 WillOnce(CreateAndSaveChangeProcessor( |
| 186 &change_processor_)); | 186 &change_processor_)); |
| 187 sync_service_->RegisterDataTypeController(dtc_); | 187 sync_service_->RegisterDataTypeController(dtc_); |
| 188 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( | 188 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_.get()) |
| 189 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); | 189 ->UpdateCredentials("test", "oauth2_login_token"); |
| 190 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( | 190 TokenServiceFactory::GetForProfile(profile_.get()) |
| 191 GaiaConstants::kSyncService, "token"); | 191 ->IssueAuthTokenForTest(GaiaConstants::kSyncService, "token"); |
| 192 | 192 |
| 193 sync_service_->Initialize(); | 193 sync_service_->Initialize(); |
| 194 base::MessageLoop::current()->Run(); | 194 base::MessageLoop::current()->Run(); |
| 195 | 195 |
| 196 // It's possible this test triggered an unrecoverable error, in which case | 196 // It's possible this test triggered an unrecoverable error, in which case |
| 197 // we can't get the preference count. | 197 // we can't get the preference count. |
| 198 if (sync_service_->ShouldPushChanges()) { | 198 if (sync_service_->ShouldPushChanges()) { |
| 199 EXPECT_EQ(GetSyncPreferenceCount(), | 199 EXPECT_EQ(GetSyncPreferenceCount(), |
| 200 association_stats_.num_sync_items_after_association); | 200 association_stats_.num_sync_items_after_association); |
| 201 } | 201 } |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 EXPECT_FALSE(pref->IsDefaultValue()); | 685 EXPECT_FALSE(pref->IsDefaultValue()); |
| 686 // There should be no synced value. | 686 // There should be no synced value. |
| 687 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 687 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 688 // Switch kHomePage back to unmanaged. | 688 // Switch kHomePage back to unmanaged. |
| 689 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 689 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
| 690 // The original value should be picked up. | 690 // The original value should be picked up. |
| 691 EXPECT_TRUE(pref->IsDefaultValue()); | 691 EXPECT_TRUE(pref->IsDefaultValue()); |
| 692 // There should still be no synced value. | 692 // There should still be no synced value. |
| 693 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 693 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
| 694 } | 694 } |
| OLD | NEW |