Index: chrome/browser/sync/profile_sync_service_startup_unittest.cc |
diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc |
index 1a00308bd8c8646ccfe111bf261ba9c0f61b46ad..9ab4fa145fc97977602180a8716fd65e42781258 100644 |
--- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc |
+++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc |
@@ -22,6 +22,8 @@ |
#include "chrome/common/chrome_notification_types.h" |
#include "chrome/common/pref_names.h" |
#include "chrome/test/base/testing_profile.h" |
+#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/notification_source.h" |
#include "content/public/test/test_browser_thread.h" |
#include "google_apis/gaia/gaia_auth_consumer.h" |
#include "google_apis/gaia/gaia_constants.h" |
@@ -100,9 +102,9 @@ class ProfileSyncServiceStartupTest : public testing::Test { |
} |
static ProfileKeyedService* BuildService(Profile* profile) { |
- SigninManager* signin = static_cast<SigninManager*>( |
+ SigninManagerBase* signin = static_cast<SigninManagerBase*>( |
SigninManagerFactory::GetInstance()->SetTestingFactoryAndUse( |
- profile, FakeSigninManager::Build)); |
+ profile, FakeSigninManagerBase::Build)); |
signin->SetAuthenticatedUsername("test_user"); |
return new TestProfileSyncService( |
new ProfileSyncComponentsFactoryMock(), |
@@ -141,7 +143,8 @@ class ProfileSyncServiceStartupTest : public testing::Test { |
class ProfileSyncServiceStartupCrosTest : public ProfileSyncServiceStartupTest { |
public: |
static ProfileKeyedService* BuildCrosService(Profile* profile) { |
- SigninManager* signin = SigninManagerFactory::GetForProfile(profile); |
+ SigninManagerBase* signin = |
+ SigninManagerFactory::GetForProfile(profile); |
signin->SetAuthenticatedUsername("test_user"); |
return new TestProfileSyncService( |
new ProfileSyncComponentsFactoryMock(), |
@@ -189,7 +192,14 @@ TEST_F(ProfileSyncServiceStartupTest, StartFirstTime) { |
// Create some tokens in the token service; the service will startup when |
// it is notified that tokens are available. |
sync_->SetSetupInProgress(true); |
- sync_->signin()->StartSignIn("test_user", "", "", ""); |
+ sync_->signin()->SetAuthenticatedUsername("test_user"); |
+ profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
+ "test_user"); |
+ GoogleServiceSigninSuccessDetails details("test_user", ""); |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
+ content::Source<Profile>(profile_.get()), |
+ content::Details<const GoogleServiceSigninSuccessDetails>(&details)); |
TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( |
GaiaConstants::kSyncService, "sync_token"); |
TokenServiceFactory::GetForProfile(profile_.get())->IssueAuthTokenForTest( |
@@ -235,7 +245,14 @@ TEST_F(ProfileSyncServiceStartupTest, StartNoCredentials) { |
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
sync_->SetSetupInProgress(true); |
- sync_->signin()->StartSignIn("test_user", "", "", ""); |
+ sync_->signin()->SetAuthenticatedUsername("test_user"); |
+ profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
+ "test_user"); |
+ GoogleServiceSigninSuccessDetails details("test_user", ""); |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
+ content::Source<Profile>(profile_.get()), |
+ content::Details<const GoogleServiceSigninSuccessDetails>(&details)); |
// NOTE: Unlike StartFirstTime, this test does not issue any auth tokens. |
token_service->LoadTokensFromDB(); |
sync_->SetSetupInProgress(false); |
@@ -269,7 +286,14 @@ TEST_F(ProfileSyncServiceStartupTest, StartInvalidCredentials) { |
EXPECT_CALL(*data_type_manager, Stop()).Times(1); |
EXPECT_CALL(observer_, OnStateChanged()).Times(AnyNumber()); |
sync_->SetSetupInProgress(true); |
- sync_->signin()->StartSignIn("test_user", "", "", ""); |
+ sync_->signin()->SetAuthenticatedUsername("test_user"); |
+ profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, |
+ "test_user"); |
+ GoogleServiceSigninSuccessDetails details("test_user", ""); |
+ content::NotificationService::current()->Notify( |
+ chrome::NOTIFICATION_GOOGLE_SIGNIN_SUCCESSFUL, |
+ content::Source<Profile>(profile_.get()), |
+ content::Details<const GoogleServiceSigninSuccessDetails>(&details)); |
Roger Tawa OOO till Jul 10th
2013/04/05 20:53:57
this seems to be duped 3 times. Maybe move into a
tim (not reviewing)
2013/04/05 22:14:12
Done.
|
token_service->IssueAuthTokenForTest( |
GaiaConstants::kSyncService, "sync_token"); |
sync_->SetSetupInProgress(false); |