diff options
author | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 17:31:45 +0000 |
---|---|---|
committer | zelidrag@chromium.org <zelidrag@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-18 17:31:45 +0000 |
commit | 31a7fb0a3f7bec9db975db7b2526dac9624c0dc5 (patch) | |
tree | f76e629398c4d67cd735a6e168cc674b5e2ec028 /google_apis/gaia/fake_gaia.h | |
parent | 2a6c3e512baa6c237861d756d97cecf39e24ad4b (diff) | |
download | chromium_src-31a7fb0a3f7bec9db975db7b2526dac9624c0dc5.zip chromium_src-31a7fb0a3f7bec9db975db7b2526dac9624c0dc5.tar.gz chromium_src-31a7fb0a3f7bec9db975db7b2526dac9624c0dc5.tar.bz2 |
Additional OAuth2 tests for ChromeOS
- authentication attempt for invalid OAuth2 refresh token
- authentication of an existing user
BUG=none
TEST=OAuth2.*
Review URL: https://codereview.chromium.org/108663008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241581 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis/gaia/fake_gaia.h')
-rw-r--r-- | google_apis/gaia/fake_gaia.h | 49 |
1 files changed, 27 insertions, 22 deletions
diff --git a/google_apis/gaia/fake_gaia.h b/google_apis/gaia/fake_gaia.h index 6052c2b..ae8c544 100644 --- a/google_apis/gaia/fake_gaia.h +++ b/google_apis/gaia/fake_gaia.h @@ -47,16 +47,36 @@ class FakeGaia { std::string email; }; + // Cookies and tokens for /MergeSession call seqeunce. + struct MergeSessionParams { + MergeSessionParams(); + ~MergeSessionParams(); + + // Values of SID and LSID cookie that are set by + std::string auth_sid_cookie; + std::string auth_lsid_cookie; + + // auth_code cookie value response for /o/oauth2/programmatic_auth call. + std::string auth_code; + + // OAuth2 refresh and access token generated by /o/oauth2/token call + // with "...&grant_type=authorization_code". + std::string refresh_token; + std::string access_token; + + // Uber token response from /OAuthLogin call. + std::string gaia_uber_token; + + // Values of SID and LSID cookie generated from /MergeSession call. + std::string session_sid_cookie; + std::string session_lsid_cookie; + }; + FakeGaia(); ~FakeGaia(); // Sets the initial value of tokens and cookies. - void SetAuthTokens(const std::string& auth_code, - const std::string& refresh_token, - const std::string& access_token, - const std::string& gaia_uber_token, - const std::string& session_sid_cookie, - const std::string& session_lsid_cookie); + void SetMergeSessionParams(const MergeSessionParams& params); // Initializes HTTP request handlers. Should be called after switches // for tweaking GaiaUrls are in place. @@ -131,22 +151,7 @@ class FakeGaia { const std::string& scope_string) const; - // Extracts the |access_token| from authorization header of |request|. - static bool GetAccessToken(const net::test_server::HttpRequest& request, - const char* auth_token_prefix, - std::string* access_token); - - // auth_code cookie value response for /o/oauth2/programmatic_auth call. - std::string fake_auth_code_; - - // refresh_token field value response for the initial /o/oauth2/token call - // with ...&grant_type=authorization_code. - std::string fake_refresh_token_; - std::string fake_access_token_; - std::string fake_gaia_uber_token_; - std::string fake_session_sid_cookie_; - std::string fake_session_lsid_cookie_; - + MergeSessionParams merge_session_params_; AccessTokenInfoMap access_token_info_map_; RequestHandlerMap request_handlers_; std::string service_login_response_; |