| Index: chrome/browser/signin/signin_manager_unittest.cc
|
| diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc
|
| index eae9d7ae11a016cb0b9840242cc4467a58ec85f7..df7a166ac8fbf96f0634876df40f3a530cb26b71 100644
|
| --- a/chrome/browser/signin/signin_manager_unittest.cc
|
| +++ b/chrome/browser/signin/signin_manager_unittest.cc
|
| @@ -211,7 +211,7 @@ class SigninManagerTest : public TokenServiceTestHarness {
|
| manager_.reset(new SigninManager(
|
| scoped_ptr<SigninManagerDelegate>(
|
| new ChromeSigninManagerDelegate(profile_.get()))));
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername());
|
| }
|
|
|
| @@ -257,7 +257,7 @@ class SigninManagerTest : public TokenServiceTestHarness {
|
| // NOTE: ClientLogin's "StartSignin" is called after collecting credentials
|
| // from the user.
|
| TEST_F(SigninManagerTest, SignInClientLogin) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->StartSignIn(
|
| @@ -283,12 +283,12 @@ TEST_F(SigninManagerTest, SignInClientLogin) {
|
| manager_.reset(new SigninManager(
|
| scoped_ptr<SigninManagerDelegate>(
|
| new ChromeSigninManagerDelegate(profile_.get()))));
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername());
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentials) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->StartSignInWithCredentials(
|
| @@ -301,7 +301,7 @@ TEST_F(SigninManagerTest, SignInWithCredentials) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsNonCanonicalEmail) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->StartSignInWithCredentials(
|
| @@ -314,7 +314,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsNonCanonicalEmail) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsWrongEmail) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // If the email address used to start the sign in does not match the
|
| @@ -329,7 +329,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsWrongEmail) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordValidCookie) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // Set a valid LSID cookie in the test cookie store.
|
| @@ -356,7 +356,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordValidCookie) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordNoValidCookie) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // Since the password is empty, will verify the gaia cookies first.
|
| @@ -374,7 +374,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordNoValidCookie) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordInValidCookie) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // Set an invalid LSID cookie in the test cookie store.
|
| @@ -402,7 +402,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordInValidCookie) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsCallbackComplete) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // Since the password is empty, must verify the gaia cookies first.
|
| @@ -421,7 +421,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsCallbackComplete) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInWithCredentialsCallbackCancel) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| // Since the password is empty, must verify the gaia cookies first.
|
| @@ -441,7 +441,7 @@ TEST_F(SigninManagerTest, SignInWithCredentialsCallbackCancel) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInClientLoginNoGPlus) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| @@ -452,7 +452,7 @@ TEST_F(SigninManagerTest, SignInClientLoginNoGPlus) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, ClearTransientSigninData) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| @@ -480,14 +480,14 @@ TEST_F(SigninManagerTest, ClearTransientSigninData) {
|
| manager_.reset(new SigninManager(
|
| scoped_ptr<SigninManagerDelegate>(
|
| new ChromeSigninManagerDelegate(profile_.get()))));
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
|
|
| // Now make sure we have the right user name.
|
| EXPECT_EQ("user@gmail.com", manager_->GetAuthenticatedUsername());
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignOutClientLogin) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| SimulateValidResponseClientLogin(false);
|
| manager_->OnClientLoginSuccess(credentials_);
|
| @@ -500,12 +500,12 @@ TEST_F(SigninManagerTest, SignOutClientLogin) {
|
| manager_.reset(new SigninManager(
|
| scoped_ptr<SigninManagerDelegate>(
|
| new ChromeSigninManagerDelegate(profile_.get()))));
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignInFailureClientLogin) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| GoogleServiceAuthError error(GoogleServiceAuthError::REQUEST_CANCELED);
|
| manager_->OnClientLoginFailure(error);
|
| @@ -520,12 +520,12 @@ TEST_F(SigninManagerTest, SignInFailureClientLogin) {
|
| manager_.reset(new SigninManager(
|
| scoped_ptr<SigninManagerDelegate>(
|
| new ChromeSigninManagerDelegate(profile_.get()))));
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
| }
|
|
|
| TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR);
|
| manager_->OnClientLoginFailure(error);
|
| @@ -544,7 +544,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, ProvideSecondFactorFailure) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| GoogleServiceAuthError error1(GoogleServiceAuthError::TWO_FACTOR);
|
| manager_->OnClientLoginFailure(error1);
|
| @@ -574,7 +574,7 @@ TEST_F(SigninManagerTest, ProvideSecondFactorFailure) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignOutMidConnect) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| manager_->StartSignIn("username", "password", std::string(), std::string());
|
| EXPECT_EQ("username", manager_->GetUsernameForAuthInProgress());
|
| manager_->SignOut();
|
| @@ -586,7 +586,7 @@ TEST_F(SigninManagerTest, SignOutMidConnect) {
|
| }
|
|
|
| TEST_F(SigninManagerTest, SignOutWhileProhibited) {
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), NULL);
|
| EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
|
|
|
| manager_->SetAuthenticatedUsername("user@gmail.com");
|
| @@ -618,7 +618,7 @@ TEST_F(SigninManagerTest, TestIsWebBasedSigninFlowURL) {
|
| TEST_F(SigninManagerTest, Prohibited) {
|
| g_browser_process->local_state()->SetString(
|
| prefs::kGoogleServicesUsernamePattern, ".*@google.com");
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), g_browser_process->local_state());
|
| EXPECT_TRUE(manager_->IsAllowedUsername("test@google.com"));
|
| EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com"));
|
| EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com"));
|
| @@ -631,7 +631,7 @@ TEST_F(SigninManagerTest, TestAlternateWildcard) {
|
| // the admin entered ".*@google.com").
|
| g_browser_process->local_state()->SetString(
|
| prefs::kGoogleServicesUsernamePattern, "*@google.com");
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), g_browser_process->local_state());
|
| EXPECT_TRUE(manager_->IsAllowedUsername("test@google.com"));
|
| EXPECT_TRUE(manager_->IsAllowedUsername("happy@google.com"));
|
| EXPECT_FALSE(manager_->IsAllowedUsername("test@invalid.com"));
|
| @@ -644,7 +644,7 @@ TEST_F(SigninManagerTest, ProhibitedAtStartup) {
|
| "monkey@invalid.com");
|
| g_browser_process->local_state()->SetString(
|
| prefs::kGoogleServicesUsernamePattern, ".*@google.com");
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), g_browser_process->local_state());
|
| // Currently signed in user is prohibited by policy, so should be signed out.
|
| EXPECT_EQ("", manager_->GetAuthenticatedUsername());
|
| }
|
| @@ -652,7 +652,7 @@ TEST_F(SigninManagerTest, ProhibitedAtStartup) {
|
| TEST_F(SigninManagerTest, ProhibitedAfterStartup) {
|
| std::string user("monkey@invalid.com");
|
| profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, user);
|
| - manager_->Initialize(profile_.get());
|
| + manager_->Initialize(profile_.get(), g_browser_process->local_state());
|
| EXPECT_EQ(user, manager_->GetAuthenticatedUsername());
|
| // Update the profile - user should be signed out.
|
| g_browser_process->local_state()->SetString(
|
|
|