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

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

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

Powered by Google App Engine
This is Rietveld 408576698