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" |
11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "google_apis/gaia/gaia_constants.h" | 23 #include "google_apis/gaia/gaia_constants.h" |
24 #include "google_apis/gaia/gaia_urls.h" | 24 #include "google_apis/gaia/gaia_urls.h" |
25 #include "net/base/url_util.h" | 25 #include "net/base/url_util.h" |
26 #include "net/cookies/parsed_cookie.h" | 26 #include "net/cookies/parsed_cookie.h" |
27 #include "net/http/http_status_code.h" | 27 #include "net/http/http_status_code.h" |
28 #include "net/test/embedded_test_server/http_request.h" | 28 #include "net/test/embedded_test_server/http_request.h" |
29 #include "net/test/embedded_test_server/http_response.h" | 29 #include "net/test/embedded_test_server/http_response.h" |
30 #include "url/url_parse.h" | 30 #include "url/third_party/mozilla/url_parse.h" |
31 | 31 |
32 #define REGISTER_RESPONSE_HANDLER(url, method) \ | 32 #define REGISTER_RESPONSE_HANDLER(url, method) \ |
33 request_handlers_.insert(std::make_pair( \ | 33 request_handlers_.insert(std::make_pair( \ |
34 url.path(), base::Bind(&FakeGaia::method, base::Unretained(this)))) | 34 url.path(), base::Bind(&FakeGaia::method, base::Unretained(this)))) |
35 | 35 |
36 #define REGISTER_PATH_RESPONSE_HANDLER(path, method) \ | 36 #define REGISTER_PATH_RESPONSE_HANDLER(path, method) \ |
37 request_handlers_.insert(std::make_pair( \ | 37 request_handlers_.insert(std::make_pair( \ |
38 path, base::Bind(&FakeGaia::method, base::Unretained(this)))) | 38 path, base::Bind(&FakeGaia::method, base::Unretained(this)))) |
39 | 39 |
40 using namespace net::test_server; | 40 using namespace net::test_server; |
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 if (token_info) { | 712 if (token_info) { |
713 base::DictionaryValue response_dict; | 713 base::DictionaryValue response_dict; |
714 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); | 714 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); |
715 response_dict.SetString("email", token_info->email); | 715 response_dict.SetString("email", token_info->email); |
716 response_dict.SetString("verified_email", token_info->email); | 716 response_dict.SetString("verified_email", token_info->email); |
717 FormatJSONResponse(response_dict, http_response); | 717 FormatJSONResponse(response_dict, http_response); |
718 } else { | 718 } else { |
719 http_response->set_code(net::HTTP_BAD_REQUEST); | 719 http_response->set_code(net::HTTP_BAD_REQUEST); |
720 } | 720 } |
721 } | 721 } |
OLD | NEW |