| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/login/mock_authenticator.h" | 5 #include "chrome/browser/chromeos/login/mock_authenticator.h" |
| 6 | 6 |
| 7 namespace chromeos { | 7 namespace chromeos { |
| 8 | 8 |
| 9 bool MockAuthenticator::AuthenticateToLogin(Profile* profile, | 9 void MockAuthenticator::AuthenticateToLogin(Profile* profile, |
| 10 const std::string& username, | 10 const std::string& username, |
| 11 const std::string& password, | 11 const std::string& password, |
| 12 const std::string& login_token, | 12 const std::string& login_token, |
| 13 const std::string& login_captcha) { | 13 const std::string& login_captcha) { |
| 14 if (expected_username_ == username && expected_password_ == password) { | 14 if (expected_username_ == username && expected_password_ == password) { |
| 15 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 15 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 16 NewRunnableMethod(this, &MockAuthenticator::OnLoginSuccess, | 16 NewRunnableMethod(this, &MockAuthenticator::OnLoginSuccess, |
| 17 GaiaAuthConsumer::ClientLoginResult(), false)); | 17 GaiaAuthConsumer::ClientLoginResult(), false)); |
| 18 return true; | |
| 19 } | 18 } |
| 20 GoogleServiceAuthError error( | 19 GoogleServiceAuthError error( |
| 21 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); | 20 GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
| 22 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 21 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 23 NewRunnableMethod(this, &MockAuthenticator::OnLoginFailure, | 22 NewRunnableMethod(this, &MockAuthenticator::OnLoginFailure, |
| 24 LoginFailure::FromNetworkAuthFailure(error))); | 23 LoginFailure::FromNetworkAuthFailure(error))); |
| 25 return false; | |
| 26 } | 24 } |
| 27 | 25 |
| 28 bool MockAuthenticator::CompleteLogin(Profile* profile, | 26 void MockAuthenticator::CompleteLogin(Profile* profile, |
| 29 const std::string& username, | 27 const std::string& username, |
| 30 const std::string& password) { | 28 const std::string& password) { |
| 31 return false; | |
| 32 } | 29 } |
| 33 | 30 |
| 34 bool MockAuthenticator::AuthenticateToUnlock(const std::string& username, | 31 void MockAuthenticator::AuthenticateToUnlock(const std::string& username, |
| 35 const std::string& password) { | 32 const std::string& password) { |
| 36 return AuthenticateToLogin(NULL /* not used */, username, password, | 33 AuthenticateToLogin(NULL /* not used */, username, password, |
| 37 std::string(), std::string()); | 34 std::string(), std::string()); |
| 38 } | 35 } |
| 39 | 36 |
| 40 void MockAuthenticator::LoginOffTheRecord() { | 37 void MockAuthenticator::LoginOffTheRecord() { |
| 41 consumer_->OnOffTheRecordLoginSuccess(); | 38 consumer_->OnOffTheRecordLoginSuccess(); |
| 42 } | 39 } |
| 43 | 40 |
| 44 void MockAuthenticator::OnLoginSuccess( | 41 void MockAuthenticator::OnLoginSuccess( |
| 45 const GaiaAuthConsumer::ClientLoginResult& credentials, | 42 const GaiaAuthConsumer::ClientLoginResult& credentials, |
| 46 bool request_pending) { | 43 bool request_pending) { |
| 47 // If we want to be more like the real thing, we could save username | 44 // If we want to be more like the real thing, we could save username |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 CommandLine* command_line) { | 123 CommandLine* command_line) { |
| 127 return std::string(); | 124 return std::string(); |
| 128 } | 125 } |
| 129 | 126 |
| 130 bool MockLoginUtils::TransferDefaultCookies(Profile* default_profile, | 127 bool MockLoginUtils::TransferDefaultCookies(Profile* default_profile, |
| 131 Profile* new_profile) { | 128 Profile* new_profile) { |
| 132 return true; | 129 return true; |
| 133 } | 130 } |
| 134 | 131 |
| 135 } // namespace chromeos | 132 } // namespace chromeos |
| OLD | NEW |