summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser_main.cc3
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.cc5
-rw-r--r--chrome/browser/chromeos/login/existing_user_controller.h1
-rw-r--r--chrome/browser/chromeos/login/google_authenticator.cc9
-rw-r--r--chrome/browser/chromeos/login/google_authenticator.h1
-rw-r--r--chrome/browser/chromeos/login/google_authenticator_unittest.cc38
-rw-r--r--chrome/browser/chromeos/login/login_performer.cc6
-rw-r--r--chrome/browser/chromeos/login/login_performer.h4
-rw-r--r--chrome/browser/chromeos/login/login_screen.cc3
-rw-r--r--chrome/browser/chromeos/login/login_screen.h1
-rw-r--r--chrome/browser/chromeos/login/login_status_consumer.h8
-rw-r--r--chrome/browser/chromeos/login/login_utils.cc11
-rw-r--r--chrome/browser/chromeos/login/login_utils.h4
-rw-r--r--chrome/browser/chromeos/login/mock_authenticator.h3
-rw-r--r--chrome/browser/chromeos/login/mock_login_status_consumer.h5
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator.cc1
-rw-r--r--chrome/browser/chromeos/login/parallel_authenticator_unittest.cc38
-rw-r--r--chrome/browser/chromeos/login/screen_locker.cc6
-rw-r--r--chrome/browser/chromeos/login/screen_locker.h1
19 files changed, 102 insertions, 46 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 848864c..ea90522 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -782,9 +782,10 @@ class StubLogin : public chromeos::LoginStatusConsumer {
}
void OnLoginSuccess(const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
- chromeos::LoginUtils::Get()->CompleteLogin(username, credentials);
+ chromeos::LoginUtils::Get()->CompleteLogin(username, password, credentials);
delete this;
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index c972588..33f6b74 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -457,6 +457,7 @@ void ExistingUserController::ShowError(int error_id,
void ExistingUserController::OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
// LoginPerformer instance will delete itself once online auth result is OK.
@@ -472,7 +473,7 @@ void ExistingUserController::OnLoginSuccess(
!UserManager::Get()->IsKnownUser(username)) {
// For new user login don't launch browser until we pass image screen.
LoginUtils::Get()->EnableBrowserLaunch(false);
- LoginUtils::Get()->CompleteLogin(username, credentials);
+ LoginUtils::Get()->CompleteLogin(username, password, credentials);
ActivateWizard(WizardController::IsDeviceRegistered() ?
WizardController::kUserImageScreenName :
WizardController::kRegistrationScreenName);
@@ -481,7 +482,7 @@ void ExistingUserController::OnLoginSuccess(
WmIpc::Message message(WM_IPC_MESSAGE_WM_HIDE_LOGIN);
WmIpc::instance()->SendMessage(message);
- LoginUtils::Get()->CompleteLogin(username, credentials);
+ LoginUtils::Get()->CompleteLogin(username, password, credentials);
// Delay deletion as we're on the stack.
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 9366ec6..766250a 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -92,6 +92,7 @@ class ExistingUserController : public WmMessageListener::Observer,
virtual void OnLoginFailure(const LoginFailure& error);
virtual void OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests);
virtual void OnOffTheRecordLoginSuccess();
diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc
index c53484b..dbf2594 100644
--- a/chrome/browser/chromeos/login/google_authenticator.cc
+++ b/chrome/browser/chromeos/login/google_authenticator.cc
@@ -114,7 +114,8 @@ void GoogleAuthenticator::PrepareClientLoginAttempt(
}
void GoogleAuthenticator::ClearClientLoginAttempt() {
- password_.clear();
+ // Not clearing the password, because we may need to pass it to the
+ // sync service if login is successful.
login_token_.clear();
login_captcha_.clear();
}
@@ -290,7 +291,10 @@ void GoogleAuthenticator::OnLoginSuccess(
ascii_hash_.c_str(),
&mount_error))) {
BootTimesLoader::Get()->AddLoginTimeMarker("CryptohomeMounted", true);
- consumer_->OnLoginSuccess(username_, credentials, request_pending);
+ consumer_->OnLoginSuccess(username_,
+ password_,
+ credentials,
+ request_pending);
} else if (!unlock_ &&
mount_error == chromeos::kCryptohomeMountErrorKeyFailure) {
consumer_->OnPasswordChangeDetected(credentials);
@@ -334,6 +338,7 @@ void GoogleAuthenticator::CheckLocalaccount(const LoginFailure& error) {
&mount_error)) {
LOG(WARNING) << "Logging in with localaccount: " << localaccount_;
consumer_->OnLoginSuccess(username_,
+ std::string(),
GaiaAuthConsumer::ClientLoginResult(),
false);
} else {
diff --git a/chrome/browser/chromeos/login/google_authenticator.h b/chrome/browser/chromeos/login/google_authenticator.h
index 5b14924..a23a96c 100644
--- a/chrome/browser/chromeos/login/google_authenticator.h
+++ b/chrome/browser/chromeos/login/google_authenticator.h
@@ -71,6 +71,7 @@ class GoogleAuthenticator : public Authenticator, public GaiaAuthConsumer {
system_salt_ = new_salt;
}
void set_username(const std::string& fake_user) { username_ = fake_user; }
+ void set_password(const std::string& fake_pass) { password_ = fake_pass; }
void set_password_hash(const std::string& fake_hash) {
ascii_hash_ = fake_hash;
}
diff --git a/chrome/browser/chromeos/login/google_authenticator_unittest.cc b/chrome/browser/chromeos/login/google_authenticator_unittest.cc
index 0972b9a..956742a 100644
--- a/chrome/browser/chromeos/login/google_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/google_authenticator_unittest.cc
@@ -49,6 +49,7 @@ class GoogleAuthenticatorTest : public ::testing::Test {
public:
GoogleAuthenticatorTest()
: username_("me@nowhere.org"),
+ password_("fakepass"),
result_("", "", "", ""),
bytes_as_ascii_("ffff"),
user_manager_(new MockUserManager) {
@@ -126,9 +127,10 @@ class GoogleAuthenticatorTest : public ::testing::Test {
void PrepForLogin(GoogleAuthenticator* auth) {
auth->set_password_hash(hash_ascii_);
auth->set_username(username_);
+ auth->set_password(password_);
auth->SetLocalaccount("");
auth->set_user_manager(user_manager_.get());
- ON_CALL(*user_manager_.get(), IsKnownUser(_))
+ ON_CALL(*user_manager_.get(), IsKnownUser(username_))
.WillByDefault(Return(true));
}
@@ -148,6 +150,7 @@ class GoogleAuthenticatorTest : public ::testing::Test {
unsigned char fake_hash_[32];
std::string hash_ascii_;
std::string username_;
+ std::string password_;
GaiaAuthConsumer::ClientLoginResult result_;
// Mocks, destroyed by CrosLibrary class.
MockCryptohomeLibrary* mock_library_;
@@ -208,7 +211,7 @@ TEST_F(GoogleAuthenticatorTest, ReadNoLocalaccount) {
TEST_F(GoogleAuthenticatorTest, OnLoginSuccess) {
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, _, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, password_, _, false))
.Times(1)
.RetiresOnSaturation();
@@ -219,6 +222,7 @@ TEST_F(GoogleAuthenticatorTest, OnLoginSuccess) {
scoped_refptr<GoogleAuthenticator> auth(new GoogleAuthenticator(&consumer));
auth->set_password_hash(hash_ascii_);
auth->set_username(username_);
+ auth->set_password(password_);
auth->OnLoginSuccess(result_, false);
}
@@ -242,7 +246,7 @@ TEST_F(GoogleAuthenticatorTest, PasswordChange) {
EXPECT_CALL(consumer, OnPasswordChangeDetected(result_))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(consumer, OnLoginSuccess(username_, result_, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, password_, result_, false))
.Times(1)
.RetiresOnSaturation();
@@ -297,7 +301,7 @@ TEST_F(GoogleAuthenticatorTest, ForgetOldData) {
EXPECT_CALL(consumer, OnPasswordChangeDetected(result_))
.Times(1)
.RetiresOnSaturation();
- EXPECT_CALL(consumer, OnLoginSuccess(username_, result_, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, password_, result_, false))
.Times(1)
.RetiresOnSaturation();
@@ -357,6 +361,9 @@ TEST_F(GoogleAuthenticatorTest, LoginDenied) {
scoped_refptr<GoogleAuthenticator> auth(new GoogleAuthenticator(&consumer));
PrepForFailedLogin(auth.get());
+ EXPECT_CALL(*user_manager_.get(), IsKnownUser(username_))
+ .WillOnce(Return(true))
+ .RetiresOnSaturation();
auth->OnClientLoginFailure(client_error);
message_loop.RunAllPending();
}
@@ -446,7 +453,7 @@ TEST_F(GoogleAuthenticatorTest, OfflineLogin) {
GoogleServiceAuthError::FromConnectionError(net::ERR_CONNECTION_RESET));
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, result_, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, password_, result_, false))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_library_, CheckKey(username_, hash_ascii_))
@@ -467,7 +474,7 @@ TEST_F(GoogleAuthenticatorTest, OnlineLogin) {
BrowserThread ui_thread(BrowserThread::UI, &message_loop);
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, result_, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, password_, result_, false))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_library_, Mount(username_, hash_ascii_, _))
@@ -488,7 +495,7 @@ TEST_F(GoogleAuthenticatorTest, CheckLocalaccount) {
URLRequestStatus status(URLRequestStatus::SUCCESS, 0);
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, _, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, std::string(), _, false))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_library_, MountForBwsi(_))
@@ -510,7 +517,7 @@ TEST_F(GoogleAuthenticatorTest, LocalaccountLogin) {
BrowserThread ui_thread(BrowserThread::UI, &message_loop);
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, _, false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_, std::string(), _, false))
.WillOnce(Invoke(MockConsumer::OnSuccessQuit))
.RetiresOnSaturation();
EXPECT_CALL(*mock_library_, MountForBwsi(_))
@@ -553,7 +560,10 @@ TEST_F(GoogleAuthenticatorTest, FullLogin) {
chromeos::CryptohomeBlob salt_v(fake_hash_, fake_hash_ + sizeof(fake_hash_));
MockConsumer consumer;
- EXPECT_CALL(consumer, OnLoginSuccess(username_, Eq(result_), false))
+ EXPECT_CALL(consumer, OnLoginSuccess(username_,
+ password_,
+ Eq(result_),
+ false))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*mock_library_, Mount(username_, _, _))
@@ -575,7 +585,7 @@ TEST_F(GoogleAuthenticatorTest, FullLogin) {
.RetiresOnSaturation();
auth->set_user_manager(user_manager_.get());
auth->AuthenticateToLogin(
- &profile, username_, hash_ascii_, std::string(), std::string());
+ &profile, username_, password_, std::string(), std::string());
URLFetcher::set_factory(NULL);
message_loop.RunAllPending();
@@ -596,7 +606,7 @@ TEST_F(GoogleAuthenticatorTest, FullHostedLogin) {
.WillOnce(Invoke(MockConsumer::OnFailQuit))
.RetiresOnSaturation();
// A failure case, but we still want the test to finish gracefully.
- ON_CALL(consumer, OnLoginSuccess(username_, _, _))
+ ON_CALL(consumer, OnLoginSuccess(username_, password_, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
EXPECT_CALL(*mock_library_, GetSystemSalt())
@@ -639,7 +649,7 @@ TEST_F(GoogleAuthenticatorTest, FullHostedLoginFailure) {
.WillOnce(Invoke(MockConsumer::OnFailQuit))
.RetiresOnSaturation();
// A failure case, but we still want the test to finish gracefully.
- ON_CALL(consumer, OnLoginSuccess(username_, _, _))
+ ON_CALL(consumer, OnLoginSuccess(username_, password_, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
EXPECT_CALL(*mock_library_, GetSystemSalt())
@@ -681,7 +691,7 @@ TEST_F(GoogleAuthenticatorTest, CancelLogin) {
.RetiresOnSaturation();
// A failure case, but we still want the test to finish gracefully.
- ON_CALL(consumer, OnLoginSuccess(username_, _, _))
+ ON_CALL(consumer, OnLoginSuccess(username_, password_, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
// Stuff we expect to happen along the way.
@@ -732,7 +742,7 @@ TEST_F(GoogleAuthenticatorTest, CancelLoginAlreadyGotLocalaccount) {
.RetiresOnSaturation();
// A failure case, but we still want the test to finish gracefully.
- ON_CALL(consumer, OnLoginSuccess(username_, _, _))
+ ON_CALL(consumer, OnLoginSuccess(username_, password_, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
// Stuff we expect to happen along the way.
diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc
index 7424c33..8889bb2 100644
--- a/chrome/browser/chromeos/login/login_performer.cc
+++ b/chrome/browser/chromeos/login/login_performer.cc
@@ -43,10 +43,14 @@ void LoginPerformer::OnLoginFailure(const LoginFailure& failure) {
void LoginPerformer::OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
if (delegate_) {
- delegate_->OnLoginSuccess(username, credentials, pending_requests);
+ delegate_->OnLoginSuccess(username,
+ password,
+ credentials,
+ pending_requests);
if (!pending_requests)
MessageLoop::current()->DeleteSoon(FROM_HERE, this);
} else {
diff --git a/chrome/browser/chromeos/login/login_performer.h b/chrome/browser/chromeos/login/login_performer.h
index 59f5215..e594723 100644
--- a/chrome/browser/chromeos/login/login_performer.h
+++ b/chrome/browser/chromeos/login/login_performer.h
@@ -42,7 +42,9 @@ class LoginPerformer : public LoginStatusConsumer,
// LoginStatusConsumer implementation:
virtual void OnLoginFailure(const LoginFailure& error);
- virtual void OnLoginSuccess(const std::string& username,
+ virtual void OnLoginSuccess(
+ const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests);
virtual void OnOffTheRecordLoginSuccess();
diff --git a/chrome/browser/chromeos/login/login_screen.cc b/chrome/browser/chromeos/login/login_screen.cc
index cb6aa1e..ca723e7 100644
--- a/chrome/browser/chromeos/login/login_screen.cc
+++ b/chrome/browser/chromeos/login/login_screen.cc
@@ -103,12 +103,13 @@ void LoginScreen::OnLoginFailure(const LoginFailure& failure) {
void LoginScreen::OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
delegate()->GetObserver(this)->OnExit(ScreenObserver::LOGIN_SIGN_IN_SELECTED);
AppendStartUrlToCmdline();
- LoginUtils::Get()->CompleteLogin(username, credentials);
+ LoginUtils::Get()->CompleteLogin(username, password, credentials);
}
void LoginScreen::OnOffTheRecordLoginSuccess() {
diff --git a/chrome/browser/chromeos/login/login_screen.h b/chrome/browser/chromeos/login/login_screen.h
index 0a4364b..f339508 100644
--- a/chrome/browser/chromeos/login/login_screen.h
+++ b/chrome/browser/chromeos/login/login_screen.h
@@ -46,6 +46,7 @@ class LoginScreen : public ViewScreen<NewUserView>,
virtual void OnLoginFailure(const LoginFailure& error);
virtual void OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests);
virtual void OnOffTheRecordLoginSuccess();
diff --git a/chrome/browser/chromeos/login/login_status_consumer.h b/chrome/browser/chromeos/login/login_status_consumer.h
index b13abb2..da30369 100644
--- a/chrome/browser/chromeos/login/login_status_consumer.h
+++ b/chrome/browser/chromeos/login/login_status_consumer.h
@@ -97,11 +97,13 @@ class LoginStatusConsumer {
virtual ~LoginStatusConsumer() {}
// The current login attempt has ended in failure, with error |error|.
virtual void OnLoginFailure(const LoginFailure& error) = 0;
- // The current login attempt has succeeded for |username|, returning
- // |credentials|. If |pending_requests| is false, we're totally done.
- // If it's true, we will still have some more results to report later.
+ // The current login attempt has succeeded for
+ // |username|/|password|, returning |credentials|. If
+ // |pending_requests| is false, we're totally done. If it's true,
+ // we will still have some more results to report later.
virtual void OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) = 0;
// The current guest login attempt has succeeded.
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 69e80bb..bfe62b1 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/profile_manager.h"
+#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/logging_chrome.h"
@@ -66,7 +67,9 @@ class LoginUtilsImpl : public LoginUtils {
// Invoked after the user has successfully logged in. This launches a browser
// and does other bookkeeping after logging in.
- virtual void CompleteLogin(const std::string& username,
+ virtual void CompleteLogin(
+ const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials);
// Invoked after the tmpfs is successfully mounted.
@@ -116,7 +119,9 @@ class LoginUtilsWrapper {
DISALLOW_COPY_AND_ASSIGN(LoginUtilsWrapper);
};
-void LoginUtilsImpl::CompleteLogin(const std::string& username,
+void LoginUtilsImpl::CompleteLogin(
+ const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials) {
BootTimesLoader* btl = BootTimesLoader::Get();
@@ -179,7 +184,7 @@ void LoginUtilsImpl::CompleteLogin(const std::string& username,
// Set the CrOS user by getting this constructor run with the
// user's email on first retrieval.
- profile->GetProfileSyncService(username);
+ profile->GetProfileSyncService(username)->SetPassphrase(password);
btl->AddLoginTimeMarker("SyncStarted", false);
// Attempt to take ownership; this will fail if device is already owned.
diff --git a/chrome/browser/chromeos/login/login_utils.h b/chrome/browser/chromeos/login/login_utils.h
index 165e048..26c4c50 100644
--- a/chrome/browser/chromeos/login/login_utils.h
+++ b/chrome/browser/chromeos/login/login_utils.h
@@ -35,7 +35,9 @@ class LoginUtils {
// Invoked after the user has successfully logged in. This launches a browser
// and does other bookkeeping after logging in.
- virtual void CompleteLogin(const std::string& username,
+ virtual void CompleteLogin(
+ const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials) = 0;
// Invoked after the tmpfs is successfully mounted.
diff --git a/chrome/browser/chromeos/login/mock_authenticator.h b/chrome/browser/chromeos/login/mock_authenticator.h
index 69532bc..0ac6dec 100644
--- a/chrome/browser/chromeos/login/mock_authenticator.h
+++ b/chrome/browser/chromeos/login/mock_authenticator.h
@@ -73,6 +73,7 @@ class MockAuthenticator : public Authenticator {
// If we want to be more like the real thing, we could save username
// in AuthenticateToLogin, but there's not much of a point.
consumer_->OnLoginSuccess(expected_username_,
+ expected_password_,
credentials,
request_pending);
}
@@ -117,8 +118,10 @@ class MockLoginUtils : public LoginUtils {
}
virtual void CompleteLogin(const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& res) {
EXPECT_EQ(expected_username_, username);
+ EXPECT_EQ(expected_password_, password);
}
virtual void CompleteOffTheRecordLogin(const GURL& start_url) {
diff --git a/chrome/browser/chromeos/login/mock_login_status_consumer.h b/chrome/browser/chromeos/login/mock_login_status_consumer.h
index 3f0317c..a3dcd19 100644
--- a/chrome/browser/chromeos/login/mock_login_status_consumer.h
+++ b/chrome/browser/chromeos/login/mock_login_status_consumer.h
@@ -18,8 +18,9 @@ class MockConsumer : public LoginStatusConsumer {
MockConsumer() {}
~MockConsumer() {}
MOCK_METHOD1(OnLoginFailure, void(const LoginFailure& error));
- MOCK_METHOD3(OnLoginSuccess, void(
+ MOCK_METHOD4(OnLoginSuccess, void(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& result,
bool pending_requests));
MOCK_METHOD0(OnOffTheRecordLoginSuccess, void(void));
@@ -41,6 +42,7 @@ class MockConsumer : public LoginStatusConsumer {
// Compatible with LoginStatusConsumer::OnLoginSuccess()
static void OnSuccessQuit(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
MessageLoop::current()->Quit();
@@ -48,6 +50,7 @@ class MockConsumer : public LoginStatusConsumer {
static void OnSuccessQuitAndFail(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& credentials,
bool pending_requests) {
ADD_FAILURE() << "Login should NOT have succeeded!";
diff --git a/chrome/browser/chromeos/login/parallel_authenticator.cc b/chrome/browser/chromeos/login/parallel_authenticator.cc
index 79812a3..7ce7174 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator.cc
@@ -141,6 +141,7 @@ void ParallelAuthenticator::OnLoginSuccess(
already_reported_success_ = true;
}
consumer_->OnLoginSuccess(current_state_->username,
+ current_state_->password,
credentials,
request_pending);
}
diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
index 1920717..e9210dc 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
@@ -48,7 +48,8 @@ class ParallelAuthenticatorTest : public ::testing::Test {
ui_thread_(BrowserThread::UI, &message_loop_),
file_thread_(BrowserThread::FILE),
io_thread_(BrowserThread::IO),
- username_("me@nowhere.org") {
+ username_("me@nowhere.org"),
+ password_("fakepass") {
hash_ascii_.assign("0a010000000000a0");
hash_ascii_.append(std::string(16, '0'));
}
@@ -73,6 +74,11 @@ class ParallelAuthenticatorTest : public ::testing::Test {
io_thread_.Start();
auth_ = new ParallelAuthenticator(&consumer_);
+ state_.reset(new TestAttemptState(username_,
+ password_,
+ hash_ascii_,
+ "",
+ ""));
}
// Tears down the test fixture.
@@ -132,7 +138,7 @@ class ParallelAuthenticatorTest : public ::testing::Test {
// Allow test to fail and exit gracefully, even if OnLoginSuccess()
// wasn't supposed to happen.
void FailOnLoginSuccess() {
- ON_CALL(consumer_, OnLoginSuccess(_, _, _))
+ ON_CALL(consumer_, OnLoginSuccess(_, _, _, _))
.WillByDefault(Invoke(MockConsumer::OnSuccessQuitAndFail));
}
@@ -150,9 +156,10 @@ class ParallelAuthenticatorTest : public ::testing::Test {
}
void ExpectLoginSuccess(const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& result,
bool pending) {
- EXPECT_CALL(consumer_, OnLoginSuccess(username, result, pending))
+ EXPECT_CALL(consumer_, OnLoginSuccess(username, password, result, pending))
.WillOnce(Invoke(MockConsumer::OnSuccessQuit))
.RetiresOnSaturation();
}
@@ -193,6 +200,7 @@ class ParallelAuthenticatorTest : public ::testing::Test {
BrowserThread io_thread_;
std::string username_;
+ std::string password_;
std::string hash_ascii_;
GaiaAuthConsumer::ClientLoginResult result_;
@@ -247,7 +255,7 @@ TEST_F(ParallelAuthenticatorTest, ReadNoLocalaccount) {
}
TEST_F(ParallelAuthenticatorTest, OnLoginSuccess) {
- EXPECT_CALL(consumer_, OnLoginSuccess(username_, result_, false))
+ EXPECT_CALL(consumer_, OnLoginSuccess(username_, password_, result_, false))
.Times(1)
.RetiresOnSaturation();
@@ -333,7 +341,7 @@ TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) {
}
TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, password_, result_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
@@ -386,7 +394,7 @@ TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) {
}
TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, password_, result_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a key migration.
@@ -466,7 +474,7 @@ TEST_F(ParallelAuthenticatorTest, ResolveCreateNew) {
}
TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, password_, result_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
@@ -491,7 +499,7 @@ TEST_F(ParallelAuthenticatorTest, DriveCreateForNewUser) {
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, password_, result_, false);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
@@ -508,7 +516,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLogin) {
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginDelayedOnline) {
- ExpectLoginSuccess(username_, result_, true);
+ ExpectLoginSuccess(username_, password_, result_, true);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
@@ -529,7 +537,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginDelayedOnline) {
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
- ExpectLoginSuccess(username_, result_, true);
+ ExpectLoginSuccess(username_, password_, result_, true);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a key migration.
@@ -558,7 +566,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
RunResolve(auth_.get(), &message_loop_);
// After the request below completes, OnLoginSuccess gets called again.
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, password_, result_, false);
MockFactory<SuccessFetcher> factory;
URLFetcher::set_factory(&factory);
@@ -574,7 +582,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
GaiaAuthConsumer::ClientLoginResult success("sid", "lsid", "", "");
- ExpectLoginSuccess(username_, success, false);
+ ExpectLoginSuccess(username_, password_, success, false);
FailOnLoginFailure();
// Set up state as though a cryptohome mount attempt has occurred and
@@ -590,7 +598,7 @@ TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
TEST_F(ParallelAuthenticatorTest, DriveNeedNewPassword) {
FailOnLoginSuccess(); // Set failing on success as the default...
// ...but expect ONE successful login first.
- ExpectLoginSuccess(username_, result_, true);
+ ExpectLoginSuccess(username_, password_, result_, true);
GoogleServiceAuthError error(
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS);
LoginFailure failure = LoginFailure::FromNetworkAuthFailure(error);
@@ -640,7 +648,7 @@ TEST_F(ParallelAuthenticatorTest, DriveLocalLogin) {
}
TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, std::string(), result_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to respond successfully to a cryptohome
@@ -658,7 +666,7 @@ TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
}
TEST_F(ParallelAuthenticatorTest, DriveLocalUnlock) {
- ExpectLoginSuccess(username_, result_, false);
+ ExpectLoginSuccess(username_, std::string(), result_, false);
FailOnLoginFailure();
// Set up mock cryptohome library to fail a cryptohome key-check
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index 0f3fbfc..aed91fb 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -440,7 +440,10 @@ class InputEventObserver : public MessageLoopForUI::Observer {
activated_ = true;
std::string not_used_string;
GaiaAuthConsumer::ClientLoginResult not_used;
- screen_locker_->OnLoginSuccess(not_used_string, not_used, false);
+ screen_locker_->OnLoginSuccess(not_used_string,
+ not_used_string,
+ not_used,
+ false);
}
}
@@ -608,6 +611,7 @@ void ScreenLocker::OnLoginFailure(const LoginFailure& error) {
void ScreenLocker::OnLoginSuccess(
const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& unused,
bool pending_requests) {
LOG(INFO) << "OnLoginSuccess: Sending Unlock request.";
diff --git a/chrome/browser/chromeos/login/screen_locker.h b/chrome/browser/chromeos/login/screen_locker.h
index 929a026..26f03a8 100644
--- a/chrome/browser/chromeos/login/screen_locker.h
+++ b/chrome/browser/chromeos/login/screen_locker.h
@@ -52,6 +52,7 @@ class ScreenLocker : public LoginStatusConsumer,
// LoginStatusConsumer implements:
virtual void OnLoginFailure(const chromeos::LoginFailure& error);
virtual void OnLoginSuccess(const std::string& username,
+ const std::string& password,
const GaiaAuthConsumer::ClientLoginResult& result,
bool pending_requests);