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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 done.Wait(); | 134 done.Wait(); |
135 base::RunLoop().RunUntilIdle(); | 135 base::RunLoop().RunUntilIdle(); |
136 if (service->sync_initialized()) { | 136 if (service->sync_initialized()) { |
137 return; | 137 return; |
138 } | 138 } |
139 } | 139 } |
140 LOG(ERROR) << "Backend not initialized."; | 140 LOG(ERROR) << "Backend not initialized."; |
141 } | 141 } |
142 | 142 |
143 void IssueTestTokens() { | 143 void IssueTestTokens() { |
144 TokenService* token_service = | 144 ProfileOAuth2TokenServiceFactory::GetForProfile(profile.get()) |
145 TokenServiceFactory::GetForProfile(profile.get()); | 145 ->UpdateCredentials("test", "oauth2_login_token"); |
146 token_service->IssueAuthTokenForTest( | 146 TokenServiceFactory::GetForProfile(profile.get()) |
147 GaiaConstants::kGaiaOAuth2LoginRefreshToken, "oauth2_login_token"); | 147 ->IssueAuthTokenForTest(GaiaConstants::kSyncService, "token"); |
148 token_service->IssueAuthTokenForTest( | |
149 GaiaConstants::kSyncService, "token"); | |
150 } | 148 } |
151 | 149 |
152 scoped_ptr<TestProfileSyncService> service; | 150 scoped_ptr<TestProfileSyncService> service; |
153 scoped_ptr<TestingProfile> profile; | 151 scoped_ptr<TestingProfile> profile; |
154 | 152 |
155 private: | 153 private: |
156 content::TestBrowserThreadBundle thread_bundle_; | 154 content::TestBrowserThreadBundle thread_bundle_; |
157 }; | 155 }; |
158 | 156 |
159 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { | 157 class TestProfileSyncServiceObserver : public ProfileSyncServiceObserver { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
289 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); | 287 harness_.profile->GetPrefs()->GetBoolean(prefs::kSyncSuppressStart)); |
290 } | 288 } |
291 | 289 |
292 // Certain ProfileSyncService tests don't apply to Chrome OS, for example | 290 // Certain ProfileSyncService tests don't apply to Chrome OS, for example |
293 // things that deal with concepts like "signing out" and policy. | 291 // things that deal with concepts like "signing out" and policy. |
294 #if !defined (OS_CHROMEOS) | 292 #if !defined (OS_CHROMEOS) |
295 | 293 |
296 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) { | 294 TEST_F(ProfileSyncServiceTest, EnableSyncAndSignOut) { |
297 SigninManager* signin = | 295 SigninManager* signin = |
298 SigninManagerFactory::GetForProfile(harness_.profile.get()); | 296 SigninManagerFactory::GetForProfile(harness_.profile.get()); |
299 signin->SetAuthenticatedUsername("test@test.com"); | 297 signin->SetAuthenticatedUsername("test"); |
Andrew T Wilson (Slow)
2013/09/06 09:23:10
Why did we change the username here?
fgorski
2013/09/12 23:46:24
Sync service does not care, as long as it is set,
| |
300 ProfileSyncComponentsFactoryMock* factory = | 298 ProfileSyncComponentsFactoryMock* factory = |
301 new ProfileSyncComponentsFactoryMock(); | 299 new ProfileSyncComponentsFactoryMock(); |
302 harness_.service.reset(new TestProfileSyncService( | 300 harness_.service.reset(new TestProfileSyncService( |
303 factory, | 301 factory, |
304 harness_.profile.get(), | 302 harness_.profile.get(), |
305 signin, | 303 signin, |
306 ProfileSyncService::AUTO_START, | 304 ProfileSyncService::AUTO_START, |
307 true)); | 305 true)); |
308 // Register the bookmark data type. | 306 // Register the bookmark data type. |
309 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _, _)). | 307 EXPECT_CALL(*factory, CreateDataTypeManager(_, _, _, _, _, _)). |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
478 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { | 476 TEST_F(ProfileSyncServiceTest, FailToDownloadControlTypes) { |
479 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, | 477 harness_.StartSyncServiceAndSetInitialSyncEnded(false, true, true, true, |
480 syncer::STORAGE_IN_MEMORY); | 478 syncer::STORAGE_IN_MEMORY); |
481 | 479 |
482 // The backend is not ready. Ensure the PSS knows this. | 480 // The backend is not ready. Ensure the PSS knows this. |
483 EXPECT_FALSE(harness_.service->sync_initialized()); | 481 EXPECT_FALSE(harness_.service->sync_initialized()); |
484 } | 482 } |
485 | 483 |
486 } // namespace | 484 } // namespace |
487 } // namespace browser_sync | 485 } // namespace browser_sync |
OLD | NEW |