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

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

Issue 11506006: [cros] RLZ tracking can be turned off via a flag file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-apply ps#16, it got lost Created 8 years 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_TEST_LOGIN_UTILS_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_LOGIN_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
12 #include "chrome/browser/chromeos/login/authenticator.h" 11 #include "chrome/browser/chromeos/login/authenticator.h"
13 #include "chrome/browser/chromeos/login/login_utils.h" 12 #include "chrome/browser/chromeos/login/login_utils.h"
14 #include "content/public/browser/browser_thread.h"
15 #include "google_apis/gaia/google_service_auth_error.h" 13 #include "google_apis/gaia/google_service_auth_error.h"
16 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
17 15
18 class Profile; 16 class Profile;
19 17
20 namespace chromeos { 18 namespace chromeos {
21 19
22 class LoginStatusConsumer; 20 class LoginStatusConsumer;
23 21
24 class MockAuthenticator : public Authenticator {
25 public:
26 MockAuthenticator(LoginStatusConsumer* consumer,
27 const std::string& expected_username,
28 const std::string& expected_password)
29 : Authenticator(consumer),
30 expected_username_(expected_username),
31 expected_password_(expected_password) {
32 }
33
34 virtual void CompleteLogin(Profile* profile,
35 const std::string& username,
36 const std::string& password) OVERRIDE;
37
38 virtual void AuthenticateToLogin(Profile* profile,
39 const std::string& username,
40 const std::string& password,
41 const std::string& login_token,
42 const std::string& login_captcha) OVERRIDE;
43
44 virtual void AuthenticateToUnlock(const std::string& username,
45 const std::string& password) OVERRIDE;
46
47 virtual void LoginRetailMode() OVERRIDE;
48 virtual void LoginAsPublicAccount(const std::string& username) OVERRIDE;
49 virtual void LoginOffTheRecord() OVERRIDE;
50
51 virtual void OnRetailModeLoginSuccess() OVERRIDE;
52
53 virtual void OnLoginSuccess(bool request_pending) OVERRIDE;
54
55 virtual void OnLoginFailure(const LoginFailure& failure) OVERRIDE;
56
57 virtual void RecoverEncryptedData(
58 const std::string& old_password) OVERRIDE {}
59
60 virtual void ResyncEncryptedData() OVERRIDE {}
61
62 virtual void RetryAuth(Profile* profile,
63 const std::string& username,
64 const std::string& password,
65 const std::string& login_token,
66 const std::string& login_captcha) OVERRIDE {}
67
68 protected:
69 virtual ~MockAuthenticator() {}
70
71 private:
72 std::string expected_username_;
73 std::string expected_password_;
74
75 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator);
76 };
77
78 class TestLoginUtils : public LoginUtils { 22 class TestLoginUtils : public LoginUtils {
79 public: 23 public:
80 TestLoginUtils(const std::string& expected_username, 24 TestLoginUtils(const std::string& expected_username,
81 const std::string& expected_password); 25 const std::string& expected_password);
82 virtual ~TestLoginUtils(); 26 virtual ~TestLoginUtils();
83 27
84 virtual void DoBrowserLaunch(Profile* profile, 28 virtual void DoBrowserLaunch(Profile* profile,
85 LoginDisplayHost* login_host) OVERRIDE {} 29 LoginDisplayHost* login_host) OVERRIDE {}
86 virtual void PrepareProfile(const std::string& username, 30 virtual void PrepareProfile(const std::string& username,
87 const std::string& display_email, 31 const std::string& display_email,
88 const std::string& password, 32 const std::string& password,
89 bool pending_requests, 33 bool pending_requests,
90 bool using_oauth, 34 bool using_oauth,
91 bool has_cookies, 35 bool has_cookies,
92 Delegate* delegate) OVERRIDE; 36 Delegate* delegate) OVERRIDE;
93 37
94 virtual void DelegateDeleted(Delegate* delegate) OVERRIDE; 38 virtual void DelegateDeleted(Delegate* delegate) OVERRIDE;
95 39
(...skipping 12 matching lines...) Expand all
108 52
109 virtual void StartSignedInServices( 53 virtual void StartSignedInServices(
110 Profile* profile, 54 Profile* profile,
111 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE {} 55 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE {}
112 56
113 virtual std::string GetOffTheRecordCommandLine( 57 virtual std::string GetOffTheRecordCommandLine(
114 const GURL& start_url, 58 const GURL& start_url,
115 const CommandLine& base_command_line, 59 const CommandLine& base_command_line,
116 CommandLine* command_line) OVERRIDE; 60 CommandLine* command_line) OVERRIDE;
117 61
62 virtual void InitRlzDelayed(Profile* user_profile) OVERRIDE;
Peter Kasting 2012/12/17 20:14:03 Nit: Also try to match the parent class declaratio
Ivan Korotkov 2012/12/20 09:20:42 Done.
63
118 virtual void TransferDefaultCookiesAndServerBoundCerts( 64 virtual void TransferDefaultCookiesAndServerBoundCerts(
119 Profile* default_profile, 65 Profile* default_profile,
120 Profile* new_profile) OVERRIDE; 66 Profile* new_profile) OVERRIDE;
121 67
122 virtual void TransferDefaultAuthCache(Profile* default_profile, 68 virtual void TransferDefaultAuthCache(Profile* default_profile,
123 Profile* new_profile) OVERRIDE; 69 Profile* new_profile) OVERRIDE;
124 70
125 virtual void StopBackgroundFetchers() OVERRIDE; 71 virtual void StopBackgroundFetchers() OVERRIDE;
126 72
127 private: 73 private:
128 std::string expected_username_; 74 std::string expected_username_;
129 std::string expected_password_; 75 std::string expected_password_;
130 std::string auth_token_; 76 std::string auth_token_;
131 77
132 DISALLOW_COPY_AND_ASSIGN(TestLoginUtils); 78 DISALLOW_COPY_AND_ASSIGN(TestLoginUtils);
133 }; 79 };
134 80
135 } // namespace chromeos 81 } // namespace chromeos
136 82
137 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ 83 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_LOGIN_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698