OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 const std::string& method, | 281 const std::string& method, |
282 Response* response) { | 282 Response* response) { |
283 CHECK(method == "GET" || method == "POST" || method == "DELETE"); | 283 CHECK(method == "GET" || method == "POST" || method == "DELETE"); |
284 scoped_ptr<Command> command(command_ptr); | 284 scoped_ptr<Command> command(command_ptr); |
285 | 285 |
286 if ((method == "GET" && !command->DoesGet()) || | 286 if ((method == "GET" && !command->DoesGet()) || |
287 (method == "POST" && !command->DoesPost()) || | 287 (method == "POST" && !command->DoesPost()) || |
288 (method == "DELETE" && !command->DoesDelete())) { | 288 (method == "DELETE" && !command->DoesDelete())) { |
289 ListValue* methods = new ListValue; | 289 ListValue* methods = new ListValue; |
290 if (command->DoesPost()) | 290 if (command->DoesPost()) |
291 methods->Append(Value::CreateStringValue("POST")); | 291 methods->Append(base::StringValue::New("POST")); |
292 if (command->DoesGet()) { | 292 if (command->DoesGet()) { |
293 methods->Append(Value::CreateStringValue("GET")); | 293 methods->Append(base::StringValue::New("GET")); |
294 methods->Append(Value::CreateStringValue("HEAD")); | 294 methods->Append(base::StringValue::New("HEAD")); |
295 } | 295 } |
296 if (command->DoesDelete()) | 296 if (command->DoesDelete()) |
297 methods->Append(Value::CreateStringValue("DELETE")); | 297 methods->Append(base::StringValue::New("DELETE")); |
298 response->SetStatus(kMethodNotAllowed); | 298 response->SetStatus(kMethodNotAllowed); |
299 response->SetValue(methods); | 299 response->SetValue(methods); |
300 return; | 300 return; |
301 } | 301 } |
302 | 302 |
303 DispatchCommand(command.get(), method, response); | 303 DispatchCommand(command.get(), method, response); |
304 } | 304 } |
305 | 305 |
306 } // namespace internal | 306 } // namespace internal |
307 | 307 |
(...skipping 23 matching lines...) Expand all Loading... |
331 void Dispatcher::SetNotImplemented(const std::string& pattern) { | 331 void Dispatcher::SetNotImplemented(const std::string& pattern) { |
332 mg_set_uri_callback(context_, (root_ + pattern).c_str(), | 332 mg_set_uri_callback(context_, (root_ + pattern).c_str(), |
333 &SendNotImplementedError, NULL); | 333 &SendNotImplementedError, NULL); |
334 } | 334 } |
335 | 335 |
336 void Dispatcher::ForbidAllOtherRequests() { | 336 void Dispatcher::ForbidAllOtherRequests() { |
337 mg_set_uri_callback(context_, "*", &SendForbidden, NULL); | 337 mg_set_uri_callback(context_, "*", &SendForbidden, NULL); |
338 } | 338 } |
339 | 339 |
340 } // namespace webdriver | 340 } // namespace webdriver |
OLD | NEW |