| 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 #include "google_apis/gaia/fake_gaia.h" | 5 #include "google_apis/gaia/fake_gaia.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 const char kTestAuthCode[] = "fake-auth-code"; | 44 const char kTestAuthCode[] = "fake-auth-code"; |
| 45 const char kTestGaiaUberToken[] = "fake-uber-token"; | 45 const char kTestGaiaUberToken[] = "fake-uber-token"; |
| 46 const char kTestAuthLoginAccessToken[] = "fake-access-token"; | 46 const char kTestAuthLoginAccessToken[] = "fake-access-token"; |
| 47 const char kTestRefreshToken[] = "fake-refresh-token"; | 47 const char kTestRefreshToken[] = "fake-refresh-token"; |
| 48 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; | 48 const char kTestSessionSIDCookie[] = "fake-session-SID-cookie"; |
| 49 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; | 49 const char kTestSessionLSIDCookie[] = "fake-session-LSID-cookie"; |
| 50 const char kTestOAuthLoginSID[] = "fake-oauth-SID-cookie"; | 50 const char kTestOAuthLoginSID[] = "fake-oauth-SID-cookie"; |
| 51 const char kTestOAuthLoginLSID[] = "fake-oauth-LSID-cookie"; | 51 const char kTestOAuthLoginLSID[] = "fake-oauth-LSID-cookie"; |
| 52 const char kTestOAuthLoginAuthCode[] = "fake-oauth-auth-code"; | 52 const char kTestOAuthLoginAuthCode[] = "fake-oauth-auth-code"; |
| 53 | 53 |
| 54 const char kDefaultGaiaId[] ="12345"; | 54 const char kDefaultGaiaId[] = "12345"; |
| 55 | 55 |
| 56 const base::FilePath::CharType kServiceLogin[] = | 56 const base::FilePath::CharType kServiceLogin[] = |
| 57 FILE_PATH_LITERAL("google_apis/test/service_login.html"); | 57 FILE_PATH_LITERAL("google_apis/test/service_login.html"); |
| 58 | 58 |
| 59 const base::FilePath::CharType kEmbeddedSetupChromeos[] = | 59 const base::FilePath::CharType kEmbeddedSetupChromeos[] = |
| 60 FILE_PATH_LITERAL("google_apis/test/embedded_setup_chromeos.html"); | 60 FILE_PATH_LITERAL("google_apis/test/embedded_setup_chromeos.html"); |
| 61 | 61 |
| 62 // OAuth2 Authentication header value prefix. | 62 // OAuth2 Authentication header value prefix. |
| 63 const char kAuthHeaderBearer[] = "Bearer "; | 63 const char kAuthHeaderBearer[] = "Bearer "; |
| 64 const char kAuthHeaderOAuth[] = "OAuth "; | 64 const char kAuthHeaderOAuth[] = "OAuth "; |
| 65 | 65 |
| 66 const char kListAccountsResponseFormat[] = | 66 const char kListAccountsResponseFormat[] = |
| 67 "[\"gaia.l.a.r\",[[\"gaia.l.a\",1,\"\",\"%s\",\"\",1,1,0]]]"; | 67 "[\"gaia.l.a.r\",[[\"gaia.l.a\",1,\"\",\"%s\",\"\",1,1,0,0,1,\"12345\"]]]"; |
| 68 | 68 |
| 69 typedef std::map<std::string, std::string> CookieMap; | 69 typedef std::map<std::string, std::string> CookieMap; |
| 70 | 70 |
| 71 // Parses cookie name-value map our of |request|. | 71 // Parses cookie name-value map our of |request|. |
| 72 CookieMap GetRequestCookies(const HttpRequest& request) { | 72 CookieMap GetRequestCookies(const HttpRequest& request) { |
| 73 CookieMap result; | 73 CookieMap result; |
| 74 std::map<std::string, std::string>::const_iterator iter = | 74 std::map<std::string, std::string>::const_iterator iter = |
| 75 request.headers.find("Cookie"); | 75 request.headers.find("Cookie"); |
| 76 if (iter != request.headers.end()) { | 76 if (iter != request.headers.end()) { |
| 77 std::vector<std::string> cookie_nv_pairs; | 77 std::vector<std::string> cookie_nv_pairs; |
| (...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 if (token_info) { | 765 if (token_info) { |
| 766 base::DictionaryValue response_dict; | 766 base::DictionaryValue response_dict; |
| 767 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); | 767 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); |
| 768 response_dict.SetString("email", token_info->email); | 768 response_dict.SetString("email", token_info->email); |
| 769 response_dict.SetString("verified_email", token_info->email); | 769 response_dict.SetString("verified_email", token_info->email); |
| 770 FormatJSONResponse(response_dict, http_response); | 770 FormatJSONResponse(response_dict, http_response); |
| 771 } else { | 771 } else { |
| 772 http_response->set_code(net::HTTP_BAD_REQUEST); | 772 http_response->set_code(net::HTTP_BAD_REQUEST); |
| 773 } | 773 } |
| 774 } | 774 } |
| OLD | NEW |