| 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(LogContainsBeginEvent(entry_list, 0, |
| 1257 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(entry_list, 2, |
| 1260 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); | 1262 NetLogEventType::HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); |
| 1261 EXPECT_TRUE(LogContainsEvent(entry_list, 3, | 1263 EXPECT_TRUE(LogContainsEvent(entry_list, 3, |
| 1262 NetLog::TYPE_HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, | 1264 NetLogEventType::HTTP_TRANSACTION_SEND_TUNNEL_HEADERS, |
| 1263 NetLog::PHASE_NONE)); | 1265 NetLogEventPhase::NONE)); |
| 1264 EXPECT_TRUE(LogContainsEndEvent(entry_list, 4, | 1266 EXPECT_TRUE(LogContainsEndEvent(entry_list, 4, |
| 1265 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); | 1267 NetLogEventType::HTTP_TRANSACTION_TUNNEL_SEND_REQUEST)); |
| 1266 EXPECT_TRUE(LogContainsBeginEvent(entry_list, 5, | 1268 EXPECT_TRUE(LogContainsBeginEvent(entry_list, 5, |
| 1267 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); | 1269 NetLogEventType::HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); |
| 1268 EXPECT_TRUE(LogContainsEvent(entry_list, 6, | 1270 EXPECT_TRUE(LogContainsEvent(entry_list, 6, |
| 1269 NetLog::TYPE_HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, | 1271 NetLogEventType::HTTP_TRANSACTION_READ_TUNNEL_RESPONSE_HEADERS, |
| 1270 NetLog::PHASE_NONE)); | 1272 NetLogEventPhase::NONE)); |
| 1271 EXPECT_TRUE(LogContainsEndEvent(entry_list, 7, | 1273 EXPECT_TRUE(LogContainsEndEvent(entry_list, 7, |
| 1272 NetLog::TYPE_HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); | 1274 NetLogEventType::HTTP_TRANSACTION_TUNNEL_READ_HEADERS)); |
| 1273 EXPECT_TRUE(LogContainsEvent(entry_list, 8, | 1275 EXPECT_TRUE(LogContainsEvent(entry_list, 8, |
| 1274 NetLog::TYPE_SOCKET_BYTES_RECEIVED, | 1276 NetLogEventType::SOCKET_BYTES_RECEIVED, |
| 1275 NetLog::PHASE_NONE)); | 1277 NetLogEventPhase::NONE)); |
| 1276 EXPECT_TRUE(LogContainsEndEvent(entry_list, 9, NetLog::TYPE_SOCKET_ALIVE)); | 1278 EXPECT_TRUE(LogContainsEndEvent(entry_list, 9, |
| 1279 NetLogEventType::SOCKET_ALIVE)); |
| 1277 | 1280 |
| 1278 // Let the RST_STREAM write while |rst| is in-scope. | 1281 // Let the RST_STREAM write while |rst| is in-scope. |
| 1279 base::RunLoop().RunUntilIdle(); | 1282 base::RunLoop().RunUntilIdle(); |
| 1280 } | 1283 } |
| 1281 | 1284 |
| 1282 // CompletionCallback that causes the SpdyProxyClientSocket to be | 1285 // CompletionCallback that causes the SpdyProxyClientSocket to be |
| 1283 // deleted when Run is invoked. | 1286 // deleted when Run is invoked. |
| 1284 class DeleteSockCallback : public TestCompletionCallbackBase { | 1287 class DeleteSockCallback : public TestCompletionCallbackBase { |
| 1285 public: | 1288 public: |
| 1286 explicit DeleteSockCallback(std::unique_ptr<SpdyProxyClientSocket>* sock) | 1289 explicit DeleteSockCallback(std::unique_ptr<SpdyProxyClientSocket>* sock) |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1343 | 1346 |
| 1344 EXPECT_FALSE(sock_.get()); | 1347 EXPECT_FALSE(sock_.get()); |
| 1345 EXPECT_TRUE(read_callback.have_result()); | 1348 EXPECT_TRUE(read_callback.have_result()); |
| 1346 EXPECT_FALSE(write_callback_.have_result()); | 1349 EXPECT_FALSE(write_callback_.have_result()); |
| 1347 | 1350 |
| 1348 // Let the RST_STREAM write while |rst| is in-scope. | 1351 // Let the RST_STREAM write while |rst| is in-scope. |
| 1349 base::RunLoop().RunUntilIdle(); | 1352 base::RunLoop().RunUntilIdle(); |
| 1350 } | 1353 } |
| 1351 | 1354 |
| 1352 } // namespace net | 1355 } // namespace net |
| OLD | NEW |