| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Use MockGaiaAuthenticator to test your application by faking a login session. | 5 // Use MockGaiaAuthenticator to test your application by faking a login session. |
| 6 // This mock object should be initialized with the response you expect it to | 6 // This mock object should be initialized with the response you expect it to |
| 7 // return for multiple users, and then can be used in exactly the same way | 7 // return for multiple users, and then can be used in exactly the same way |
| 8 // as the real GaiaAuthenticator. | 8 // as the real GaiaAuthenticator. |
| 9 // | 9 // |
| 10 // Sample usage: | 10 // Sample usage: |
| 11 // MockGaiaAuthenticator mock_gaia_auth("User-Agent", SYNC_SERVICE_NAME, | 11 // MockGaiaAuthenticator mock_gaia_auth("User-Agent", SYNC_SERVICE_NAME, |
| 12 // "any random string"); | 12 // "any random string"); |
| 13 // mock_gaia_auth.AddMockUser("email", "password", "authtoken", "lsid", "sid", | 13 // mock_gaia_auth.AddMockUser("email", "password", "authtoken", "lsid", "sid", |
| 14 // AuthenticationError); | 14 // AuthenticationError); |
| 15 // mock_gaia_auth.AddMockUser("email2", "password2", "authtoken2", "lsid2", | 15 // mock_gaia_auth.AddMockUser("email2", "password2", "authtoken2", "lsid2", |
| 16 // "sid2", AuthenticationError, error_url, | 16 // "sid2", AuthenticationError, error_url, |
| 17 // "captcha_token", "captcha_url"); | 17 // "captcha_token", "captcha_url"); |
| 18 // if (gaia_auth.Authenticate("email", "passwd")) { | 18 // if (gaia_auth.Authenticate("email", "passwd")) { |
| 19 // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), | 19 // // Do something with: gaia_auth.auth_token(), or gaia_auth.sid(), |
| 20 // // or gaia_auth.lsid() | 20 // // or gaia_auth.lsid() |
| 21 // } | 21 // } |
| 22 | 22 |
| 23 #ifndef CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ | 23 #ifndef CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ |
| 24 #define CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ | 24 #define CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ |
| 25 #pragma once | 25 #pragma once |
| 26 | 26 |
| 27 #include <map> | 27 #include <map> |
| 28 #include <string> | 28 #include <string> |
| 29 | 29 |
| 30 #include "base/port.h" | 30 #include "base/port.h" |
| 31 | 31 |
| 32 #include "base/basictypes.h" | 32 #include "base/basictypes.h" |
| 33 #include "chrome/common/net/gaia/gaia_authenticator.h" | 33 #include "chrome/common/net/gaia/gaia_authenticator.h" |
| 34 | 34 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 std::string captcha_url(); | 107 std::string captcha_url(); |
| 108 | 108 |
| 109 private: | 109 private: |
| 110 bool should_save_credentials_; | 110 bool should_save_credentials_; |
| 111 std::map<std::string, MockUser> mock_credentials_; | 111 std::map<std::string, MockUser> mock_credentials_; |
| 112 std::string current_user_; | 112 std::string current_user_; |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 } // namespace browser_sync | 115 } // namespace browser_sync |
| 116 | 116 |
| 117 #endif // CHROME_TEST_SYNC_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ | 117 #endif // CHROME_BROWSER_SYNC_TEST_ENGINE_MOCK_GAIA_AUTHENTICATOR_H_ |
| OLD | NEW |