OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 TEST_F(HttpServerTest, Request) { | 170 TEST_F(HttpServerTest, Request) { |
171 TestHttpClient client; | 171 TestHttpClient client; |
172 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); | 172 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |
173 client.Send("GET /test HTTP/1.1\r\n\r\n"); | 173 client.Send("GET /test HTTP/1.1\r\n\r\n"); |
174 ASSERT_TRUE(RunUntilRequestsReceived(1)); | 174 ASSERT_TRUE(RunUntilRequestsReceived(1)); |
175 ASSERT_EQ("GET", requests_[0].method); | 175 ASSERT_EQ("GET", requests_[0].method); |
176 ASSERT_EQ("/test", requests_[0].path); | 176 ASSERT_EQ("/test", requests_[0].path); |
177 ASSERT_EQ("", requests_[0].data); | 177 ASSERT_EQ("", requests_[0].data); |
178 ASSERT_EQ(0u, requests_[0].headers.size()); | 178 ASSERT_EQ(0u, requests_[0].headers.size()); |
| 179 ASSERT_TRUE(StartsWithASCII(requests_[0].peer.ToString(), "127.0.0.1", true)); |
179 } | 180 } |
180 | 181 |
181 TEST_F(HttpServerTest, RequestWithHeaders) { | 182 TEST_F(HttpServerTest, RequestWithHeaders) { |
182 TestHttpClient client; | 183 TestHttpClient client; |
183 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); | 184 ASSERT_EQ(OK, client.ConnectAndWait(server_address_)); |
184 const char* kHeaders[][3] = { | 185 const char* kHeaders[][3] = { |
185 {"Header", ": ", "1"}, | 186 {"Header", ": ", "1"}, |
186 {"HeaderWithNoWhitespace", ":", "1"}, | 187 {"HeaderWithNoWhitespace", ":", "1"}, |
187 {"HeaderWithWhitespace", " : \t ", "1 1 1 \t "}, | 188 {"HeaderWithWhitespace", " : \t ", "1 1 1 \t "}, |
188 {"HeaderWithColon", ": ", "1:1"}, | 189 {"HeaderWithColon", ": ", "1:1"}, |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 client.Send("GET /test2 HTTP/1.1\r\n\r\n"); | 311 client.Send("GET /test2 HTTP/1.1\r\n\r\n"); |
311 ASSERT_TRUE(RunUntilRequestsReceived(2)); | 312 ASSERT_TRUE(RunUntilRequestsReceived(2)); |
312 ASSERT_EQ("/test2", requests_[1].path); | 313 ASSERT_EQ("/test2", requests_[1].path); |
313 | 314 |
314 client.Send("GET /test3 HTTP/1.1\r\n\r\n"); | 315 client.Send("GET /test3 HTTP/1.1\r\n\r\n"); |
315 ASSERT_TRUE(RunUntilRequestsReceived(3)); | 316 ASSERT_TRUE(RunUntilRequestsReceived(3)); |
316 ASSERT_EQ("/test3", requests_[2].path); | 317 ASSERT_EQ("/test3", requests_[2].path); |
317 } | 318 } |
318 | 319 |
319 } // namespace net | 320 } // namespace net |
OLD | NEW |