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

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

Issue 12704002: Support for auth code based authentication flow for both app and web UI driven flow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase4 Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 class Profile; 13 class Profile;
14 14
15 namespace chromeos { 15 namespace chromeos {
16 16
17 class LoginStatusConsumer; 17 class LoginStatusConsumer;
18 18
19 class MockAuthenticator : public Authenticator { 19 class MockAuthenticator : public Authenticator {
20 public: 20 public:
21 MockAuthenticator(LoginStatusConsumer* consumer, 21 MockAuthenticator(LoginStatusConsumer* consumer,
22 const std::string& expected_username, 22 const std::string& expected_username,
23 const std::string& expected_password) 23 const std::string& expected_password)
24 : Authenticator(consumer), 24 : Authenticator(consumer),
25 expected_username_(expected_username), 25 expected_username_(expected_username),
26 expected_password_(expected_password) { 26 expected_password_(expected_password) {
27 } 27 }
28 28
29 virtual void CompleteLogin(Profile* profile, 29 virtual void CompleteLogin(Profile* profile,
30 const std::string& username, 30 const UserCredentials& credentials) OVERRIDE;
31 const std::string& password) OVERRIDE;
32 31
33 virtual void AuthenticateToLogin(Profile* profile, 32 virtual void AuthenticateToLogin(Profile* profile,
34 const std::string& username, 33 const UserCredentials& credentials,
35 const std::string& password,
36 const std::string& login_token, 34 const std::string& login_token,
37 const std::string& login_captcha) OVERRIDE; 35 const std::string& login_captcha) OVERRIDE;
38 36
39 virtual void AuthenticateToUnlock(const std::string& username, 37 virtual void AuthenticateToUnlock(
40 const std::string& password) OVERRIDE; 38 const UserCredentials& credentials) OVERRIDE;
41 39
42 virtual void LoginAsLocallyManagedUser(const std::string& username, 40 virtual void LoginAsLocallyManagedUser(
43 const std::string& password) OVERRIDE; 41 const UserCredentials& credentials) OVERRIDE;
44 virtual void LoginRetailMode() OVERRIDE; 42 virtual void LoginRetailMode() OVERRIDE;
45 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE; 43 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE;
46 virtual void LoginOffTheRecord() OVERRIDE; 44 virtual void LoginOffTheRecord() OVERRIDE;
47 45
48 virtual void OnRetailModeLoginSuccess() OVERRIDE; 46 virtual void OnRetailModeLoginSuccess() OVERRIDE;
49 47
50 virtual void OnLoginSuccess(bool request_pending) OVERRIDE; 48 virtual void OnLoginSuccess(bool request_pending) OVERRIDE;
51 49
52 virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE; 50 virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE;
53 51
54 virtual void RecoverEncryptedData( 52 virtual void RecoverEncryptedData(
55 const std::string& old_password) OVERRIDE {} 53 const std::string& old_password) OVERRIDE {}
56 54
57 virtual void ResyncEncryptedData() OVERRIDE {} 55 virtual void ResyncEncryptedData() OVERRIDE {}
58 56
59 virtual void RetryAuth(Profile* profile, 57 virtual void RetryAuth(Profile* profile,
60 const std::string& username, 58 const UserCredentials& credentials,
61 const std::string& password,
62 const std::string& login_token, 59 const std::string& login_token,
63 const std::string& login_captcha) OVERRIDE {} 60 const std::string& login_captcha) OVERRIDE {}
64 61
65 protected: 62 protected:
66 virtual ~MockAuthenticator() {} 63 virtual ~MockAuthenticator() {}
67 64
68 private: 65 private:
69 std::string expected_username_; 66 std::string expected_username_;
70 std::string expected_password_; 67 std::string expected_password_;
71 68
72 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); 69 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator);
73 }; 70 };
74 71
75 } // namespace chromeos 72 } // namespace chromeos
76 73
77 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 74 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698