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

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

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 869
870 // Set up QUIC as alternative_service. 870 // Set up QUIC as alternative_service.
871 HttpServerPropertiesImpl http_server_properties; 871 HttpServerPropertiesImpl http_server_properties;
872 const AlternativeService alternative_service(QUIC, url.host().c_str(), 872 const AlternativeService alternative_service(QUIC, url.host().c_str(),
873 url.IntPort()); 873 url.IntPort());
874 AlternativeServiceInfoVector alternative_service_info_vector; 874 AlternativeServiceInfoVector alternative_service_info_vector;
875 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 875 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
876 alternative_service_info_vector.push_back( 876 alternative_service_info_vector.push_back(
877 AlternativeServiceInfo(alternative_service, expiration)); 877 AlternativeServiceInfo(alternative_service, expiration));
878 HostPortPair host_port_pair(alternative_service.host_port_pair()); 878 HostPortPair host_port_pair(alternative_service.host_port_pair());
879 url::SchemeHostPort scheme_origin_pair("https", host_port_pair.host(),
880 host_port_pair.port());
881
879 http_server_properties.SetAlternativeServices( 882 http_server_properties.SetAlternativeServices(
880 host_port_pair, alternative_service_info_vector); 883 scheme_origin_pair, alternative_service_info_vector);
881 884
882 SpdySessionDependencies session_deps( 885 SpdySessionDependencies session_deps(
883 GetParam(), ProxyService::CreateFixed("http_proxy")); 886 GetParam(), ProxyService::CreateFixed("http_proxy"));
884 887
885 // Setup params to disable preconnect, but QUIC doesn't 0RTT. 888 // Setup params to disable preconnect, but QUIC doesn't 0RTT.
886 HttpNetworkSession::Params params = 889 HttpNetworkSession::Params params =
887 SpdySessionDependencies::CreateSessionParams(&session_deps); 890 SpdySessionDependencies::CreateSessionParams(&session_deps);
888 params.enable_quic = true; 891 params.enable_quic = true;
889 params.quic_disable_preconnect_if_0rtt = true; 892 params.quic_disable_preconnect_if_0rtt = true;
890 params.http_server_properties = http_server_properties.GetWeakPtr(); 893 params.http_server_properties = http_server_properties.GetWeakPtr();
(...skipping 22 matching lines...) Expand all
913 GURL url = GURL("https://www.google.com"); 916 GURL url = GURL("https://www.google.com");
914 917
915 // Set up QUIC as alternative_service. 918 // Set up QUIC as alternative_service.
916 HttpServerPropertiesImpl http_server_properties; 919 HttpServerPropertiesImpl http_server_properties;
917 const AlternativeService alternative_service(QUIC, "www.google.com", 443); 920 const AlternativeService alternative_service(QUIC, "www.google.com", 443);
918 AlternativeServiceInfoVector alternative_service_info_vector; 921 AlternativeServiceInfoVector alternative_service_info_vector;
919 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 922 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
920 alternative_service_info_vector.push_back( 923 alternative_service_info_vector.push_back(
921 AlternativeServiceInfo(alternative_service, expiration)); 924 AlternativeServiceInfo(alternative_service, expiration));
922 HostPortPair host_port_pair(alternative_service.host_port_pair()); 925 HostPortPair host_port_pair(alternative_service.host_port_pair());
926 url::SchemeHostPort scheme_origin_pair("https", host_port_pair.host(),
927 host_port_pair.port());
928
923 http_server_properties.SetAlternativeServices( 929 http_server_properties.SetAlternativeServices(
924 host_port_pair, alternative_service_info_vector); 930 scheme_origin_pair, alternative_service_info_vector);
925 931
926 SpdySessionDependencies session_deps(GetParam()); 932 SpdySessionDependencies session_deps(GetParam());
927 933
928 // Setup params to disable preconnect, but QUIC does 0RTT. 934 // Setup params to disable preconnect, but QUIC does 0RTT.
929 HttpNetworkSession::Params params = 935 HttpNetworkSession::Params params =
930 SpdySessionDependencies::CreateSessionParams(&session_deps); 936 SpdySessionDependencies::CreateSessionParams(&session_deps);
931 params.enable_quic = true; 937 params.enable_quic = true;
932 params.quic_disable_preconnect_if_0rtt = true; 938 params.quic_disable_preconnect_if_0rtt = true;
933 params.http_server_properties = http_server_properties.GetWeakPtr(); 939 params.http_server_properties = http_server_properties.GetWeakPtr();
934 940
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 session_->quic_stream_factory()->set_require_confirmation(false); 1557 session_->quic_stream_factory()->set_require_confirmation(false);
1552 } 1558 }
1553 1559
1554 void AddQuicAlternativeService() { 1560 void AddQuicAlternativeService() {
1555 const AlternativeService alternative_service(QUIC, "www.example.org", 443); 1561 const AlternativeService alternative_service(QUIC, "www.example.org", 443);
1556 AlternativeServiceInfoVector alternative_service_info_vector; 1562 AlternativeServiceInfoVector alternative_service_info_vector;
1557 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 1563 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
1558 alternative_service_info_vector.push_back( 1564 alternative_service_info_vector.push_back(
1559 AlternativeServiceInfo(alternative_service, expiration)); 1565 AlternativeServiceInfo(alternative_service, expiration));
1560 HostPortPair host_port_pair(alternative_service.host_port_pair()); 1566 HostPortPair host_port_pair(alternative_service.host_port_pair());
1567 url::SchemeHostPort scheme_origin_pair("https", host_port_pair.host(),
1568 host_port_pair.port());
1561 http_server_properties_.SetAlternativeServices( 1569 http_server_properties_.SetAlternativeServices(
1562 host_port_pair, alternative_service_info_vector); 1570 scheme_origin_pair, alternative_service_info_vector);
1563 }; 1571 };
1564 1572
1565 test::QuicTestPacketMaker& packet_maker() { return packet_maker_; } 1573 test::QuicTestPacketMaker& packet_maker() { return packet_maker_; }
1566 1574
1567 MockClientSocketFactory& socket_factory() { return socket_factory_; } 1575 MockClientSocketFactory& socket_factory() { return socket_factory_; }
1568 1576
1569 HttpNetworkSession* session() { return session_.get(); } 1577 HttpNetworkSession* session() { return session_.get(); }
1570 1578
1571 private: 1579 private:
1572 MockClock* clock_; // Owned by QuicStreamFactory 1580 MockClock* clock_; // Owned by QuicStreamFactory
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1998 scoped_ptr<HttpNetworkSession> session( 2006 scoped_ptr<HttpNetworkSession> session(
1999 SpdySessionDependencies::SpdyCreateSession(&session_deps)); 2007 SpdySessionDependencies::SpdyCreateSession(&session_deps));
2000 2008
2001 // Now request a stream. 2009 // Now request a stream.
2002 HttpRequestInfo request_info; 2010 HttpRequestInfo request_info;
2003 request_info.method = "GET"; 2011 request_info.method = "GET";
2004 request_info.url = GURL("ws://www.google.com:8888"); 2012 request_info.url = GURL("ws://www.google.com:8888");
2005 request_info.load_flags = 0; 2013 request_info.load_flags = 0;
2006 2014
2007 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 2015 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
2016 HostPortPair host_port_pair("www.google.com", 8888);
2008 session->http_server_properties()->SetAlternativeService( 2017 session->http_server_properties()->SetAlternativeService(
2009 HostPortPair("www.google.com", 8888), 2018 url::SchemeHostPort(request_info.url.scheme(), host_port_pair.host(),
2019 host_port_pair.port()),
2010 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration); 2020 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration);
2011 2021
2012 SSLConfig ssl_config; 2022 SSLConfig ssl_config;
2013 StreamRequestWaiter waiter; 2023 StreamRequestWaiter waiter;
2014 WebSocketStreamCreateHelper create_helper; 2024 WebSocketStreamCreateHelper create_helper;
2015 scoped_ptr<HttpStreamRequest> request( 2025 scoped_ptr<HttpStreamRequest> request(
2016 session->http_stream_factory_for_websocket() 2026 session->http_stream_factory_for_websocket()
2017 ->RequestWebSocketHandshakeStream(request_info, 2027 ->RequestWebSocketHandshakeStream(request_info,
2018 DEFAULT_PRIORITY, 2028 DEFAULT_PRIORITY,
2019 ssl_config, 2029 ssl_config,
(...skipping 22 matching lines...) Expand all
2042 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 2052 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
2043 2053
2044 // Make sure there is no orphaned job. it is already canceled. 2054 // Make sure there is no orphaned job. it is already canceled.
2045 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( 2055 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>(
2046 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); 2056 session->http_stream_factory_for_websocket())->num_orphaned_jobs());
2047 } 2057 }
2048 2058
2049 } // namespace 2059 } // namespace
2050 2060
2051 } // namespace net 2061 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl_job.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698