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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 syncer::BaseNode::INIT_OK) | 142 syncer::BaseNode::INIT_OK) |
143 return 0; | 143 return 0; |
144 return node.GetTotalNodeCount() - 1; | 144 return node.GetTotalNodeCount() - 1; |
145 } | 145 } |
146 | 146 |
147 bool StartSyncService(const base::Closure& callback, | 147 bool StartSyncService(const base::Closure& callback, |
148 bool will_fail_association) { | 148 bool will_fail_association) { |
149 if (sync_service_) | 149 if (sync_service_) |
150 return false; | 150 return false; |
151 | 151 |
152 SigninManager* signin = SigninManagerFactory::GetForProfile(profile_.get()); | 152 SigninManagerBase* signin = |
| 153 SigninManagerFactory::GetForProfile(profile_.get()); |
153 signin->SetAuthenticatedUsername("test"); | 154 signin->SetAuthenticatedUsername("test"); |
154 sync_service_ = static_cast<TestProfileSyncService*>( | 155 sync_service_ = static_cast<TestProfileSyncService*>( |
155 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( | 156 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse( |
156 profile_.get(), &TestProfileSyncService::BuildAutoStartAsyncInit)); | 157 profile_.get(), &TestProfileSyncService::BuildAutoStartAsyncInit)); |
157 sync_service_->set_backend_init_callback(callback); | 158 sync_service_->set_backend_init_callback(callback); |
158 pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>( | 159 pref_sync_service_ = reinterpret_cast<PrefModelAssociator*>( |
159 prefs_->GetSyncableService(syncer::PREFERENCES)); | 160 prefs_->GetSyncableService(syncer::PREFERENCES)); |
160 if (!pref_sync_service_) | 161 if (!pref_sync_service_) |
161 return false; | 162 return false; |
162 ProfileSyncComponentsFactoryMock* components = | 163 ProfileSyncComponentsFactoryMock* components = |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 EXPECT_FALSE(pref->IsDefaultValue()); | 677 EXPECT_FALSE(pref->IsDefaultValue()); |
677 // There should be no synced value. | 678 // There should be no synced value. |
678 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 679 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
679 // Switch kHomePage back to unmanaged. | 680 // Switch kHomePage back to unmanaged. |
680 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); | 681 profile_->GetTestingPrefService()->RemoveManagedPref(prefs::kHomePage); |
681 // The original value should be picked up. | 682 // The original value should be picked up. |
682 EXPECT_TRUE(pref->IsDefaultValue()); | 683 EXPECT_TRUE(pref->IsDefaultValue()); |
683 // There should still be no synced value. | 684 // There should still be no synced value. |
684 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); | 685 EXPECT_TRUE(GetSyncedValue(prefs::kHomePage) == NULL); |
685 } | 686 } |
OLD | NEW |