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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 new net::HttpServerResponseInfo(net::HTTP_OK)); | 687 new net::HttpServerResponseInfo(net::HTTP_OK)); |
688 response->SetBody(body, "application/json; charset=utf-8"); | 688 response->SetBody(body, "application/json; charset=utf-8"); |
689 return response.Pass(); | 689 return response.Pass(); |
690 } | 690 } |
691 | 691 |
692 namespace internal { | 692 namespace internal { |
693 | 693 |
694 const char kNewSessionPathPattern[] = "session"; | 694 const char kNewSessionPathPattern[] = "session"; |
695 | 695 |
696 bool MatchesMethod(HttpMethod command_method, const std::string& method) { | 696 bool MatchesMethod(HttpMethod command_method, const std::string& method) { |
697 std::string lower_method = StringToLowerASCII(method); | 697 std::string lower_method = base::StringToLowerASCII(method); |
698 switch (command_method) { | 698 switch (command_method) { |
699 case kGet: | 699 case kGet: |
700 return lower_method == "get"; | 700 return lower_method == "get"; |
701 case kPost: | 701 case kPost: |
702 return lower_method == "post" || lower_method == "put"; | 702 return lower_method == "post" || lower_method == "put"; |
703 case kDelete: | 703 case kDelete: |
704 return lower_method == "delete"; | 704 return lower_method == "delete"; |
705 } | 705 } |
706 return false; | 706 return false; |
707 } | 707 } |
(...skipping 26 matching lines...) Expand all Loading... |
734 params.SetString(name, path_parts[i]); | 734 params.SetString(name, path_parts[i]); |
735 } else if (command_path_parts[i] != path_parts[i]) { | 735 } else if (command_path_parts[i] != path_parts[i]) { |
736 return false; | 736 return false; |
737 } | 737 } |
738 } | 738 } |
739 out_params->MergeDictionary(¶ms); | 739 out_params->MergeDictionary(¶ms); |
740 return true; | 740 return true; |
741 } | 741 } |
742 | 742 |
743 } // namespace internal | 743 } // namespace internal |
OLD | NEW |