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 <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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 for (int num_streams = 1; num_streams < 3; ++num_streams) { | 801 for (int num_streams = 1; num_streams < 3; ++num_streams) { |
802 GURL url = GURL("https://www.google.com"); | 802 GURL url = GURL("https://www.google.com"); |
803 | 803 |
804 // Set up QUIC as alternative_service. | 804 // Set up QUIC as alternative_service. |
805 HttpServerPropertiesImpl http_server_properties; | 805 HttpServerPropertiesImpl http_server_properties; |
806 const AlternativeService alternative_service(QUIC, url.host().c_str(), | 806 const AlternativeService alternative_service(QUIC, url.host().c_str(), |
807 url.IntPort()); | 807 url.IntPort()); |
808 AlternativeServiceInfoVector alternative_service_info_vector; | 808 AlternativeServiceInfoVector alternative_service_info_vector; |
809 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 809 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
810 alternative_service_info_vector.push_back( | 810 alternative_service_info_vector.push_back( |
811 AlternativeServiceInfo(alternative_service, expiration)); | 811 AlternativeServiceInfo(alternative_service, 1.0, expiration)); |
812 HostPortPair host_port_pair(alternative_service.host_port_pair()); | 812 HostPortPair host_port_pair(alternative_service.host_port_pair()); |
813 http_server_properties.SetAlternativeServices( | 813 http_server_properties.SetAlternativeServices( |
814 host_port_pair, alternative_service_info_vector); | 814 host_port_pair, alternative_service_info_vector); |
815 | 815 |
816 SpdySessionDependencies session_deps( | 816 SpdySessionDependencies session_deps( |
817 GetParam(), ProxyService::CreateFixed("http_proxy")); | 817 GetParam(), ProxyService::CreateFixed("http_proxy")); |
818 | 818 |
819 // Setup params to disable preconnect, but QUIC doesn't 0RTT. | 819 // Setup params to disable preconnect, but QUIC doesn't 0RTT. |
820 HttpNetworkSession::Params params = | 820 HttpNetworkSession::Params params = |
821 SpdySessionDependencies::CreateSessionParams(&session_deps); | 821 SpdySessionDependencies::CreateSessionParams(&session_deps); |
(...skipping 23 matching lines...) Expand all Loading... |
845 TEST_P(HttpStreamFactoryTest, QuicDisablePreConnectIfZeroRtt) { | 845 TEST_P(HttpStreamFactoryTest, QuicDisablePreConnectIfZeroRtt) { |
846 for (int num_streams = 1; num_streams < 3; ++num_streams) { | 846 for (int num_streams = 1; num_streams < 3; ++num_streams) { |
847 GURL url = GURL("https://www.google.com"); | 847 GURL url = GURL("https://www.google.com"); |
848 | 848 |
849 // Set up QUIC as alternative_service. | 849 // Set up QUIC as alternative_service. |
850 HttpServerPropertiesImpl http_server_properties; | 850 HttpServerPropertiesImpl http_server_properties; |
851 const AlternativeService alternative_service(QUIC, "www.google.com", 443); | 851 const AlternativeService alternative_service(QUIC, "www.google.com", 443); |
852 AlternativeServiceInfoVector alternative_service_info_vector; | 852 AlternativeServiceInfoVector alternative_service_info_vector; |
853 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 853 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
854 alternative_service_info_vector.push_back( | 854 alternative_service_info_vector.push_back( |
855 AlternativeServiceInfo(alternative_service, expiration)); | 855 AlternativeServiceInfo(alternative_service, 1.0, expiration)); |
856 HostPortPair host_port_pair(alternative_service.host_port_pair()); | 856 HostPortPair host_port_pair(alternative_service.host_port_pair()); |
857 http_server_properties.SetAlternativeServices( | 857 http_server_properties.SetAlternativeServices( |
858 host_port_pair, alternative_service_info_vector); | 858 host_port_pair, alternative_service_info_vector); |
859 | 859 |
860 SpdySessionDependencies session_deps(GetParam()); | 860 SpdySessionDependencies session_deps(GetParam()); |
861 | 861 |
862 // Setup params to disable preconnect, but QUIC does 0RTT. | 862 // Setup params to disable preconnect, but QUIC does 0RTT. |
863 HttpNetworkSession::Params params = | 863 HttpNetworkSession::Params params = |
864 SpdySessionDependencies::CreateSessionParams(&session_deps); | 864 SpdySessionDependencies::CreateSessionParams(&session_deps); |
865 params.enable_quic = true; | 865 params.enable_quic = true; |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 | 1647 |
1648 // Now request a stream. | 1648 // Now request a stream. |
1649 HttpRequestInfo request_info; | 1649 HttpRequestInfo request_info; |
1650 request_info.method = "GET"; | 1650 request_info.method = "GET"; |
1651 request_info.url = GURL("ws://www.google.com:8888"); | 1651 request_info.url = GURL("ws://www.google.com:8888"); |
1652 request_info.load_flags = 0; | 1652 request_info.load_flags = 0; |
1653 | 1653 |
1654 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); | 1654 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); |
1655 session->http_server_properties()->SetAlternativeService( | 1655 session->http_server_properties()->SetAlternativeService( |
1656 HostPortPair("www.google.com", 8888), | 1656 HostPortPair("www.google.com", 8888), |
1657 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration); | 1657 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), 1.0, expiration); |
1658 | 1658 |
1659 SSLConfig ssl_config; | 1659 SSLConfig ssl_config; |
1660 StreamRequestWaiter waiter; | 1660 StreamRequestWaiter waiter; |
1661 WebSocketStreamCreateHelper create_helper; | 1661 WebSocketStreamCreateHelper create_helper; |
1662 scoped_ptr<HttpStreamRequest> request( | 1662 scoped_ptr<HttpStreamRequest> request( |
1663 session->http_stream_factory_for_websocket() | 1663 session->http_stream_factory_for_websocket() |
1664 ->RequestWebSocketHandshakeStream(request_info, | 1664 ->RequestWebSocketHandshakeStream(request_info, |
1665 DEFAULT_PRIORITY, | 1665 DEFAULT_PRIORITY, |
1666 ssl_config, | 1666 ssl_config, |
1667 ssl_config, | 1667 ssl_config, |
(...skipping 21 matching lines...) Expand all Loading... |
1689 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); | 1689 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); |
1690 | 1690 |
1691 // Make sure there is no orphaned job. it is already canceled. | 1691 // Make sure there is no orphaned job. it is already canceled. |
1692 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( | 1692 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( |
1693 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); | 1693 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); |
1694 } | 1694 } |
1695 | 1695 |
1696 } // namespace | 1696 } // namespace |
1697 | 1697 |
1698 } // namespace net | 1698 } // namespace net |
OLD | NEW |