| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 for (size_t i = 0; i < arraysize(kTests); ++i) { | 543 for (size_t i = 0; i < arraysize(kTests); ++i) { |
| 544 SpdySessionDependencies session_deps( | 544 SpdySessionDependencies session_deps( |
| 545 GetParam(), ProxyService::CreateDirect()); | 545 GetParam(), ProxyService::CreateDirect()); |
| 546 scoped_refptr<HttpNetworkSession> session( | 546 scoped_refptr<HttpNetworkSession> session( |
| 547 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | 547 SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| 548 HttpNetworkSessionPeer peer(session); | 548 HttpNetworkSessionPeer peer(session); |
| 549 | 549 |
| 550 // Put a SpdySession in the pool. | 550 // Put a SpdySession in the pool. |
| 551 HostPortPair host_port_pair("www.google.com", 443); | 551 HostPortPair host_port_pair("www.google.com", 443); |
| 552 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 552 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 553 kPrivacyModeDisabled); | 553 PRIVACY_MODE_DISABLED); |
| 554 ignore_result(CreateFakeSpdySession(session->spdy_session_pool(), key)); | 554 ignore_result(CreateFakeSpdySession(session->spdy_session_pool(), key)); |
| 555 | 555 |
| 556 CapturePreconnectsTransportSocketPool* transport_conn_pool = | 556 CapturePreconnectsTransportSocketPool* transport_conn_pool = |
| 557 new CapturePreconnectsTransportSocketPool( | 557 new CapturePreconnectsTransportSocketPool( |
| 558 session_deps.host_resolver.get(), | 558 session_deps.host_resolver.get(), |
| 559 session_deps.cert_verifier.get()); | 559 session_deps.cert_verifier.get()); |
| 560 CapturePreconnectsSSLSocketPool* ssl_conn_pool = | 560 CapturePreconnectsSSLSocketPool* ssl_conn_pool = |
| 561 new CapturePreconnectsSSLSocketPool( | 561 new CapturePreconnectsSSLSocketPool( |
| 562 session_deps.host_resolver.get(), | 562 session_deps.host_resolver.get(), |
| 563 session_deps.cert_verifier.get()); | 563 session_deps.cert_verifier.get()); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 | 654 |
| 655 SSLSocketDataProvider ssl(ASYNC, OK); | 655 SSLSocketDataProvider ssl(ASYNC, OK); |
| 656 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl); | 656 session_deps.socket_factory->AddSSLSocketDataProvider(&ssl); |
| 657 | 657 |
| 658 scoped_refptr<HttpNetworkSession> session( | 658 scoped_refptr<HttpNetworkSession> session( |
| 659 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | 659 SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| 660 | 660 |
| 661 // Set an existing SpdySession in the pool. | 661 // Set an existing SpdySession in the pool. |
| 662 HostPortPair host_port_pair("www.google.com", 443); | 662 HostPortPair host_port_pair("www.google.com", 443); |
| 663 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), | 663 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), |
| 664 kPrivacyModeEnabled); | 664 PRIVACY_MODE_ENABLED); |
| 665 | 665 |
| 666 HttpRequestInfo request_info; | 666 HttpRequestInfo request_info; |
| 667 request_info.method = "GET"; | 667 request_info.method = "GET"; |
| 668 request_info.url = GURL("https://www.google.com"); | 668 request_info.url = GURL("https://www.google.com"); |
| 669 request_info.load_flags = 0; | 669 request_info.load_flags = 0; |
| 670 request_info.privacy_mode = kPrivacyModeDisabled; | 670 request_info.privacy_mode = PRIVACY_MODE_DISABLED; |
| 671 | 671 |
| 672 SSLConfig ssl_config; | 672 SSLConfig ssl_config; |
| 673 StreamRequestWaiter waiter; | 673 StreamRequestWaiter waiter; |
| 674 scoped_ptr<HttpStreamRequest> request( | 674 scoped_ptr<HttpStreamRequest> request( |
| 675 session->http_stream_factory()->RequestStream( | 675 session->http_stream_factory()->RequestStream( |
| 676 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, | 676 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, |
| 677 &waiter, BoundNetLog())); | 677 &waiter, BoundNetLog())); |
| 678 waiter.WaitForStream(); | 678 waiter.WaitForStream(); |
| 679 | 679 |
| 680 // The stream shouldn't come from spdy as we are using different privacy mode | 680 // The stream shouldn't come from spdy as we are using different privacy mode |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 SpdySessionDependencies::SpdyCreateSession(&session_deps)); | 713 SpdySessionDependencies::SpdyCreateSession(&session_deps)); |
| 714 SSLClientSocketPool* ssl_pool = session->GetSSLSocketPool( | 714 SSLClientSocketPool* ssl_pool = session->GetSSLSocketPool( |
| 715 HttpNetworkSession::NORMAL_SOCKET_POOL); | 715 HttpNetworkSession::NORMAL_SOCKET_POOL); |
| 716 | 716 |
| 717 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 0); | 717 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 0); |
| 718 | 718 |
| 719 HttpRequestInfo request_info; | 719 HttpRequestInfo request_info; |
| 720 request_info.method = "GET"; | 720 request_info.method = "GET"; |
| 721 request_info.url = GURL("https://www.google.com"); | 721 request_info.url = GURL("https://www.google.com"); |
| 722 request_info.load_flags = 0; | 722 request_info.load_flags = 0; |
| 723 request_info.privacy_mode = kPrivacyModeDisabled; | 723 request_info.privacy_mode = PRIVACY_MODE_DISABLED; |
| 724 | 724 |
| 725 SSLConfig ssl_config; | 725 SSLConfig ssl_config; |
| 726 StreamRequestWaiter waiter; | 726 StreamRequestWaiter waiter; |
| 727 | 727 |
| 728 scoped_ptr<HttpStreamRequest> request1( | 728 scoped_ptr<HttpStreamRequest> request1( |
| 729 session->http_stream_factory()->RequestStream( | 729 session->http_stream_factory()->RequestStream( |
| 730 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, | 730 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, |
| 731 &waiter, BoundNetLog())); | 731 &waiter, BoundNetLog())); |
| 732 waiter.WaitForStream(); | 732 waiter.WaitForStream(); |
| 733 | 733 |
| 734 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); | 734 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); |
| 735 | 735 |
| 736 scoped_ptr<HttpStreamRequest> request2( | 736 scoped_ptr<HttpStreamRequest> request2( |
| 737 session->http_stream_factory()->RequestStream( | 737 session->http_stream_factory()->RequestStream( |
| 738 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, | 738 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, |
| 739 &waiter, BoundNetLog())); | 739 &waiter, BoundNetLog())); |
| 740 waiter.WaitForStream(); | 740 waiter.WaitForStream(); |
| 741 | 741 |
| 742 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); | 742 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 1); |
| 743 | 743 |
| 744 request_info.privacy_mode = kPrivacyModeEnabled; | 744 request_info.privacy_mode = PRIVACY_MODE_ENABLED; |
| 745 scoped_ptr<HttpStreamRequest> request3( | 745 scoped_ptr<HttpStreamRequest> request3( |
| 746 session->http_stream_factory()->RequestStream( | 746 session->http_stream_factory()->RequestStream( |
| 747 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, | 747 request_info, DEFAULT_PRIORITY, ssl_config, ssl_config, |
| 748 &waiter, BoundNetLog())); | 748 &waiter, BoundNetLog())); |
| 749 waiter.WaitForStream(); | 749 waiter.WaitForStream(); |
| 750 | 750 |
| 751 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 2); | 751 EXPECT_EQ(GetSocketPoolGroupCount(ssl_pool), 2); |
| 752 } | 752 } |
| 753 | 753 |
| 754 TEST_P(HttpStreamFactoryTest, GetLoadState) { | 754 TEST_P(HttpStreamFactoryTest, GetLoadState) { |
| (...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1335 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1335 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
| 1336 | 1336 |
| 1337 // Make sure there is no orphaned job. it is already canceled. | 1337 // Make sure there is no orphaned job. it is already canceled. |
| 1338 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1338 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
| 1339 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1339 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 } // namespace | 1342 } // namespace |
| 1343 | 1343 |
| 1344 } // namespace net | 1344 } // namespace net |
| OLD | NEW |