OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/logging.h" | 5 #include "base/logging.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/memory/linked_ptr.h" | 7 #include "base/memory/linked_ptr.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return response.Pass(); | 106 return response.Pass(); |
107 } | 107 } |
108 | 108 |
109 void CheckHeaders(const TestHeaders& expected, | 109 void CheckHeaders(const TestHeaders& expected, |
110 const Array<HttpHeaderPtr>& headers) { | 110 const Array<HttpHeaderPtr>& headers) { |
111 // The server impl fiddles with Content-Length and Content-Type. So we don't | 111 // The server impl fiddles with Content-Length and Content-Type. So we don't |
112 // do a strict check here. | 112 // do a strict check here. |
113 std::map<std::string, std::string> header_map; | 113 std::map<std::string, std::string> header_map; |
114 for (size_t i = 0; i < headers.size(); ++i) { | 114 for (size_t i = 0; i < headers.size(); ++i) { |
115 std::string lower_name = | 115 std::string lower_name = |
116 base::StringToLowerASCII(headers[i]->name.To<std::string>()); | 116 base::ToLowerASCII(headers[i]->name.To<std::string>()); |
117 header_map[lower_name] = headers[i]->value; | 117 header_map[lower_name] = headers[i]->value; |
118 } | 118 } |
119 | 119 |
120 for (const auto& item : expected) { | 120 for (const auto& item : expected) { |
121 std::string lower_name = base::StringToLowerASCII(item.first); | 121 std::string lower_name = base::ToLowerASCII(item.first); |
122 EXPECT_NE(header_map.end(), header_map.find(lower_name)); | 122 EXPECT_NE(header_map.end(), header_map.find(lower_name)); |
123 EXPECT_EQ(item.second, header_map[lower_name]); | 123 EXPECT_EQ(item.second, header_map[lower_name]); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 void CheckRequest(const TestRequest& expected, HttpRequestPtr request) { | 127 void CheckRequest(const TestRequest& expected, HttpRequestPtr request) { |
128 EXPECT_EQ(expected.method, request->method); | 128 EXPECT_EQ(expected.method, request->method); |
129 EXPECT_EQ(expected.url, request->url); | 129 EXPECT_EQ(expected.url, request->url); |
130 CheckHeaders(expected.headers, request->headers); | 130 CheckHeaders(expected.headers, request->headers); |
131 if (expected.body) { | 131 if (expected.body) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 682 |
683 socket_1.Send("How do"); | 683 socket_1.Send("How do"); |
684 socket_1.Send("you do?"); | 684 socket_1.Send("you do?"); |
685 | 685 |
686 socket_0.WaitForMessage(2); | 686 socket_0.WaitForMessage(2); |
687 EXPECT_EQ("How do", socket_0.received_messages()[0]); | 687 EXPECT_EQ("How do", socket_0.received_messages()[0]); |
688 EXPECT_EQ("you do?", socket_0.received_messages()[1]); | 688 EXPECT_EQ("you do?", socket_0.received_messages()[1]); |
689 } | 689 } |
690 | 690 |
691 } // namespace mojo | 691 } // namespace mojo |
OLD | NEW |