OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 GOOGLE_APIS_GAIA_FAKE_GAIA_H_ | 5 #ifndef GOOGLE_APIS_GAIA_FAKE_GAIA_H_ |
6 #define GOOGLE_APIS_GAIA_FAKE_GAIA_H_ | 6 #define GOOGLE_APIS_GAIA_FAKE_GAIA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 std::string session_sid_cookie; | 72 std::string session_sid_cookie; |
73 std::string session_lsid_cookie; | 73 std::string session_lsid_cookie; |
74 | 74 |
75 // The e-mail address returned by /ListAccounts. | 75 // The e-mail address returned by /ListAccounts. |
76 std::string email; | 76 std::string email; |
77 }; | 77 }; |
78 | 78 |
79 FakeGaia(); | 79 FakeGaia(); |
80 virtual ~FakeGaia(); | 80 virtual ~FakeGaia(); |
81 | 81 |
| 82 void SetFakeMergeSessionParamsForEmail(const std::string& email); |
| 83 |
82 // Sets the initial value of tokens and cookies. | 84 // Sets the initial value of tokens and cookies. |
83 void SetMergeSessionParams(const MergeSessionParams& params); | 85 void SetMergeSessionParams(const MergeSessionParams& params); |
84 | 86 |
85 // Initializes HTTP request handlers. Should be called after switches | 87 // Initializes HTTP request handlers. Should be called after switches |
86 // for tweaking GaiaUrls are in place. | 88 // for tweaking GaiaUrls are in place. |
87 void Initialize(); | 89 void Initialize(); |
88 | 90 |
89 // Handles a request and returns a response if the request was recognized as a | 91 // Handles a request and returns a response if the request was recognized as a |
90 // GAIA request. Note that this respects the switches::kGaiaUrl and friends so | 92 // GAIA request. Note that this respects the switches::kGaiaUrl and friends so |
91 // that this can used with EmbeddedTestServer::RegisterRequestHandler(). | 93 // that this can used with EmbeddedTestServer::RegisterRequestHandler(). |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 void HandleAuthToken(const net::test_server::HttpRequest& request, | 147 void HandleAuthToken(const net::test_server::HttpRequest& request, |
146 net::test_server::BasicHttpResponse* http_response); | 148 net::test_server::BasicHttpResponse* http_response); |
147 void HandleTokenInfo(const net::test_server::HttpRequest& request, | 149 void HandleTokenInfo(const net::test_server::HttpRequest& request, |
148 net::test_server::BasicHttpResponse* http_response); | 150 net::test_server::BasicHttpResponse* http_response); |
149 void HandleIssueToken(const net::test_server::HttpRequest& request, | 151 void HandleIssueToken(const net::test_server::HttpRequest& request, |
150 net::test_server::BasicHttpResponse* http_response); | 152 net::test_server::BasicHttpResponse* http_response); |
151 void HandleListAccounts(const net::test_server::HttpRequest& request, | 153 void HandleListAccounts(const net::test_server::HttpRequest& request, |
152 net::test_server::BasicHttpResponse* http_response); | 154 net::test_server::BasicHttpResponse* http_response); |
153 void HandlePeopleGet(const net::test_server::HttpRequest& request, | 155 void HandlePeopleGet(const net::test_server::HttpRequest& request, |
154 net::test_server::BasicHttpResponse* http_response); | 156 net::test_server::BasicHttpResponse* http_response); |
| 157 void HandleGetUserInfo(const net::test_server::HttpRequest& request, |
| 158 net::test_server::BasicHttpResponse* http_response); |
155 | 159 |
156 // Returns the access token associated with |auth_token| that matches the | 160 // Returns the access token associated with |auth_token| that matches the |
157 // given |client_id| and |scope_string|. If |scope_string| is empty, the first | 161 // given |client_id| and |scope_string|. If |scope_string| is empty, the first |
158 // token satisfying the other criteria is returned. Returns NULL if no token | 162 // token satisfying the other criteria is returned. Returns NULL if no token |
159 // matches. | 163 // matches. |
160 const AccessTokenInfo* FindAccessTokenInfo(const std::string& auth_token, | 164 const AccessTokenInfo* FindAccessTokenInfo(const std::string& auth_token, |
161 const std::string& client_id, | 165 const std::string& client_id, |
162 const std::string& scope_string) | 166 const std::string& scope_string) |
163 const; | 167 const; |
164 | 168 |
165 MergeSessionParams merge_session_params_; | 169 MergeSessionParams merge_session_params_; |
166 AccessTokenInfoMap access_token_info_map_; | 170 AccessTokenInfoMap access_token_info_map_; |
167 RequestHandlerMap request_handlers_; | 171 RequestHandlerMap request_handlers_; |
168 std::string service_login_response_; | 172 std::string service_login_response_; |
169 SamlAccountIdpMap saml_account_idp_map_; | 173 SamlAccountIdpMap saml_account_idp_map_; |
170 | 174 |
171 DISALLOW_COPY_AND_ASSIGN(FakeGaia); | 175 DISALLOW_COPY_AND_ASSIGN(FakeGaia); |
172 }; | 176 }; |
173 | 177 |
174 #endif // GOOGLE_APIS_GAIA_FAKE_GAIA_H_ | 178 #endif // GOOGLE_APIS_GAIA_FAKE_GAIA_H_ |
OLD | NEW |