Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(121)

Side by Side Diff: net/http/http_stream_factory_impl_unittest.cc

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/http/http_stream_factory_impl.h" 5 #include "net/http/http_stream_factory_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 ~MockWebSocketHandshakeStream() override {} 83 ~MockWebSocketHandshakeStream() override {}
84 84
85 StreamType type() const { 85 StreamType type() const {
86 return type_; 86 return type_;
87 } 87 }
88 88
89 // HttpStream methods 89 // HttpStream methods
90 int InitializeStream(const HttpRequestInfo* request_info, 90 int InitializeStream(const HttpRequestInfo* request_info,
91 RequestPriority priority, 91 RequestPriority priority,
92 const BoundNetLog& net_log, 92 const NetLogWithSource& net_log,
93 const CompletionCallback& callback) override { 93 const CompletionCallback& callback) override {
94 return ERR_IO_PENDING; 94 return ERR_IO_PENDING;
95 } 95 }
96 int SendRequest(const HttpRequestHeaders& request_headers, 96 int SendRequest(const HttpRequestHeaders& request_headers,
97 HttpResponseInfo* response, 97 HttpResponseInfo* response,
98 const CompletionCallback& callback) override { 98 const CompletionCallback& callback) override {
99 return ERR_IO_PENDING; 99 return ERR_IO_PENDING;
100 } 100 }
101 int ReadResponseHeaders(const CompletionCallback& callback) override { 101 int ReadResponseHeaders(const CompletionCallback& callback) override {
102 return ERR_IO_PENDING; 102 return ERR_IO_PENDING;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 int last_num_streams() const { 377 int last_num_streams() const {
378 return last_num_streams_; 378 return last_num_streams_;
379 } 379 }
380 380
381 int RequestSocket(const std::string& group_name, 381 int RequestSocket(const std::string& group_name,
382 const void* socket_params, 382 const void* socket_params,
383 RequestPriority priority, 383 RequestPriority priority,
384 ClientSocketPool::RespectLimits respect_limits, 384 ClientSocketPool::RespectLimits respect_limits,
385 ClientSocketHandle* handle, 385 ClientSocketHandle* handle,
386 const CompletionCallback& callback, 386 const CompletionCallback& callback,
387 const BoundNetLog& net_log) override { 387 const NetLogWithSource& net_log) override {
388 ADD_FAILURE(); 388 ADD_FAILURE();
389 return ERR_UNEXPECTED; 389 return ERR_UNEXPECTED;
390 } 390 }
391 391
392 void RequestSockets(const std::string& group_name, 392 void RequestSockets(const std::string& group_name,
393 const void* socket_params, 393 const void* socket_params,
394 int num_sockets, 394 int num_sockets,
395 const BoundNetLog& net_log) override { 395 const NetLogWithSource& net_log) override {
396 last_num_streams_ = num_sockets; 396 last_num_streams_ = num_sockets;
397 } 397 }
398 398
399 void CancelRequest(const std::string& group_name, 399 void CancelRequest(const std::string& group_name,
400 ClientSocketHandle* handle) override { 400 ClientSocketHandle* handle) override {
401 ADD_FAILURE(); 401 ADD_FAILURE();
402 } 402 }
403 void ReleaseSocket(const std::string& group_name, 403 void ReleaseSocket(const std::string& group_name,
404 std::unique_ptr<StreamSocket> socket, 404 std::unique_ptr<StreamSocket> socket,
405 int id) override { 405 int id) override {
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 // list. 667 // list.
668 HttpRequestInfo request_info; 668 HttpRequestInfo request_info;
669 request_info.method = "GET"; 669 request_info.method = "GET";
670 request_info.url = GURL("http://www.google.com"); 670 request_info.url = GURL("http://www.google.com");
671 671
672 SSLConfig ssl_config; 672 SSLConfig ssl_config;
673 StreamRequestWaiter waiter; 673 StreamRequestWaiter waiter;
674 std::unique_ptr<HttpStreamRequest> request( 674 std::unique_ptr<HttpStreamRequest> request(
675 session->http_stream_factory()->RequestStream( 675 session->http_stream_factory()->RequestStream(
676 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 676 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
677 BoundNetLog())); 677 NetLogWithSource()));
678 waiter.WaitForStream(); 678 waiter.WaitForStream();
679 679
680 // The proxy that failed should now be known to the proxy_service as bad. 680 // The proxy that failed should now be known to the proxy_service as bad.
681 const ProxyRetryInfoMap& retry_info = 681 const ProxyRetryInfoMap& retry_info =
682 session->proxy_service()->proxy_retry_info(); 682 session->proxy_service()->proxy_retry_info();
683 EXPECT_EQ(1u, retry_info.size()); 683 EXPECT_EQ(1u, retry_info.size());
684 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99"); 684 ProxyRetryInfoMap::const_iterator iter = retry_info.find("bad:99");
685 EXPECT_TRUE(iter != retry_info.end()); 685 EXPECT_TRUE(iter != retry_info.end());
686 } 686 }
687 687
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 // list. 752 // list.
753 HttpRequestInfo request_info; 753 HttpRequestInfo request_info;
754 request_info.method = "GET"; 754 request_info.method = "GET";
755 request_info.url = GURL("http://www.google.com"); 755 request_info.url = GURL("http://www.google.com");
756 756
757 SSLConfig ssl_config; 757 SSLConfig ssl_config;
758 StreamRequestWaiter waiter; 758 StreamRequestWaiter waiter;
759 std::unique_ptr<HttpStreamRequest> request( 759 std::unique_ptr<HttpStreamRequest> request(
760 session->http_stream_factory()->RequestStream( 760 session->http_stream_factory()->RequestStream(
761 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 761 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
762 BoundNetLog())); 762 NetLogWithSource()));
763 waiter.WaitForStream(); 763 waiter.WaitForStream();
764 764
765 // The proxy that failed should now be known to the proxy_service as bad. 765 // The proxy that failed should now be known to the proxy_service as bad.
766 const ProxyRetryInfoMap& retry_info = 766 const ProxyRetryInfoMap& retry_info =
767 session->proxy_service()->proxy_retry_info(); 767 session->proxy_service()->proxy_retry_info();
768 EXPECT_EQ(1u, retry_info.size()) << quic_proxy_test_mock_errors[i]; 768 EXPECT_EQ(1u, retry_info.size()) << quic_proxy_test_mock_errors[i];
769 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 769 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
770 770
771 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99"); 771 ProxyRetryInfoMap::const_iterator iter = retry_info.find("quic://bad:99");
772 EXPECT_TRUE(iter != retry_info.end()) << quic_proxy_test_mock_errors[i]; 772 EXPECT_TRUE(iter != retry_info.end()) << quic_proxy_test_mock_errors[i];
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 955
956 // Start two requests. The first request should consume data from 956 // Start two requests. The first request should consume data from
957 // |socket_data_proxy_main_job|, 957 // |socket_data_proxy_main_job|,
958 // |socket_data_proxy_alternate_job| and 958 // |socket_data_proxy_alternate_job| and
959 // |socket_data_direct_first_request|. The second request should consume 959 // |socket_data_direct_first_request|. The second request should consume
960 // data from |socket_data_direct_second_request|. 960 // data from |socket_data_direct_second_request|.
961 for (size_t i = 0; i < 2; ++i) { 961 for (size_t i = 0; i < 2; ++i) {
962 std::unique_ptr<HttpStreamRequest> request( 962 std::unique_ptr<HttpStreamRequest> request(
963 session->http_stream_factory()->RequestStream( 963 session->http_stream_factory()->RequestStream(
964 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 964 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
965 BoundNetLog())); 965 NetLogWithSource()));
966 waiter.WaitForStream(); 966 waiter.WaitForStream();
967 967
968 // The proxy that failed should now be known to the proxy_service as 968 // The proxy that failed should now be known to the proxy_service as
969 // bad. 969 // bad.
970 const ProxyRetryInfoMap retry_info = 970 const ProxyRetryInfoMap retry_info =
971 session->proxy_service()->proxy_retry_info(); 971 session->proxy_service()->proxy_retry_info();
972 EXPECT_EQ(2u, retry_info.size()) << mock_error; 972 EXPECT_EQ(2u, retry_info.size()) << mock_error;
973 973
974 // Verify that request was fetched without proxy. 974 // Verify that request was fetched without proxy.
975 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 975 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1058 1058
1059 EXPECT_TRUE(test_proxy_delegate.alternative_proxy_server().is_quic()); 1059 EXPECT_TRUE(test_proxy_delegate.alternative_proxy_server().is_quic());
1060 1060
1061 // Start two requests. The first request should consume data from 1061 // Start two requests. The first request should consume data from
1062 // |socket_data_proxy_main_job| and |socket_data_https_first|. 1062 // |socket_data_proxy_main_job| and |socket_data_https_first|.
1063 // The second request should consume data from |socket_data_https_second|. 1063 // The second request should consume data from |socket_data_https_second|.
1064 for (size_t i = 0; i < 2; ++i) { 1064 for (size_t i = 0; i < 2; ++i) {
1065 std::unique_ptr<HttpStreamRequest> request( 1065 std::unique_ptr<HttpStreamRequest> request(
1066 session->http_stream_factory()->RequestStream( 1066 session->http_stream_factory()->RequestStream(
1067 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1067 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1068 BoundNetLog())); 1068 NetLogWithSource()));
1069 waiter.WaitForStream(); 1069 waiter.WaitForStream();
1070 1070
1071 // The proxy that failed should now be known to the proxy_service as 1071 // The proxy that failed should now be known to the proxy_service as
1072 // bad. 1072 // bad.
1073 const ProxyRetryInfoMap retry_info = 1073 const ProxyRetryInfoMap retry_info =
1074 session->proxy_service()->proxy_retry_info(); 1074 session->proxy_service()->proxy_retry_info();
1075 // Proxy should not be marked as bad. 1075 // Proxy should not be marked as bad.
1076 EXPECT_EQ(0u, retry_info.size()) << mock_error; 1076 EXPECT_EQ(0u, retry_info.size()) << mock_error;
1077 // Verify that request was fetched using proxy. 1077 // Verify that request was fetched using proxy.
1078 EXPECT_TRUE(waiter.used_proxy_info().is_https()); 1078 EXPECT_TRUE(waiter.used_proxy_info().is_https());
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 request_info.method = "GET"; 1224 request_info.method = "GET";
1225 request_info.url = GURL("https://www.google.com"); 1225 request_info.url = GURL("https://www.google.com");
1226 request_info.load_flags = 0; 1226 request_info.load_flags = 0;
1227 request_info.privacy_mode = PRIVACY_MODE_DISABLED; 1227 request_info.privacy_mode = PRIVACY_MODE_DISABLED;
1228 1228
1229 SSLConfig ssl_config; 1229 SSLConfig ssl_config;
1230 StreamRequestWaiter waiter; 1230 StreamRequestWaiter waiter;
1231 std::unique_ptr<HttpStreamRequest> request( 1231 std::unique_ptr<HttpStreamRequest> request(
1232 session->http_stream_factory()->RequestStream( 1232 session->http_stream_factory()->RequestStream(
1233 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1233 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1234 BoundNetLog())); 1234 NetLogWithSource()));
1235 waiter.WaitForStream(); 1235 waiter.WaitForStream();
1236 1236
1237 // The stream shouldn't come from spdy as we are using different privacy mode 1237 // The stream shouldn't come from spdy as we are using different privacy mode
1238 EXPECT_FALSE(request->using_spdy()); 1238 EXPECT_FALSE(request->using_spdy());
1239 1239
1240 SSLConfig used_ssl_config = waiter.used_ssl_config(); 1240 SSLConfig used_ssl_config = waiter.used_ssl_config();
1241 EXPECT_EQ(used_ssl_config.channel_id_enabled, ssl_config.channel_id_enabled); 1241 EXPECT_EQ(used_ssl_config.channel_id_enabled, ssl_config.channel_id_enabled);
1242 } 1242 }
1243 1243
1244 namespace { 1244 namespace {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 request_info.url = GURL("https://www.google.com"); 1300 request_info.url = GURL("https://www.google.com");
1301 request_info.load_flags = 0; 1301 request_info.load_flags = 0;
1302 request_info.privacy_mode = PRIVACY_MODE_DISABLED; 1302 request_info.privacy_mode = PRIVACY_MODE_DISABLED;
1303 1303
1304 SSLConfig ssl_config; 1304 SSLConfig ssl_config;
1305 StreamRequestWaiter waiter; 1305 StreamRequestWaiter waiter;
1306 1306
1307 std::unique_ptr<HttpStreamRequest> request1( 1307 std::unique_ptr<HttpStreamRequest> request1(
1308 session->http_stream_factory()->RequestStream( 1308 session->http_stream_factory()->RequestStream(
1309 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1309 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1310 BoundNetLog())); 1310 NetLogWithSource()));
1311 waiter.WaitForStream(); 1311 waiter.WaitForStream();
1312 1312
1313 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); 1313 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1);
1314 1314
1315 std::unique_ptr<HttpStreamRequest> request2( 1315 std::unique_ptr<HttpStreamRequest> request2(
1316 session->http_stream_factory()->RequestStream( 1316 session->http_stream_factory()->RequestStream(
1317 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1317 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1318 BoundNetLog())); 1318 NetLogWithSource()));
1319 waiter.WaitForStream(); 1319 waiter.WaitForStream();
1320 1320
1321 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); 1321 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1);
1322 1322
1323 request_info.privacy_mode = PRIVACY_MODE_ENABLED; 1323 request_info.privacy_mode = PRIVACY_MODE_ENABLED;
1324 std::unique_ptr<HttpStreamRequest> request3( 1324 std::unique_ptr<HttpStreamRequest> request3(
1325 session->http_stream_factory()->RequestStream( 1325 session->http_stream_factory()->RequestStream(
1326 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1326 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1327 BoundNetLog())); 1327 NetLogWithSource()));
1328 waiter.WaitForStream(); 1328 waiter.WaitForStream();
1329 1329
1330 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 2); 1330 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 2);
1331 } 1331 }
1332 1332
1333 TEST_F(HttpStreamFactoryTest, GetLoadState) { 1333 TEST_F(HttpStreamFactoryTest, GetLoadState) {
1334 SpdySessionDependencies session_deps(ProxyService::CreateDirect()); 1334 SpdySessionDependencies session_deps(ProxyService::CreateDirect());
1335 1335
1336 // Force asynchronous host resolutions, so that the LoadState will be 1336 // Force asynchronous host resolutions, so that the LoadState will be
1337 // resolving the host. 1337 // resolving the host.
1338 session_deps.host_resolver->set_synchronous_mode(false); 1338 session_deps.host_resolver->set_synchronous_mode(false);
1339 1339
1340 StaticSocketDataProvider socket_data; 1340 StaticSocketDataProvider socket_data;
1341 socket_data.set_connect_data(MockConnect(ASYNC, OK)); 1341 socket_data.set_connect_data(MockConnect(ASYNC, OK));
1342 session_deps.socket_factory->AddSocketDataProvider(&socket_data); 1342 session_deps.socket_factory->AddSocketDataProvider(&socket_data);
1343 1343
1344 std::unique_ptr<HttpNetworkSession> session( 1344 std::unique_ptr<HttpNetworkSession> session(
1345 SpdySessionDependencies::SpdyCreateSession(&session_deps)); 1345 SpdySessionDependencies::SpdyCreateSession(&session_deps));
1346 1346
1347 HttpRequestInfo request_info; 1347 HttpRequestInfo request_info;
1348 request_info.method = "GET"; 1348 request_info.method = "GET";
1349 request_info.url = GURL("http://www.google.com"); 1349 request_info.url = GURL("http://www.google.com");
1350 1350
1351 SSLConfig ssl_config; 1351 SSLConfig ssl_config;
1352 StreamRequestWaiter waiter; 1352 StreamRequestWaiter waiter;
1353 std::unique_ptr<HttpStreamRequest> request( 1353 std::unique_ptr<HttpStreamRequest> request(
1354 session->http_stream_factory()->RequestStream( 1354 session->http_stream_factory()->RequestStream(
1355 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1355 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1356 BoundNetLog())); 1356 NetLogWithSource()));
1357 1357
1358 EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, request->GetLoadState()); 1358 EXPECT_EQ(LOAD_STATE_RESOLVING_HOST, request->GetLoadState());
1359 1359
1360 waiter.WaitForStream(); 1360 waiter.WaitForStream();
1361 } 1361 }
1362 1362
1363 TEST_F(HttpStreamFactoryTest, RequestHttpStream) { 1363 TEST_F(HttpStreamFactoryTest, RequestHttpStream) {
1364 SpdySessionDependencies session_deps(ProxyService::CreateDirect()); 1364 SpdySessionDependencies session_deps(ProxyService::CreateDirect());
1365 1365
1366 StaticSocketDataProvider socket_data; 1366 StaticSocketDataProvider socket_data;
1367 socket_data.set_connect_data(MockConnect(ASYNC, OK)); 1367 socket_data.set_connect_data(MockConnect(ASYNC, OK));
1368 session_deps.socket_factory->AddSocketDataProvider(&socket_data); 1368 session_deps.socket_factory->AddSocketDataProvider(&socket_data);
1369 1369
1370 std::unique_ptr<HttpNetworkSession> session( 1370 std::unique_ptr<HttpNetworkSession> session(
1371 SpdySessionDependencies::SpdyCreateSession(&session_deps)); 1371 SpdySessionDependencies::SpdyCreateSession(&session_deps));
1372 1372
1373 // Now request a stream. It should succeed using the second proxy in the 1373 // Now request a stream. It should succeed using the second proxy in the
1374 // list. 1374 // list.
1375 HttpRequestInfo request_info; 1375 HttpRequestInfo request_info;
1376 request_info.method = "GET"; 1376 request_info.method = "GET";
1377 request_info.url = GURL("http://www.google.com"); 1377 request_info.url = GURL("http://www.google.com");
1378 request_info.load_flags = 0; 1378 request_info.load_flags = 0;
1379 1379
1380 SSLConfig ssl_config; 1380 SSLConfig ssl_config;
1381 StreamRequestWaiter waiter; 1381 StreamRequestWaiter waiter;
1382 std::unique_ptr<HttpStreamRequest> request( 1382 std::unique_ptr<HttpStreamRequest> request(
1383 session->http_stream_factory()->RequestStream( 1383 session->http_stream_factory()->RequestStream(
1384 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1384 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1385 BoundNetLog())); 1385 NetLogWithSource()));
1386 waiter.WaitForStream(); 1386 waiter.WaitForStream();
1387 EXPECT_TRUE(waiter.stream_done()); 1387 EXPECT_TRUE(waiter.stream_done());
1388 ASSERT_TRUE(nullptr != waiter.stream()); 1388 ASSERT_TRUE(nullptr != waiter.stream());
1389 EXPECT_TRUE(nullptr == waiter.websocket_stream()); 1389 EXPECT_TRUE(nullptr == waiter.websocket_stream());
1390 1390
1391 EXPECT_EQ(0, GetSpdySessionCount(session.get())); 1391 EXPECT_EQ(0, GetSpdySessionCount(session.get()));
1392 EXPECT_EQ(1, GetSocketPoolGroupCount( 1392 EXPECT_EQ(1, GetSocketPoolGroupCount(
1393 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1393 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1394 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool( 1394 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetSSLSocketPool(
1395 HttpNetworkSession::NORMAL_SOCKET_POOL))); 1395 HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 23 matching lines...) Expand all
1419 HttpRequestInfo request_info; 1419 HttpRequestInfo request_info;
1420 request_info.method = "GET"; 1420 request_info.method = "GET";
1421 request_info.url = GURL("https://www.google.com"); 1421 request_info.url = GURL("https://www.google.com");
1422 request_info.load_flags = 0; 1422 request_info.load_flags = 0;
1423 1423
1424 SSLConfig ssl_config; 1424 SSLConfig ssl_config;
1425 StreamRequestWaiter waiter; 1425 StreamRequestWaiter waiter;
1426 std::unique_ptr<HttpStreamRequest> request( 1426 std::unique_ptr<HttpStreamRequest> request(
1427 session->http_stream_factory()->RequestStream( 1427 session->http_stream_factory()->RequestStream(
1428 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1428 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1429 BoundNetLog())); 1429 NetLogWithSource()));
1430 waiter.WaitForStream(); 1430 waiter.WaitForStream();
1431 EXPECT_TRUE(waiter.stream_done()); 1431 EXPECT_TRUE(waiter.stream_done());
1432 ASSERT_TRUE(nullptr != waiter.stream()); 1432 ASSERT_TRUE(nullptr != waiter.stream());
1433 EXPECT_TRUE(nullptr == waiter.websocket_stream()); 1433 EXPECT_TRUE(nullptr == waiter.websocket_stream());
1434 1434
1435 EXPECT_EQ(0, GetSpdySessionCount(session.get())); 1435 EXPECT_EQ(0, GetSpdySessionCount(session.get()));
1436 EXPECT_EQ(1, GetSocketPoolGroupCount( 1436 EXPECT_EQ(1, GetSocketPoolGroupCount(
1437 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1437 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1438 EXPECT_EQ(1, GetSocketPoolGroupCount( 1438 EXPECT_EQ(1, GetSocketPoolGroupCount(
1439 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1439 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 21 matching lines...) Expand all
1461 HttpRequestInfo request_info; 1461 HttpRequestInfo request_info;
1462 request_info.method = "GET"; 1462 request_info.method = "GET";
1463 request_info.url = GURL("http://www.google.com"); 1463 request_info.url = GURL("http://www.google.com");
1464 request_info.load_flags = 0; 1464 request_info.load_flags = 0;
1465 1465
1466 SSLConfig ssl_config; 1466 SSLConfig ssl_config;
1467 StreamRequestWaiter waiter; 1467 StreamRequestWaiter waiter;
1468 std::unique_ptr<HttpStreamRequest> request( 1468 std::unique_ptr<HttpStreamRequest> request(
1469 session->http_stream_factory()->RequestStream( 1469 session->http_stream_factory()->RequestStream(
1470 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1470 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1471 BoundNetLog())); 1471 NetLogWithSource()));
1472 waiter.WaitForStream(); 1472 waiter.WaitForStream();
1473 EXPECT_TRUE(waiter.stream_done()); 1473 EXPECT_TRUE(waiter.stream_done());
1474 ASSERT_TRUE(nullptr != waiter.stream()); 1474 ASSERT_TRUE(nullptr != waiter.stream());
1475 EXPECT_TRUE(nullptr == waiter.websocket_stream()); 1475 EXPECT_TRUE(nullptr == waiter.websocket_stream());
1476 1476
1477 EXPECT_EQ(0, GetSpdySessionCount(session.get())); 1477 EXPECT_EQ(0, GetSpdySessionCount(session.get()));
1478 EXPECT_EQ(0, GetSocketPoolGroupCount( 1478 EXPECT_EQ(0, GetSocketPoolGroupCount(
1479 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1479 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1480 EXPECT_EQ(0, GetSocketPoolGroupCount( 1480 EXPECT_EQ(0, GetSocketPoolGroupCount(
1481 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1481 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 26 matching lines...) Expand all
1508 HttpRequestInfo request_info; 1508 HttpRequestInfo request_info;
1509 request_info.method = "GET"; 1509 request_info.method = "GET";
1510 request_info.url = GURL("ws://www.google.com"); 1510 request_info.url = GURL("ws://www.google.com");
1511 request_info.load_flags = 0; 1511 request_info.load_flags = 0;
1512 1512
1513 SSLConfig ssl_config; 1513 SSLConfig ssl_config;
1514 StreamRequestWaiter waiter; 1514 StreamRequestWaiter waiter;
1515 WebSocketStreamCreateHelper create_helper; 1515 WebSocketStreamCreateHelper create_helper;
1516 std::unique_ptr<HttpStreamRequest> request( 1516 std::unique_ptr<HttpStreamRequest> request(
1517 session->http_stream_factory_for_websocket() 1517 session->http_stream_factory_for_websocket()
1518 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 1518 ->RequestWebSocketHandshakeStream(
1519 ssl_config, ssl_config, &waiter, 1519 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1520 &create_helper, BoundNetLog())); 1520 &create_helper, NetLogWithSource()));
1521 waiter.WaitForStream(); 1521 waiter.WaitForStream();
1522 EXPECT_TRUE(waiter.stream_done()); 1522 EXPECT_TRUE(waiter.stream_done());
1523 EXPECT_TRUE(nullptr == waiter.stream()); 1523 EXPECT_TRUE(nullptr == waiter.stream());
1524 ASSERT_TRUE(nullptr != waiter.websocket_stream()); 1524 ASSERT_TRUE(nullptr != waiter.websocket_stream());
1525 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic, 1525 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
1526 waiter.websocket_stream()->type()); 1526 waiter.websocket_stream()->type());
1527 EXPECT_EQ(0, GetSocketPoolGroupCount( 1527 EXPECT_EQ(0, GetSocketPoolGroupCount(
1528 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1528 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1529 EXPECT_EQ(0, GetSocketPoolGroupCount( 1529 EXPECT_EQ(0, GetSocketPoolGroupCount(
1530 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1530 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 20 matching lines...) Expand all
1551 HttpRequestInfo request_info; 1551 HttpRequestInfo request_info;
1552 request_info.method = "GET"; 1552 request_info.method = "GET";
1553 request_info.url = GURL("wss://www.google.com"); 1553 request_info.url = GURL("wss://www.google.com");
1554 request_info.load_flags = 0; 1554 request_info.load_flags = 0;
1555 1555
1556 SSLConfig ssl_config; 1556 SSLConfig ssl_config;
1557 StreamRequestWaiter waiter; 1557 StreamRequestWaiter waiter;
1558 WebSocketStreamCreateHelper create_helper; 1558 WebSocketStreamCreateHelper create_helper;
1559 std::unique_ptr<HttpStreamRequest> request( 1559 std::unique_ptr<HttpStreamRequest> request(
1560 session->http_stream_factory_for_websocket() 1560 session->http_stream_factory_for_websocket()
1561 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 1561 ->RequestWebSocketHandshakeStream(
1562 ssl_config, ssl_config, &waiter, 1562 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1563 &create_helper, BoundNetLog())); 1563 &create_helper, NetLogWithSource()));
1564 waiter.WaitForStream(); 1564 waiter.WaitForStream();
1565 EXPECT_TRUE(waiter.stream_done()); 1565 EXPECT_TRUE(waiter.stream_done());
1566 EXPECT_TRUE(nullptr == waiter.stream()); 1566 EXPECT_TRUE(nullptr == waiter.stream());
1567 ASSERT_TRUE(nullptr != waiter.websocket_stream()); 1567 ASSERT_TRUE(nullptr != waiter.websocket_stream());
1568 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic, 1568 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
1569 waiter.websocket_stream()->type()); 1569 waiter.websocket_stream()->type());
1570 EXPECT_EQ(0, GetSocketPoolGroupCount( 1570 EXPECT_EQ(0, GetSocketPoolGroupCount(
1571 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1571 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1572 EXPECT_EQ(0, GetSocketPoolGroupCount( 1572 EXPECT_EQ(0, GetSocketPoolGroupCount(
1573 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1573 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 18 matching lines...) Expand all
1592 HttpRequestInfo request_info; 1592 HttpRequestInfo request_info;
1593 request_info.method = "GET"; 1593 request_info.method = "GET";
1594 request_info.url = GURL("ws://www.google.com"); 1594 request_info.url = GURL("ws://www.google.com");
1595 request_info.load_flags = 0; 1595 request_info.load_flags = 0;
1596 1596
1597 SSLConfig ssl_config; 1597 SSLConfig ssl_config;
1598 StreamRequestWaiter waiter; 1598 StreamRequestWaiter waiter;
1599 WebSocketStreamCreateHelper create_helper; 1599 WebSocketStreamCreateHelper create_helper;
1600 std::unique_ptr<HttpStreamRequest> request( 1600 std::unique_ptr<HttpStreamRequest> request(
1601 session->http_stream_factory_for_websocket() 1601 session->http_stream_factory_for_websocket()
1602 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 1602 ->RequestWebSocketHandshakeStream(
1603 ssl_config, ssl_config, &waiter, 1603 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1604 &create_helper, BoundNetLog())); 1604 &create_helper, NetLogWithSource()));
1605 waiter.WaitForStream(); 1605 waiter.WaitForStream();
1606 EXPECT_TRUE(waiter.stream_done()); 1606 EXPECT_TRUE(waiter.stream_done());
1607 EXPECT_TRUE(nullptr == waiter.stream()); 1607 EXPECT_TRUE(nullptr == waiter.stream());
1608 ASSERT_TRUE(nullptr != waiter.websocket_stream()); 1608 ASSERT_TRUE(nullptr != waiter.websocket_stream());
1609 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic, 1609 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
1610 waiter.websocket_stream()->type()); 1610 waiter.websocket_stream()->type());
1611 EXPECT_EQ(0, GetSocketPoolGroupCount( 1611 EXPECT_EQ(0, GetSocketPoolGroupCount(
1612 session->GetTransportSocketPool( 1612 session->GetTransportSocketPool(
1613 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); 1613 HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
1614 EXPECT_EQ(0, GetSocketPoolGroupCount( 1614 EXPECT_EQ(0, GetSocketPoolGroupCount(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 HttpRequestInfo request_info; 1648 HttpRequestInfo request_info;
1649 request_info.method = "GET"; 1649 request_info.method = "GET";
1650 request_info.url = GURL("https://www.google.com"); 1650 request_info.url = GURL("https://www.google.com");
1651 request_info.load_flags = 0; 1651 request_info.load_flags = 0;
1652 1652
1653 SSLConfig ssl_config; 1653 SSLConfig ssl_config;
1654 StreamRequestWaiter waiter; 1654 StreamRequestWaiter waiter;
1655 std::unique_ptr<HttpStreamRequest> request( 1655 std::unique_ptr<HttpStreamRequest> request(
1656 session->http_stream_factory()->RequestStream( 1656 session->http_stream_factory()->RequestStream(
1657 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1657 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1658 BoundNetLog())); 1658 NetLogWithSource()));
1659 waiter.WaitForStream(); 1659 waiter.WaitForStream();
1660 EXPECT_TRUE(waiter.stream_done()); 1660 EXPECT_TRUE(waiter.stream_done());
1661 EXPECT_TRUE(nullptr == waiter.websocket_stream()); 1661 EXPECT_TRUE(nullptr == waiter.websocket_stream());
1662 ASSERT_TRUE(nullptr != waiter.stream()); 1662 ASSERT_TRUE(nullptr != waiter.stream());
1663 1663
1664 EXPECT_EQ(1, GetSpdySessionCount(session.get())); 1664 EXPECT_EQ(1, GetSpdySessionCount(session.get()));
1665 EXPECT_EQ(1, GetSocketPoolGroupCount( 1665 EXPECT_EQ(1, GetSocketPoolGroupCount(
1666 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1666 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
1667 EXPECT_EQ(1, GetSocketPoolGroupCount( 1667 EXPECT_EQ(1, GetSocketPoolGroupCount(
1668 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 1668 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 25 matching lines...) Expand all
1694 HttpRequestInfo request_info; 1694 HttpRequestInfo request_info;
1695 request_info.method = "GET"; 1695 request_info.method = "GET";
1696 request_info.url = GURL("https://www.google.com"); 1696 request_info.url = GURL("https://www.google.com");
1697 request_info.load_flags = 0; 1697 request_info.load_flags = 0;
1698 1698
1699 SSLConfig ssl_config; 1699 SSLConfig ssl_config;
1700 StreamRequestWaiter waiter; 1700 StreamRequestWaiter waiter;
1701 std::unique_ptr<HttpStreamRequest> request( 1701 std::unique_ptr<HttpStreamRequest> request(
1702 session->http_stream_factory()->RequestBidirectionalStreamImpl( 1702 session->http_stream_factory()->RequestBidirectionalStreamImpl(
1703 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1703 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1704 BoundNetLog())); 1704 NetLogWithSource()));
1705 waiter.WaitForStream(); 1705 waiter.WaitForStream();
1706 EXPECT_TRUE(waiter.stream_done()); 1706 EXPECT_TRUE(waiter.stream_done());
1707 EXPECT_FALSE(waiter.websocket_stream()); 1707 EXPECT_FALSE(waiter.websocket_stream());
1708 ASSERT_FALSE(waiter.stream()); 1708 ASSERT_FALSE(waiter.stream());
1709 ASSERT_TRUE(waiter.bidirectional_stream_impl()); 1709 ASSERT_TRUE(waiter.bidirectional_stream_impl());
1710 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool( 1710 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool(
1711 HttpNetworkSession::NORMAL_SOCKET_POOL))); 1711 HttpNetworkSession::NORMAL_SOCKET_POOL)));
1712 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool( 1712 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool(
1713 HttpNetworkSession::NORMAL_SOCKET_POOL))); 1713 HttpNetworkSession::NORMAL_SOCKET_POOL)));
1714 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetTransportSocketPool( 1714 EXPECT_EQ(0, GetSocketPoolGroupCount(session->GetTransportSocketPool(
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1862 SSLConfig ssl_config; 1862 SSLConfig ssl_config;
1863 HttpRequestInfo request_info; 1863 HttpRequestInfo request_info;
1864 request_info.method = "GET"; 1864 request_info.method = "GET";
1865 request_info.url = default_url_; 1865 request_info.url = default_url_;
1866 request_info.load_flags = 0; 1866 request_info.load_flags = 0;
1867 1867
1868 StreamRequestWaiter waiter; 1868 StreamRequestWaiter waiter;
1869 std::unique_ptr<HttpStreamRequest> request( 1869 std::unique_ptr<HttpStreamRequest> request(
1870 session()->http_stream_factory()->RequestBidirectionalStreamImpl( 1870 session()->http_stream_factory()->RequestBidirectionalStreamImpl(
1871 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1871 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1872 BoundNetLog())); 1872 NetLogWithSource()));
1873 1873
1874 waiter.WaitForStream(); 1874 waiter.WaitForStream();
1875 EXPECT_TRUE(waiter.stream_done()); 1875 EXPECT_TRUE(waiter.stream_done());
1876 EXPECT_FALSE(waiter.websocket_stream()); 1876 EXPECT_FALSE(waiter.websocket_stream());
1877 ASSERT_FALSE(waiter.stream()); 1877 ASSERT_FALSE(waiter.stream());
1878 ASSERT_TRUE(waiter.bidirectional_stream_impl()); 1878 ASSERT_TRUE(waiter.bidirectional_stream_impl());
1879 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); 1879 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl();
1880 1880
1881 BidirectionalStreamRequestInfo bidi_request_info; 1881 BidirectionalStreamRequestInfo bidi_request_info;
1882 bidi_request_info.method = "GET"; 1882 bidi_request_info.method = "GET";
1883 bidi_request_info.url = default_url_; 1883 bidi_request_info.url = default_url_;
1884 bidi_request_info.end_stream_on_headers = true; 1884 bidi_request_info.end_stream_on_headers = true;
1885 bidi_request_info.priority = LOWEST; 1885 bidi_request_info.priority = LOWEST;
1886 1886
1887 TestBidirectionalDelegate delegate; 1887 TestBidirectionalDelegate delegate;
1888 stream_impl->Start(&bidi_request_info, BoundNetLog(), 1888 stream_impl->Start(&bidi_request_info, NetLogWithSource(),
1889 /*send_request_headers_automatically=*/true, &delegate, 1889 /*send_request_headers_automatically=*/true, &delegate,
1890 nullptr); 1890 nullptr);
1891 delegate.WaitUntilDone(); 1891 delegate.WaitUntilDone();
1892 1892
1893 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); 1893 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1);
1894 EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk()); 1894 EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk());
1895 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); 1895 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol());
1896 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); 1896 EXPECT_EQ("200", delegate.response_headers().find(":status")->second);
1897 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool( 1897 EXPECT_EQ(0, GetSocketPoolGroupCount(session()->GetTransportSocketPool(
1898 HttpNetworkSession::NORMAL_SOCKET_POOL))); 1898 HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 28 matching lines...) Expand all
1927 SSLConfig ssl_config; 1927 SSLConfig ssl_config;
1928 HttpRequestInfo request_info; 1928 HttpRequestInfo request_info;
1929 request_info.method = "GET"; 1929 request_info.method = "GET";
1930 request_info.url = default_url_; 1930 request_info.url = default_url_;
1931 request_info.load_flags = 0; 1931 request_info.load_flags = 0;
1932 1932
1933 StreamRequestWaiter waiter; 1933 StreamRequestWaiter waiter;
1934 std::unique_ptr<HttpStreamRequest> request( 1934 std::unique_ptr<HttpStreamRequest> request(
1935 session()->http_stream_factory()->RequestBidirectionalStreamImpl( 1935 session()->http_stream_factory()->RequestBidirectionalStreamImpl(
1936 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1936 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1937 BoundNetLog())); 1937 NetLogWithSource()));
1938 1938
1939 waiter.WaitForStream(); 1939 waiter.WaitForStream();
1940 EXPECT_TRUE(waiter.stream_done()); 1940 EXPECT_TRUE(waiter.stream_done());
1941 EXPECT_FALSE(waiter.websocket_stream()); 1941 EXPECT_FALSE(waiter.websocket_stream());
1942 ASSERT_FALSE(waiter.stream()); 1942 ASSERT_FALSE(waiter.stream());
1943 ASSERT_FALSE(waiter.bidirectional_stream_impl()); 1943 ASSERT_FALSE(waiter.bidirectional_stream_impl());
1944 // Since the alternative service job is not started, we will get the error 1944 // Since the alternative service job is not started, we will get the error
1945 // from the http job. 1945 // from the http job.
1946 ASSERT_THAT(waiter.error_status(), IsError(ERR_CONNECTION_REFUSED)); 1946 ASSERT_THAT(waiter.error_status(), IsError(ERR_CONNECTION_REFUSED));
1947 } 1947 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1985 SSLConfig ssl_config; 1985 SSLConfig ssl_config;
1986 HttpRequestInfo request_info; 1986 HttpRequestInfo request_info;
1987 request_info.method = "GET"; 1987 request_info.method = "GET";
1988 request_info.url = default_url_; 1988 request_info.url = default_url_;
1989 request_info.load_flags = 0; 1989 request_info.load_flags = 0;
1990 1990
1991 StreamRequestWaiter waiter; 1991 StreamRequestWaiter waiter;
1992 std::unique_ptr<HttpStreamRequest> request( 1992 std::unique_ptr<HttpStreamRequest> request(
1993 session()->http_stream_factory()->RequestBidirectionalStreamImpl( 1993 session()->http_stream_factory()->RequestBidirectionalStreamImpl(
1994 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 1994 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
1995 BoundNetLog())); 1995 NetLogWithSource()));
1996 1996
1997 waiter.WaitForStream(); 1997 waiter.WaitForStream();
1998 EXPECT_TRUE(waiter.stream_done()); 1998 EXPECT_TRUE(waiter.stream_done());
1999 EXPECT_FALSE(waiter.websocket_stream()); 1999 EXPECT_FALSE(waiter.websocket_stream());
2000 ASSERT_FALSE(waiter.stream()); 2000 ASSERT_FALSE(waiter.stream());
2001 ASSERT_TRUE(waiter.bidirectional_stream_impl()); 2001 ASSERT_TRUE(waiter.bidirectional_stream_impl());
2002 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl(); 2002 BidirectionalStreamImpl* stream_impl = waiter.bidirectional_stream_impl();
2003 2003
2004 BidirectionalStreamRequestInfo bidi_request_info; 2004 BidirectionalStreamRequestInfo bidi_request_info;
2005 bidi_request_info.method = "GET"; 2005 bidi_request_info.method = "GET";
2006 bidi_request_info.url = default_url_; 2006 bidi_request_info.url = default_url_;
2007 bidi_request_info.end_stream_on_headers = true; 2007 bidi_request_info.end_stream_on_headers = true;
2008 bidi_request_info.priority = LOWEST; 2008 bidi_request_info.priority = LOWEST;
2009 2009
2010 TestBidirectionalDelegate delegate; 2010 TestBidirectionalDelegate delegate;
2011 stream_impl->Start(&bidi_request_info, BoundNetLog(), 2011 stream_impl->Start(&bidi_request_info, NetLogWithSource(),
2012 /*send_request_headers_automatically=*/true, &delegate, 2012 /*send_request_headers_automatically=*/true, &delegate,
2013 nullptr); 2013 nullptr);
2014 delegate.WaitUntilDone(); 2014 delegate.WaitUntilDone();
2015 2015
2016 // Make sure the BidirectionalStream negotiated goes through QUIC. 2016 // Make sure the BidirectionalStream negotiated goes through QUIC.
2017 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1); 2017 scoped_refptr<IOBuffer> buffer = new net::IOBuffer(1);
2018 EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk()); 2018 EXPECT_THAT(stream_impl->ReadData(buffer.get(), 1), IsOk());
2019 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol()); 2019 EXPECT_EQ(kProtoQUIC1SPDY3, stream_impl->GetProtocol());
2020 EXPECT_EQ("200", delegate.response_headers().find(":status")->second); 2020 EXPECT_EQ("200", delegate.response_headers().find(":status")->second);
2021 // There is no Http2 socket pool. 2021 // There is no Http2 socket pool.
(...skipping 30 matching lines...) Expand all
2052 HttpRequestInfo request_info; 2052 HttpRequestInfo request_info;
2053 request_info.method = "GET"; 2053 request_info.method = "GET";
2054 request_info.url = GURL("https://www.google.com"); 2054 request_info.url = GURL("https://www.google.com");
2055 request_info.load_flags = 0; 2055 request_info.load_flags = 0;
2056 2056
2057 SSLConfig ssl_config; 2057 SSLConfig ssl_config;
2058 StreamRequestWaiter waiter; 2058 StreamRequestWaiter waiter;
2059 std::unique_ptr<HttpStreamRequest> request( 2059 std::unique_ptr<HttpStreamRequest> request(
2060 session->http_stream_factory()->RequestBidirectionalStreamImpl( 2060 session->http_stream_factory()->RequestBidirectionalStreamImpl(
2061 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter, 2061 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
2062 BoundNetLog())); 2062 NetLogWithSource()));
2063 waiter.WaitForStream(); 2063 waiter.WaitForStream();
2064 EXPECT_TRUE(waiter.stream_done()); 2064 EXPECT_TRUE(waiter.stream_done());
2065 ASSERT_THAT(waiter.error_status(), IsError(ERR_FAILED)); 2065 ASSERT_THAT(waiter.error_status(), IsError(ERR_FAILED));
2066 EXPECT_FALSE(waiter.websocket_stream()); 2066 EXPECT_FALSE(waiter.websocket_stream());
2067 ASSERT_FALSE(waiter.stream()); 2067 ASSERT_FALSE(waiter.stream());
2068 ASSERT_FALSE(waiter.bidirectional_stream_impl()); 2068 ASSERT_FALSE(waiter.bidirectional_stream_impl());
2069 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool( 2069 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetTransportSocketPool(
2070 HttpNetworkSession::NORMAL_SOCKET_POOL))); 2070 HttpNetworkSession::NORMAL_SOCKET_POOL)));
2071 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool( 2071 EXPECT_EQ(1, GetSocketPoolGroupCount(session->GetSSLSocketPool(
2072 HttpNetworkSession::NORMAL_SOCKET_POOL))); 2072 HttpNetworkSession::NORMAL_SOCKET_POOL)));
(...skipping 25 matching lines...) Expand all
2098 HttpRequestInfo request_info; 2098 HttpRequestInfo request_info;
2099 request_info.method = "GET"; 2099 request_info.method = "GET";
2100 request_info.url = GURL("wss://www.google.com"); 2100 request_info.url = GURL("wss://www.google.com");
2101 request_info.load_flags = 0; 2101 request_info.load_flags = 0;
2102 2102
2103 SSLConfig ssl_config; 2103 SSLConfig ssl_config;
2104 StreamRequestWaiter waiter1; 2104 StreamRequestWaiter waiter1;
2105 WebSocketStreamCreateHelper create_helper; 2105 WebSocketStreamCreateHelper create_helper;
2106 std::unique_ptr<HttpStreamRequest> request1( 2106 std::unique_ptr<HttpStreamRequest> request1(
2107 session->http_stream_factory_for_websocket() 2107 session->http_stream_factory_for_websocket()
2108 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 2108 ->RequestWebSocketHandshakeStream(
2109 ssl_config, ssl_config, &waiter1, 2109 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter1,
2110 &create_helper, BoundNetLog())); 2110 &create_helper, NetLogWithSource()));
2111 waiter1.WaitForStream(); 2111 waiter1.WaitForStream();
2112 EXPECT_TRUE(waiter1.stream_done()); 2112 EXPECT_TRUE(waiter1.stream_done());
2113 ASSERT_TRUE(nullptr != waiter1.websocket_stream()); 2113 ASSERT_TRUE(nullptr != waiter1.websocket_stream());
2114 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic, 2114 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeBasic,
2115 waiter1.websocket_stream()->type()); 2115 waiter1.websocket_stream()->type());
2116 EXPECT_TRUE(nullptr == waiter1.stream()); 2116 EXPECT_TRUE(nullptr == waiter1.stream());
2117 2117
2118 EXPECT_EQ(0, GetSocketPoolGroupCount( 2118 EXPECT_EQ(0, GetSocketPoolGroupCount(
2119 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 2119 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
2120 EXPECT_EQ(0, GetSocketPoolGroupCount( 2120 EXPECT_EQ(0, GetSocketPoolGroupCount(
(...skipping 24 matching lines...) Expand all
2145 HttpRequestInfo request_info; 2145 HttpRequestInfo request_info;
2146 request_info.method = "GET"; 2146 request_info.method = "GET";
2147 request_info.url = GURL("wss://www.google.com"); 2147 request_info.url = GURL("wss://www.google.com");
2148 request_info.load_flags = 0; 2148 request_info.load_flags = 0;
2149 2149
2150 SSLConfig ssl_config; 2150 SSLConfig ssl_config;
2151 StreamRequestWaiter waiter1; 2151 StreamRequestWaiter waiter1;
2152 WebSocketStreamCreateHelper create_helper; 2152 WebSocketStreamCreateHelper create_helper;
2153 std::unique_ptr<HttpStreamRequest> request1( 2153 std::unique_ptr<HttpStreamRequest> request1(
2154 session->http_stream_factory_for_websocket() 2154 session->http_stream_factory_for_websocket()
2155 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 2155 ->RequestWebSocketHandshakeStream(
2156 ssl_config, ssl_config, &waiter1, 2156 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter1,
2157 &create_helper, BoundNetLog())); 2157 &create_helper, NetLogWithSource()));
2158 waiter1.WaitForStream(); 2158 waiter1.WaitForStream();
2159 EXPECT_TRUE(waiter1.stream_done()); 2159 EXPECT_TRUE(waiter1.stream_done());
2160 ASSERT_TRUE(nullptr != waiter1.websocket_stream()); 2160 ASSERT_TRUE(nullptr != waiter1.websocket_stream());
2161 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy, 2161 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
2162 waiter1.websocket_stream()->type()); 2162 waiter1.websocket_stream()->type());
2163 EXPECT_TRUE(nullptr == waiter1.stream()); 2163 EXPECT_TRUE(nullptr == waiter1.stream());
2164 2164
2165 StreamRequestWaiter waiter2; 2165 StreamRequestWaiter waiter2;
2166 std::unique_ptr<HttpStreamRequest> request2( 2166 std::unique_ptr<HttpStreamRequest> request2(
2167 session->http_stream_factory_for_websocket() 2167 session->http_stream_factory_for_websocket()
2168 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 2168 ->RequestWebSocketHandshakeStream(
2169 ssl_config, ssl_config, &waiter2, 2169 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter2,
2170 &create_helper, BoundNetLog())); 2170 &create_helper, NetLogWithSource()));
2171 waiter2.WaitForStream(); 2171 waiter2.WaitForStream();
2172 EXPECT_TRUE(waiter2.stream_done()); 2172 EXPECT_TRUE(waiter2.stream_done());
2173 ASSERT_TRUE(nullptr != waiter2.websocket_stream()); 2173 ASSERT_TRUE(nullptr != waiter2.websocket_stream());
2174 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy, 2174 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
2175 waiter2.websocket_stream()->type()); 2175 waiter2.websocket_stream()->type());
2176 EXPECT_TRUE(nullptr == waiter2.stream()); 2176 EXPECT_TRUE(nullptr == waiter2.stream());
2177 EXPECT_NE(waiter2.websocket_stream(), waiter1.websocket_stream()); 2177 EXPECT_NE(waiter2.websocket_stream(), waiter1.websocket_stream());
2178 EXPECT_EQ(static_cast<WebSocketSpdyHandshakeStream*>( 2178 EXPECT_EQ(static_cast<WebSocketSpdyHandshakeStream*>(
2179 waiter2.websocket_stream())->spdy_session(), 2179 waiter2.websocket_stream())->spdy_session(),
2180 static_cast<WebSocketSpdyHandshakeStream*>( 2180 static_cast<WebSocketSpdyHandshakeStream*>(
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 session->http_server_properties()->SetAlternativeService( 2224 session->http_server_properties()->SetAlternativeService(
2225 url::SchemeHostPort(request_info.url.scheme(), host_port_pair.host(), 2225 url::SchemeHostPort(request_info.url.scheme(), host_port_pair.host(),
2226 host_port_pair.port()), 2226 host_port_pair.port()),
2227 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration); 2227 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration);
2228 2228
2229 SSLConfig ssl_config; 2229 SSLConfig ssl_config;
2230 StreamRequestWaiter waiter; 2230 StreamRequestWaiter waiter;
2231 WebSocketStreamCreateHelper create_helper; 2231 WebSocketStreamCreateHelper create_helper;
2232 std::unique_ptr<HttpStreamRequest> request( 2232 std::unique_ptr<HttpStreamRequest> request(
2233 session->http_stream_factory_for_websocket() 2233 session->http_stream_factory_for_websocket()
2234 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 2234 ->RequestWebSocketHandshakeStream(
2235 ssl_config, ssl_config, &waiter, 2235 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, &waiter,
2236 &create_helper, BoundNetLog())); 2236 &create_helper, NetLogWithSource()));
2237 waiter.WaitForStream(); 2237 waiter.WaitForStream();
2238 EXPECT_TRUE(waiter.stream_done()); 2238 EXPECT_TRUE(waiter.stream_done());
2239 EXPECT_TRUE(nullptr == waiter.stream()); 2239 EXPECT_TRUE(nullptr == waiter.stream());
2240 ASSERT_TRUE(nullptr != waiter.websocket_stream()); 2240 ASSERT_TRUE(nullptr != waiter.websocket_stream());
2241 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy, 2241 EXPECT_EQ(MockWebSocketHandshakeStream::kStreamTypeSpdy,
2242 waiter.websocket_stream()->type()); 2242 waiter.websocket_stream()->type());
2243 2243
2244 // Make sure that there was an alternative connection 2244 // Make sure that there was an alternative connection
2245 // which consumes extra connections. 2245 // which consumes extra connections.
2246 EXPECT_EQ(0, GetSocketPoolGroupCount( 2246 EXPECT_EQ(0, GetSocketPoolGroupCount(
2247 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 2247 session->GetTransportSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
2248 EXPECT_EQ(0, GetSocketPoolGroupCount( 2248 EXPECT_EQ(0, GetSocketPoolGroupCount(
2249 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL))); 2249 session->GetSSLSocketPool(HttpNetworkSession::NORMAL_SOCKET_POOL)));
2250 EXPECT_EQ(2, GetSocketPoolGroupCount( 2250 EXPECT_EQ(2, GetSocketPoolGroupCount(
2251 session->GetTransportSocketPool( 2251 session->GetTransportSocketPool(
2252 HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); 2252 HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
2253 EXPECT_EQ(1, GetSocketPoolGroupCount( 2253 EXPECT_EQ(1, GetSocketPoolGroupCount(
2254 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL))); 2254 session->GetSSLSocketPool(HttpNetworkSession::WEBSOCKET_SOCKET_POOL)));
2255 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 2255 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
2256 } 2256 }
2257 2257
2258 } // namespace 2258 } // namespace
2259 2259
2260 } // namespace net 2260 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698