| 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 <utility> |
| 7 #include <vector> | 8 #include <vector> |
| 8 | 9 |
| 9 #include "base/base_paths.h" | 10 #include "base/base_paths.h" |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 12 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
| 14 #include "base/json/json_writer.h" | 15 #include "base/json/json_writer.h" |
| 15 #include "base/logging.h" | 16 #include "base/logging.h" |
| 16 #include "base/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); | 302 scoped_ptr<BasicHttpResponse> http_response(new BasicHttpResponse()); |
| 302 RequestHandlerMap::iterator iter = request_handlers_.find(request_path); | 303 RequestHandlerMap::iterator iter = request_handlers_.find(request_path); |
| 303 if (iter != request_handlers_.end()) { | 304 if (iter != request_handlers_.end()) { |
| 304 LOG(WARNING) << "Serving request " << request_path; | 305 LOG(WARNING) << "Serving request " << request_path; |
| 305 iter->second.Run(request, http_response.get()); | 306 iter->second.Run(request, http_response.get()); |
| 306 } else { | 307 } else { |
| 307 LOG(ERROR) << "Unhandled request " << request_path; | 308 LOG(ERROR) << "Unhandled request " << request_path; |
| 308 return scoped_ptr<HttpResponse>(); // Request not understood. | 309 return scoped_ptr<HttpResponse>(); // Request not understood. |
| 309 } | 310 } |
| 310 | 311 |
| 311 return http_response.Pass(); | 312 return std::move(http_response); |
| 312 } | 313 } |
| 313 | 314 |
| 314 void FakeGaia::IssueOAuthToken(const std::string& auth_token, | 315 void FakeGaia::IssueOAuthToken(const std::string& auth_token, |
| 315 const AccessTokenInfo& token_info) { | 316 const AccessTokenInfo& token_info) { |
| 316 access_token_info_map_.insert(std::make_pair(auth_token, token_info)); | 317 access_token_info_map_.insert(std::make_pair(auth_token, token_info)); |
| 317 } | 318 } |
| 318 | 319 |
| 319 void FakeGaia::RegisterSamlUser(const std::string& account_id, | 320 void FakeGaia::RegisterSamlUser(const std::string& account_id, |
| 320 const GURL& saml_idp) { | 321 const GURL& saml_idp) { |
| 321 saml_account_idp_map_[account_id] = saml_idp; | 322 saml_account_idp_map_[account_id] = saml_idp; |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (token_info) { | 794 if (token_info) { |
| 794 base::DictionaryValue response_dict; | 795 base::DictionaryValue response_dict; |
| 795 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); | 796 response_dict.SetString("id", GetGaiaIdOfEmail(token_info->email)); |
| 796 response_dict.SetString("email", token_info->email); | 797 response_dict.SetString("email", token_info->email); |
| 797 response_dict.SetString("verified_email", token_info->email); | 798 response_dict.SetString("verified_email", token_info->email); |
| 798 FormatJSONResponse(response_dict, http_response); | 799 FormatJSONResponse(response_dict, http_response); |
| 799 } else { | 800 } else { |
| 800 http_response->set_code(net::HTTP_BAD_REQUEST); | 801 http_response->set_code(net::HTTP_BAD_REQUEST); |
| 801 } | 802 } |
| 802 } | 803 } |
| OLD | NEW |