| 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/browser/signin/fake_signin_manager.h" | 10 #include "chrome/browser/signin/fake_signin_manager.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 sync_->AddObserver(&observer_); | 151 sync_->AddObserver(&observer_); |
| 152 sync_->set_synchronous_sync_configuration(); | 152 sync_->set_synchronous_sync_configuration(); |
| 153 } | 153 } |
| 154 | 154 |
| 155 static ProfileKeyedService* BuildCrosService( | 155 static ProfileKeyedService* BuildCrosService( |
| 156 content::BrowserContext* context) { | 156 content::BrowserContext* context) { |
| 157 Profile* profile = static_cast<Profile*>(context); | 157 Profile* profile = static_cast<Profile*>(context); |
| 158 SigninManagerBase* signin = | 158 SigninManagerBase* signin = |
| 159 SigninManagerFactory::GetForProfile(profile); | 159 SigninManagerFactory::GetForProfile(profile); |
| 160 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, | 160 profile->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
| 161 "test_user"); | 161 "test_user@gmail.com"); |
| 162 signin->Initialize(profile, NULL); | 162 signin->Initialize(profile, NULL); |
| 163 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty()); | 163 EXPECT_FALSE(signin->GetAuthenticatedUsername().empty()); |
| 164 return new TestProfileSyncService( | 164 return new TestProfileSyncService( |
| 165 new ProfileSyncComponentsFactoryMock(), | 165 new ProfileSyncComponentsFactoryMock(), |
| 166 profile, | 166 profile, |
| 167 signin, | 167 signin, |
| 168 ProfileSyncService::AUTO_START, | 168 ProfileSyncService::AUTO_START, |
| 169 true); | 169 true); |
| 170 } | 170 } |
| 171 }; | 171 }; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 523 | 523 |
| 524 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); | 524 EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
| 525 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( | 525 TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( |
| 526 GaiaConstants::kSyncService, "sync_token"); | 526 GaiaConstants::kSyncService, "sync_token"); |
| 527 sync_->fail_initial_download(); | 527 sync_->fail_initial_download(); |
| 528 | 528 |
| 529 sync_->Initialize(); | 529 sync_->Initialize(); |
| 530 EXPECT_FALSE(sync_->sync_initialized()); | 530 EXPECT_FALSE(sync_->sync_initialized()); |
| 531 EXPECT_FALSE(sync_->GetBackendForTest()); | 531 EXPECT_FALSE(sync_->GetBackendForTest()); |
| 532 } | 532 } |
| OLD | NEW |