| 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 "chrome/test/chromedriver/server/http_handler.h" | 5 #include "chrome/test/chromedriver/server/http_handler.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <memory> | 9 #include <memory> | 
| 10 #include <utility> | 10 #include <utility> | 
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 764         base::SysInfo::OperatingSystemArchitecture().c_str())); | 764         base::SysInfo::OperatingSystemArchitecture().c_str())); | 
| 765     std::unique_ptr<base::DictionaryValue> error(new base::DictionaryValue()); | 765     std::unique_ptr<base::DictionaryValue> error(new base::DictionaryValue()); | 
| 766     error->SetString("message", full_status.message()); | 766     error->SetString("message", full_status.message()); | 
| 767     value = std::move(error); | 767     value = std::move(error); | 
| 768   } | 768   } | 
| 769   if (!value) | 769   if (!value) | 
| 770     value = base::MakeUnique<base::Value>(); | 770     value = base::MakeUnique<base::Value>(); | 
| 771 | 771 | 
| 772   base::DictionaryValue body_params; | 772   base::DictionaryValue body_params; | 
| 773   body_params.SetInteger("status", status.code()); | 773   body_params.SetInteger("status", status.code()); | 
| 774   body_params.Set("value", value.release()); | 774   body_params.Set("value", std::move(value)); | 
| 775   body_params.SetString("sessionId", session_id); | 775   body_params.SetString("sessionId", session_id); | 
| 776   std::string body; | 776   std::string body; | 
| 777   base::JSONWriter::WriteWithOptions( | 777   base::JSONWriter::WriteWithOptions( | 
| 778       body_params, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, | 778       body_params, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, | 
| 779       &body); | 779       &body); | 
| 780   std::unique_ptr<net::HttpServerResponseInfo> response( | 780   std::unique_ptr<net::HttpServerResponseInfo> response( | 
| 781       new net::HttpServerResponseInfo(net::HTTP_OK)); | 781       new net::HttpServerResponseInfo(net::HTTP_OK)); | 
| 782   response->SetBody(body, "application/json; charset=utf-8"); | 782   response->SetBody(body, "application/json; charset=utf-8"); | 
| 783   return response; | 783   return response; | 
| 784 } | 784 } | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 841     std::string message; | 841     std::string message; | 
| 842     for (size_t i=1; i<status_details.size();++i) | 842     for (size_t i=1; i<status_details.size();++i) | 
| 843       message += status_details[i]; | 843       message += status_details[i]; | 
| 844 | 844 | 
| 845     body_params.SetString("error", status_details[0]); | 845     body_params.SetString("error", status_details[0]); | 
| 846     body_params.SetString("message", message); | 846     body_params.SetString("message", message); | 
| 847     body_params.SetString("stacktrace", status.stack_trace()); | 847     body_params.SetString("stacktrace", status.stack_trace()); | 
| 848   } else { | 848   } else { | 
| 849     body_params.SetString("sessionId", session_id); | 849     body_params.SetString("sessionId", session_id); | 
| 850     body_params.SetString("status", status.message()); | 850     body_params.SetString("status", status.message()); | 
| 851     body_params.Set("value", value.release()); | 851     body_params.Set("value", std::move(value)); | 
| 852   } | 852   } | 
| 853 | 853 | 
| 854   std::string body; | 854   std::string body; | 
| 855   base::JSONWriter::WriteWithOptions( | 855   base::JSONWriter::WriteWithOptions( | 
| 856       body_params, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, | 856       body_params, base::JSONWriter::OPTIONS_OMIT_DOUBLE_TYPE_PRESERVATION, | 
| 857       &body); | 857       &body); | 
| 858   response->SetBody(body, "application/json; charset=utf-8"); | 858   response->SetBody(body, "application/json; charset=utf-8"); | 
| 859   return response; | 859   return response; | 
| 860 } | 860 } | 
| 861 | 861 | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 914         params.SetString(name, decoded); | 914         params.SetString(name, decoded); | 
| 915     } else if (command_path_parts[i] != path_parts[i]) { | 915     } else if (command_path_parts[i] != path_parts[i]) { | 
| 916       return false; | 916       return false; | 
| 917     } | 917     } | 
| 918   } | 918   } | 
| 919   out_params->MergeDictionary(¶ms); | 919   out_params->MergeDictionary(¶ms); | 
| 920   return true; | 920   return true; | 
| 921 } | 921 } | 
| 922 | 922 | 
| 923 }  // namespace internal | 923 }  // namespace internal | 
| OLD | NEW | 
|---|