| OLD | NEW |
| 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 "base/compiler_specific.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "chrome/browser/chromeos/login/authenticator.h" | 10 #include "chrome/browser/chromeos/login/authenticator.h" |
| 13 #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" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 12 |
| 18 class Profile; | 13 class Profile; |
| 19 | 14 |
| 20 namespace chromeos { | 15 namespace chromeos { |
| 21 | 16 |
| 22 class LoginStatusConsumer; | 17 class LoginStatusConsumer; |
| 23 | 18 |
| 24 class MockAuthenticator : public Authenticator { | 19 class MockAuthenticator : public Authenticator { |
| 25 public: | 20 public: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 protected: | 63 protected: |
| 69 virtual ~MockAuthenticator() {} | 64 virtual ~MockAuthenticator() {} |
| 70 | 65 |
| 71 private: | 66 private: |
| 72 std::string expected_username_; | 67 std::string expected_username_; |
| 73 std::string expected_password_; | 68 std::string expected_password_; |
| 74 | 69 |
| 75 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); | 70 DISALLOW_COPY_AND_ASSIGN(MockAuthenticator); |
| 76 }; | 71 }; |
| 77 | 72 |
| 78 class TestLoginUtils : public LoginUtils { | |
| 79 public: | |
| 80 TestLoginUtils(const std::string& expected_username, | |
| 81 const std::string& expected_password); | |
| 82 virtual ~TestLoginUtils(); | |
| 83 | |
| 84 virtual void DoBrowserLaunch(Profile* profile, | |
| 85 LoginDisplayHost* login_host) OVERRIDE {} | |
| 86 virtual void PrepareProfile(const std::string& username, | |
| 87 const std::string& display_email, | |
| 88 const std::string& password, | |
| 89 bool pending_requests, | |
| 90 bool using_oauth, | |
| 91 bool has_cookies, | |
| 92 Delegate* delegate) OVERRIDE; | |
| 93 | |
| 94 virtual void DelegateDeleted(Delegate* delegate) OVERRIDE; | |
| 95 | |
| 96 virtual void CompleteOffTheRecordLogin(const GURL& start_url) OVERRIDE {} | |
| 97 | |
| 98 virtual void SetFirstLoginPrefs(PrefService* prefs) OVERRIDE {} | |
| 99 | |
| 100 virtual scoped_refptr<Authenticator> CreateAuthenticator( | |
| 101 LoginStatusConsumer* consumer) OVERRIDE; | |
| 102 | |
| 103 virtual void PrewarmAuthentication() OVERRIDE {} | |
| 104 | |
| 105 virtual void RestoreAuthenticationSession(Profile* profile) OVERRIDE {} | |
| 106 | |
| 107 virtual void StartTokenServices(Profile* profile) OVERRIDE {} | |
| 108 | |
| 109 virtual void StartSignedInServices( | |
| 110 Profile* profile, | |
| 111 const GaiaAuthConsumer::ClientLoginResult& credentials) OVERRIDE {} | |
| 112 | |
| 113 virtual std::string GetOffTheRecordCommandLine( | |
| 114 const GURL& start_url, | |
| 115 const CommandLine& base_command_line, | |
| 116 CommandLine* command_line) OVERRIDE; | |
| 117 | |
| 118 virtual void TransferDefaultCookiesAndServerBoundCerts( | |
| 119 Profile* default_profile, | |
| 120 Profile* new_profile) OVERRIDE; | |
| 121 | |
| 122 virtual void TransferDefaultAuthCache(Profile* default_profile, | |
| 123 Profile* new_profile) OVERRIDE; | |
| 124 | |
| 125 virtual void StopBackgroundFetchers() OVERRIDE; | |
| 126 | |
| 127 private: | |
| 128 std::string expected_username_; | |
| 129 std::string expected_password_; | |
| 130 std::string auth_token_; | |
| 131 | |
| 132 DISALLOW_COPY_AND_ASSIGN(TestLoginUtils); | |
| 133 }; | |
| 134 | |
| 135 } // namespace chromeos | 73 } // namespace chromeos |
| 136 | 74 |
| 137 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ | 75 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_MOCK_AUTHENTICATOR_H_ |
| OLD | NEW |