| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/webdriver/dispatch.h" | 5 #include "chrome/test/webdriver/dispatch.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 DictionaryValue** parameters, | 189 DictionaryValue** parameters, |
| 190 Response* const response) { | 190 Response* const response) { |
| 191 *method = request_info->request_method; | 191 *method = request_info->request_method; |
| 192 if (*method == "HEAD") | 192 if (*method == "HEAD") |
| 193 *method = "GET"; | 193 *method = "GET"; |
| 194 else if (*method == "PUT") | 194 else if (*method == "PUT") |
| 195 *method = "POST"; | 195 *method = "POST"; |
| 196 | 196 |
| 197 std::string uri(request_info->uri); | 197 std::string uri(request_info->uri); |
| 198 SessionManager* manager = SessionManager::GetInstance(); | 198 SessionManager* manager = SessionManager::GetInstance(); |
| 199 uri = uri.substr(manager->url_base().length()); | 199 uri = uri.substr(manager->UrlBase().length()); |
| 200 | 200 |
| 201 base::SplitString(uri, '/', path_segments); | 201 base::SplitString(uri, '/', path_segments); |
| 202 | 202 |
| 203 if (*method == "POST" && request_info->post_data_len > 0) { | 203 if (*method == "POST" && request_info->post_data_len > 0) { |
| 204 VLOG(1) << "...parsing request body"; | 204 VLOG(1) << "...parsing request body"; |
| 205 std::string json(request_info->post_data, request_info->post_data_len); | 205 std::string json(request_info->post_data, request_info->post_data_len); |
| 206 std::string error; | 206 std::string error; |
| 207 if (!ParseJSONDictionary(json, parameters, &error)) { | 207 if (!ParseJSONDictionary(json, parameters, &error)) { |
| 208 SET_WEBDRIVER_ERROR(response, | 208 SET_WEBDRIVER_ERROR(response, |
| 209 "Failed to parse command data: " + error + "\n Data: " + json, | 209 "Failed to parse command data: " + error + "\n Data: " + json, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 base::WaitableEvent* shutdown_event) { | 253 base::WaitableEvent* shutdown_event) { |
| 254 mg_set_uri_callback(context_, (root_ + pattern).c_str(), &Shutdown, NULL); | 254 mg_set_uri_callback(context_, (root_ + pattern).c_str(), &Shutdown, NULL); |
| 255 } | 255 } |
| 256 | 256 |
| 257 void Dispatcher::SetNotImplemented(const std::string& pattern) { | 257 void Dispatcher::SetNotImplemented(const std::string& pattern) { |
| 258 mg_set_uri_callback(context_, (root_ + pattern).c_str(), | 258 mg_set_uri_callback(context_, (root_ + pattern).c_str(), |
| 259 &SendNotImplementedError, NULL); | 259 &SendNotImplementedError, NULL); |
| 260 } | 260 } |
| 261 | 261 |
| 262 } // namespace webdriver | 262 } // namespace webdriver |
| OLD | NEW |