OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <string> |
| 10 |
| 11 #include "chrome/browser/chromeos/login/auth_attempt_state.h" |
| 12 #include "chrome/browser/chromeos/login/login_status_consumer.h" |
| 13 #include "chrome/common/net/gaia/gaia_auth_consumer.h" |
| 14 |
| 15 namespace chromeos { |
| 16 |
| 17 class TestAttemptState : public AuthAttemptState { |
| 18 public: |
| 19 TestAttemptState(const std::string& username, |
| 20 const std::string& password, |
| 21 const std::string& ascii_hash, |
| 22 const std::string& login_token, |
| 23 const std::string& login_captcha); |
| 24 |
| 25 virtual ~TestAttemptState(); |
| 26 |
| 27 // Act as though an online login attempt completed already. |
| 28 void PresetOnlineLoginStatus( |
| 29 const GaiaAuthConsumer::ClientLoginResult& credentials, |
| 30 const LoginFailure& outcome); |
| 31 |
| 32 // Act as though an offline login attempt completed already. |
| 33 void PresetOfflineLoginStatus(bool offline_outcome, int offline_code); |
| 34 |
| 35 // To allow state to be queried on the main thread during tests. |
| 36 bool online_complete() { return online_complete_; } |
| 37 const LoginFailure& online_outcome() { return online_outcome_; } |
| 38 const GaiaAuthConsumer::ClientLoginResult& credentials() { |
| 39 return credentials_; |
| 40 } |
| 41 bool offline_complete() { return offline_complete_; } |
| 42 bool offline_outcome() { return offline_outcome_; } |
| 43 int offline_code() { return offline_code_; } |
| 44 |
| 45 private: |
| 46 DISALLOW_COPY_AND_ASSIGN(TestAttemptState); |
| 47 }; |
| 48 |
| 49 } // namespace chromeos |
| 50 |
| 51 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_TEST_ATTEMPT_STATE_H_ |
OLD | NEW |