diff options
author | Iain Merrick <husky@google.com> | 2010-11-01 12:19:54 +0000 |
---|---|---|
committer | Iain Merrick <husky@google.com> | 2010-11-03 10:21:10 +0000 |
commit | 731df977c0511bca2206b5f333555b1205ff1f43 (patch) | |
tree | 0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/sync/signin_manager_unittest.cc | |
parent | 5add15e10e7bb80512f2c597ca57221314abe577 (diff) | |
download | external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2 |
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/sync/signin_manager_unittest.cc')
-rw-r--r-- | chrome/browser/sync/signin_manager_unittest.cc | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/chrome/browser/sync/signin_manager_unittest.cc b/chrome/browser/sync/signin_manager_unittest.cc index 7a4114a..5659533 100644 --- a/chrome/browser/sync/signin_manager_unittest.cc +++ b/chrome/browser/sync/signin_manager_unittest.cc @@ -106,6 +106,53 @@ TEST_F(SigninManagerTest, SignInFailure) { EXPECT_TRUE(manager_->GetUsername().empty()); } +TEST_F(SigninManagerTest, ProvideSecondFactorSuccess) { + manager_->Initialize(profile_.get()); + manager_->StartSignIn("username", "password", "", ""); + GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR); + manager_->OnClientLoginFailure(error); + + EXPECT_EQ(0U, google_login_success_.size()); + EXPECT_EQ(1U, google_login_failure_.size()); + + EXPECT_FALSE(manager_->GetUsername().empty()); + + manager_->ProvideSecondFactorAccessCode("access"); + SimulateValidResponse(); + + EXPECT_EQ(1U, google_login_success_.size()); + EXPECT_EQ(1U, google_login_failure_.size()); +} + +TEST_F(SigninManagerTest, ProvideSecondFactorFailure) { + manager_->Initialize(profile_.get()); + manager_->StartSignIn("username", "password", "", ""); + GoogleServiceAuthError error1(GoogleServiceAuthError::TWO_FACTOR); + manager_->OnClientLoginFailure(error1); + + EXPECT_EQ(0U, google_login_success_.size()); + EXPECT_EQ(1U, google_login_failure_.size()); + + EXPECT_FALSE(manager_->GetUsername().empty()); + + manager_->ProvideSecondFactorAccessCode("badaccess"); + GoogleServiceAuthError error2( + GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); + manager_->OnClientLoginFailure(error2); + + EXPECT_EQ(0U, google_login_success_.size()); + EXPECT_EQ(2U, google_login_failure_.size()); + EXPECT_FALSE(manager_->GetUsername().empty()); + + manager_->ProvideSecondFactorAccessCode("badaccess"); + GoogleServiceAuthError error3(GoogleServiceAuthError::CONNECTION_FAILED); + manager_->OnClientLoginFailure(error3); + + EXPECT_EQ(0U, google_login_success_.size()); + EXPECT_EQ(3U, google_login_failure_.size()); + EXPECT_TRUE(manager_->GetUsername().empty()); +} + TEST_F(SigninManagerTest, SignOutMidConnect) { manager_->Initialize(profile_.get()); manager_->StartSignIn("username", "password", "", ""); |