OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "net/spdy/spdy_proxy_client_socket.h" | 5 #include "net/spdy/spdy_proxy_client_socket.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "net/base/address_list.h" | 14 #include "net/base/address_list.h" |
15 #include "net/base/test_completion_callback.h" | 15 #include "net/base/test_completion_callback.h" |
16 #include "net/base/winsock_init.h" | 16 #include "net/base/winsock_init.h" |
17 #include "net/dns/mock_host_resolver.h" | 17 #include "net/dns/mock_host_resolver.h" |
18 #include "net/http/http_response_headers.h" | 18 #include "net/http/http_response_headers.h" |
19 #include "net/http/http_response_info.h" | 19 #include "net/http/http_response_info.h" |
20 #include "net/log/net_log.h" | 20 #include "net/log/net_log.h" |
| 21 #include "net/log/net_log_event_type.h" |
21 #include "net/log/test_net_log.h" | 22 #include "net/log/test_net_log.h" |
22 #include "net/log/test_net_log_entry.h" | 23 #include "net/log/test_net_log_entry.h" |
23 #include "net/log/test_net_log_util.h" | 24 #include "net/log/test_net_log_util.h" |
24 #include "net/socket/client_socket_factory.h" | 25 #include "net/socket/client_socket_factory.h" |
25 #include "net/socket/socket_test_util.h" | 26 #include "net/socket/socket_test_util.h" |
26 #include "net/socket/tcp_client_socket.h" | 27 #include "net/socket/tcp_client_socket.h" |
27 #include "net/spdy/buffered_spdy_framer.h" | 28 #include "net/spdy/buffered_spdy_framer.h" |
28 #include "net/spdy/spdy_http_utils.h" | 29 #include "net/spdy/spdy_http_utils.h" |
29 #include "net/spdy/spdy_protocol.h" | 30 #include "net/spdy/spdy_protocol.h" |
30 #include "net/spdy/spdy_session_pool.h" | 31 #include "net/spdy/spdy_session_pool.h" |
(...skipping 1214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 ResumeAndRun(); | 1246 ResumeAndRun(); |
1246 AssertSyncReadEquals(kMsg1, kLen1); | 1247 AssertSyncReadEquals(kMsg1, kLen1); |
1247 | 1248 |
1248 NetLog::Source sock_source = sock_->NetLog().source(); | 1249 NetLog::Source sock_source = sock_->NetLog().source(); |
1249 sock_.reset(); | 1250 sock_.reset(); |
1250 | 1251 |
1251 TestNetLogEntry::List entry_list; | 1252 TestNetLogEntry::List entry_list; |
1252 net_log_.GetEntriesForSource(sock_source, &entry_list); | 1253 net_log_.GetEntriesForSource(sock_source, &entry_list); |
1253 | 1254 |
1254 ASSERT_EQ(entry_list.size(), 10u); | 1255 ASSERT_EQ(entry_list.size(), 10u); |
1255 EXPECT_TRUE(LogContainsBeginEvent(entry_list, 0, NetLog::TYPE_SOCKET_ALIVE)); | 1256 EXPECT_TRUE( |
| 1257 LogContainsBeginEvent(entry_list, 0, NetLogEventType::SOCKET_ALIVE)); |
1256 EXPECT_TRUE(LogContainsEvent(entry_list, 1, | 1258 EXPECT_TRUE(LogContainsEvent(entry_list, 1, |
1257 NetLog::TYPE_HTTP2_PROXY_CLIENT_SESSION, | 1259 NetLogEventType::HTTP2_PROXY_CLIENT_SESSION, |
1258 NetLog::PHASE_NONE)); | 1260 NetLogEventPhase::NONE)); |
1259 EXPECT_TRUE(LogContainsBeginEvent(entry_list, 2, | 1261 EXPECT_TRUE(LogContainsBeginEvent( |
1260 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); | 1262 entry_list, 2, NetLogEventType::HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); |
1261 EXPECT_TRUE(LogContainsEvent(entry_list, 3, | 1263 EXPECT_TRUE(LogContainsEvent( |
1262 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 1264 entry_list, 3, NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
1263 NetLog::PHASE_NONE)); | 1265 NetLogEventPhase::NONE)); |
1264 EXPECT_TRUE(LogContainsEndEvent(entry_list, 4, | 1266 EXPECT_TRUE(LogContainsEndEvent( |
1265 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); | 1267 entry_list, 4, NetLogEventType::HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); |
1266 EXPECT_TRUE(LogContainsBeginEvent(entry_list, 5, | 1268 EXPECT_TRUE(LogContainsBeginEvent( |
1267 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); | 1269 entry_list, 5, NetLogEventType::HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); |
1268 EXPECT_TRUE(LogContainsEvent(entry_list, 6, | 1270 EXPECT_TRUE(LogContainsEvent( |
1269 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 1271 entry_list, 6, |
1270 NetLog::PHASE_NONE)); | 1272 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
1271 EXPECT_TRUE(LogContainsEndEvent(entry_list, 7, | 1273 NetLogEventPhase::NONE)); |
1272 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); | 1274 EXPECT_TRUE(LogContainsEndEvent( |
| 1275 entry_list, 7, NetLogEventType::HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); |
1273 EXPECT_TRUE(LogContainsEvent(entry_list, 8, | 1276 EXPECT_TRUE(LogContainsEvent(entry_list, 8, |
1274 NetLog::TYPE_SOCKET_BYTES_RECEIVED, | 1277 NetLogEventType::SOCKET_BYTES_RECEIVED, |
1275 NetLog::PHASE_NONE)); | 1278 NetLogEventPhase::NONE)); |
1276 EXPECT_TRUE(LogContainsEndEvent(entry_list, 9, NetLog::TYPE_SOCKET_ALIVE)); | 1279 EXPECT_TRUE( |
| 1280 LogContainsEndEvent(entry_list, 9, NetLogEventType::SOCKET_ALIVE)); |
1277 | 1281 |
1278 // Let the RST_STREAM write while |rst| is in-scope. | 1282 // Let the RST_STREAM write while |rst| is in-scope. |
1279 base::RunLoop().RunUntilIdle(); | 1283 base::RunLoop().RunUntilIdle(); |
1280 } | 1284 } |
1281 | 1285 |
1282 // CompletionCallback that causes the SpdyProxyClientSocket to be | 1286 // CompletionCallback that causes the SpdyProxyClientSocket to be |
1283 // deleted when Run is invoked. | 1287 // deleted when Run is invoked. |
1284 class DeleteSockCallback : public TestCompletionCallbackBase { | 1288 class DeleteSockCallback : public TestCompletionCallbackBase { |
1285 public: | 1289 public: |
1286 explicit DeleteSockCallback(std::unique_ptr<SpdyProxyClientSocket>* sock) | 1290 explicit DeleteSockCallback(std::unique_ptr<SpdyProxyClientSocket>* sock) |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 | 1347 |
1344 EXPECT_FALSE(sock_.get()); | 1348 EXPECT_FALSE(sock_.get()); |
1345 EXPECT_TRUE(read_callback.have_result()); | 1349 EXPECT_TRUE(read_callback.have_result()); |
1346 EXPECT_FALSE(write_callback_.have_result()); | 1350 EXPECT_FALSE(write_callback_.have_result()); |
1347 | 1351 |
1348 // Let the RST_STREAM write while |rst| is in-scope. | 1352 // Let the RST_STREAM write while |rst| is in-scope. |
1349 base::RunLoop().RunUntilIdle(); | 1353 base::RunLoop().RunUntilIdle(); |
1350 } | 1354 } |
1351 | 1355 |
1352 } // namespace net | 1356 } // namespace net |
OLD | NEW |