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

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

Issue 1904483004: Change SupportsSpdy dict, SpdySettingsMap, ServerNetworkStatsMap, AlternativeServiceMap and disk da… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile after sync code, introduced by commit 388755 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 server("https", host_port_pair.host(),
880 host_port_pair.port());
879 http_server_properties.SetAlternativeServices( 881 http_server_properties.SetAlternativeServices(
880 host_port_pair, alternative_service_info_vector); 882 server, alternative_service_info_vector);
881 883
882 SpdySessionDependencies session_deps( 884 SpdySessionDependencies session_deps(
883 GetParam(), ProxyService::CreateFixed("http_proxy")); 885 GetParam(), ProxyService::CreateFixed("http_proxy"));
884 886
885 // Setup params to disable preconnect, but QUIC doesn't 0RTT. 887 // Setup params to disable preconnect, but QUIC doesn't 0RTT.
886 HttpNetworkSession::Params params = 888 HttpNetworkSession::Params params =
887 SpdySessionDependencies::CreateSessionParams(&session_deps); 889 SpdySessionDependencies::CreateSessionParams(&session_deps);
888 params.enable_quic = true; 890 params.enable_quic = true;
889 params.quic_disable_preconnect_if_0rtt = true; 891 params.quic_disable_preconnect_if_0rtt = true;
890 params.http_server_properties = http_server_properties.GetWeakPtr(); 892 params.http_server_properties = http_server_properties.GetWeakPtr();
(...skipping 22 matching lines...) Expand all
913 GURL url = GURL("https://www.google.com"); 915 GURL url = GURL("https://www.google.com");
914 916
915 // Set up QUIC as alternative_service. 917 // Set up QUIC as alternative_service.
916 HttpServerPropertiesImpl http_server_properties; 918 HttpServerPropertiesImpl http_server_properties;
917 const AlternativeService alternative_service(QUIC, "www.google.com", 443); 919 const AlternativeService alternative_service(QUIC, "www.google.com", 443);
918 AlternativeServiceInfoVector alternative_service_info_vector; 920 AlternativeServiceInfoVector alternative_service_info_vector;
919 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 921 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
920 alternative_service_info_vector.push_back( 922 alternative_service_info_vector.push_back(
921 AlternativeServiceInfo(alternative_service, expiration)); 923 AlternativeServiceInfo(alternative_service, expiration));
922 HostPortPair host_port_pair(alternative_service.host_port_pair()); 924 HostPortPair host_port_pair(alternative_service.host_port_pair());
925 url::SchemeHostPort server("https", host_port_pair.host(),
926 host_port_pair.port());
923 http_server_properties.SetAlternativeServices( 927 http_server_properties.SetAlternativeServices(
924 host_port_pair, alternative_service_info_vector); 928 server, alternative_service_info_vector);
925 929
926 SpdySessionDependencies session_deps(GetParam()); 930 SpdySessionDependencies session_deps(GetParam());
927 931
928 // Setup params to disable preconnect, but QUIC does 0RTT. 932 // Setup params to disable preconnect, but QUIC does 0RTT.
929 HttpNetworkSession::Params params = 933 HttpNetworkSession::Params params =
930 SpdySessionDependencies::CreateSessionParams(&session_deps); 934 SpdySessionDependencies::CreateSessionParams(&session_deps);
931 params.enable_quic = true; 935 params.enable_quic = true;
932 params.quic_disable_preconnect_if_0rtt = true; 936 params.quic_disable_preconnect_if_0rtt = true;
933 params.http_server_properties = http_server_properties.GetWeakPtr(); 937 params.http_server_properties = http_server_properties.GetWeakPtr();
934 938
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1523 session_.reset(new HttpNetworkSession(params_)); 1527 session_.reset(new HttpNetworkSession(params_));
1524 session_->quic_stream_factory()->set_require_confirmation(false); 1528 session_->quic_stream_factory()->set_require_confirmation(false);
1525 } 1529 }
1526 1530
1527 void AddQuicAlternativeService() { 1531 void AddQuicAlternativeService() {
1528 const AlternativeService alternative_service(QUIC, "www.example.org", 443); 1532 const AlternativeService alternative_service(QUIC, "www.example.org", 443);
1529 AlternativeServiceInfoVector alternative_service_info_vector; 1533 AlternativeServiceInfoVector alternative_service_info_vector;
1530 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 1534 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
1531 alternative_service_info_vector.push_back( 1535 alternative_service_info_vector.push_back(
1532 AlternativeServiceInfo(alternative_service, expiration)); 1536 AlternativeServiceInfo(alternative_service, expiration));
1533 HostPortPair host_port_pair(alternative_service.host_port_pair()); 1537 url::SchemeHostPort server("https", "www.example.org", 443);
1534 http_server_properties_.SetAlternativeServices( 1538 http_server_properties_.SetAlternativeServices(
1535 host_port_pair, alternative_service_info_vector); 1539 server, alternative_service_info_vector);
1536 }; 1540 };
1537 1541
1538 test::QuicTestPacketMaker& packet_maker() { return packet_maker_; } 1542 test::QuicTestPacketMaker& packet_maker() { return packet_maker_; }
1539 1543
1540 MockClientSocketFactory& socket_factory() { return socket_factory_; } 1544 MockClientSocketFactory& socket_factory() { return socket_factory_; }
1541 1545
1542 HttpNetworkSession* session() { return session_.get(); } 1546 HttpNetworkSession* session() { return session_.get(); }
1543 1547
1544 private: 1548 private:
1545 MockClock* clock_; // Owned by QuicStreamFactory 1549 MockClock* clock_; // Owned by QuicStreamFactory
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 std::unique_ptr<HttpNetworkSession> session( 1963 std::unique_ptr<HttpNetworkSession> session(
1960 SpdySessionDependencies::SpdyCreateSession(&session_deps)); 1964 SpdySessionDependencies::SpdyCreateSession(&session_deps));
1961 1965
1962 // Now request a stream. 1966 // Now request a stream.
1963 HttpRequestInfo request_info; 1967 HttpRequestInfo request_info;
1964 request_info.method = "GET"; 1968 request_info.method = "GET";
1965 request_info.url = GURL("ws://www.google.com:8888"); 1969 request_info.url = GURL("ws://www.google.com:8888");
1966 request_info.load_flags = 0; 1970 request_info.load_flags = 0;
1967 1971
1968 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 1972 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
1973 HostPortPair host_port_pair("www.google.com", 8888);
1974
1969 session->http_server_properties()->SetAlternativeService( 1975 session->http_server_properties()->SetAlternativeService(
1970 HostPortPair("www.google.com", 8888), 1976 url::SchemeHostPort(request_info.url.scheme(), host_port_pair.host(),
1977 host_port_pair.port()),
1971 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration); 1978 AlternativeService(NPN_HTTP_2, "www.google.com", 9999), expiration);
1972 1979
1973 SSLConfig ssl_config; 1980 SSLConfig ssl_config;
1974 StreamRequestWaiter waiter; 1981 StreamRequestWaiter waiter;
1975 WebSocketStreamCreateHelper create_helper; 1982 WebSocketStreamCreateHelper create_helper;
1976 std::unique_ptr<HttpStreamRequest> request( 1983 std::unique_ptr<HttpStreamRequest> request(
1977 session->http_stream_factory_for_websocket() 1984 session->http_stream_factory_for_websocket()
1978 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY, 1985 ->RequestWebSocketHandshakeStream(request_info, DEFAULT_PRIORITY,
1979 ssl_config, ssl_config, &waiter, 1986 ssl_config, ssl_config, &waiter,
1980 &create_helper, BoundNetLog())); 1987 &create_helper, BoundNetLog()));
(...skipping 18 matching lines...) Expand all
1999 EXPECT_TRUE(waiter.used_proxy_info().is_direct()); 2006 EXPECT_TRUE(waiter.used_proxy_info().is_direct());
2000 2007
2001 // Make sure there is no orphaned job. it is already canceled. 2008 // Make sure there is no orphaned job. it is already canceled.
2002 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>( 2009 ASSERT_EQ(0u, static_cast<HttpStreamFactoryImpl*>(
2003 session->http_stream_factory_for_websocket())->num_orphaned_jobs()); 2010 session->http_stream_factory_for_websocket())->num_orphaned_jobs());
2004 } 2011 }
2005 2012
2006 } // namespace 2013 } // namespace
2007 2014
2008 } // namespace net 2015 } // 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