Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/chromeos/login/mock_authenticator.h

Issue 2729020: Show Captcha dialog. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: remove debug line Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "chrome/browser/chromeos/login/authenticator.h" 10 #include "chrome/browser/chromeos/login/authenticator.h"
(...skipping 13 matching lines...) Expand all
24 const std::string& expected_password) 24 const std::string& expected_password)
25 : Authenticator(consumer), 25 : Authenticator(consumer),
26 expected_username_(expected_username), 26 expected_username_(expected_username),
27 expected_password_(expected_password) { 27 expected_password_(expected_password) {
28 } 28 }
29 29
30 // Returns true after posting task to UI thread to call OnLoginSuccess(). 30 // Returns true after posting task to UI thread to call OnLoginSuccess().
31 // This is called on the FILE thread now, so we need to do this. 31 // This is called on the FILE thread now, so we need to do this.
32 virtual bool AuthenticateToLogin(Profile* profile, 32 virtual bool AuthenticateToLogin(Profile* profile,
33 const std::string& username, 33 const std::string& username,
34 const std::string& password) { 34 const std::string& password,
35 const std::string& login_token,
36 const std::string& login_captcha) {
35 if (expected_username_ == username && 37 if (expected_username_ == username &&
36 expected_password_ == password) { 38 expected_password_ == password) {
37 ChromeThread::PostTask( 39 ChromeThread::PostTask(
38 ChromeThread::UI, FROM_HERE, 40 ChromeThread::UI, FROM_HERE,
39 NewRunnableMethod(this, 41 NewRunnableMethod(this,
40 &MockAuthenticator::OnLoginSuccess, 42 &MockAuthenticator::OnLoginSuccess,
41 username)); 43 username));
42 return true; 44 return true;
43 } else { 45 } else {
44 ChromeThread::PostTask( 46 ChromeThread::PostTask(
45 ChromeThread::UI, FROM_HERE, 47 ChromeThread::UI, FROM_HERE,
46 NewRunnableMethod(this, 48 NewRunnableMethod(this,
47 &MockAuthenticator::OnLoginFailure, 49 &MockAuthenticator::OnLoginFailure,
48 std::string("Login failed"))); 50 std::string("Login failed")));
49 return false; 51 return false;
50 } 52 }
51 } 53 }
52 54
53 virtual bool AuthenticateToUnlock(const std::string& username, 55 virtual bool AuthenticateToUnlock(const std::string& username,
54 const std::string& password) { 56 const std::string& password) {
55 return AuthenticateToLogin(NULL /* not used */, username, password); 57 return AuthenticateToLogin(NULL /* not used */, username, password,
58 std::string(), std::string());
56 } 59 }
57 60
58 virtual void LoginOffTheRecord() { 61 virtual void LoginOffTheRecord() {
59 consumer_->OnOffTheRecordLoginSuccess(); 62 consumer_->OnOffTheRecordLoginSuccess();
60 } 63 }
61 64
62 void OnLoginSuccess(const std::string& username) { 65 void OnLoginSuccess(const std::string& username) {
63 consumer_->OnLoginSuccess(username, std::string()); 66 consumer_->OnLoginSuccess(username, std::string());
64 } 67 }
65 68
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 std::string expected_username_; 120 std::string expected_username_;
118 std::string expected_password_; 121 std::string expected_password_;
119 std::string auth_token_; 122 std::string auth_token_;
120 123
121 DISALLOW_COPY_AND_ASSIGN(MockLoginUtils); 124 DISALLOW_COPY_AND_ASSIGN(MockLoginUtils);
122 }; 125 };
123 126
124 } // namespace chromeos 127 } // namespace chromeos
125 128
126 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 129 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/login_utils.cc ('k') | chrome/browser/chromeos/login/user_image_downloader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698