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

Side by Side Diff: net/http/bidirectional_stream_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/bidirectional_stream.cc ('k') | net/http/http_network_transaction.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/bidirectional_stream.h" 5 #include "net/http/bidirectional_stream.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 scoped_ptr<SpdyFrame> resp( 1213 scoped_ptr<SpdyFrame> resp(
1214 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); 1214 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1));
1215 scoped_ptr<SpdyFrame> body_frame(spdy_util_.ConstructSpdyBodyFrame(1, true)); 1215 scoped_ptr<SpdyFrame> body_frame(spdy_util_.ConstructSpdyBodyFrame(1, true));
1216 1216
1217 MockRead reads[] = { 1217 MockRead reads[] = {
1218 CreateMockRead(*resp, 1), CreateMockRead(*body_frame, 2), 1218 CreateMockRead(*resp, 1), CreateMockRead(*body_frame, 2),
1219 MockRead(SYNCHRONOUS, 0, 3), 1219 MockRead(SYNCHRONOUS, 0, 3),
1220 }; 1220 };
1221 1221
1222 HostPortPair host_port_pair("www.example.org", 443); 1222 HostPortPair host_port_pair("www.example.org", 443);
1223 url::SchemeHostPort scheme_host_port("https", "www.example.org", 443);
1223 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), 1224 SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
1224 PRIVACY_MODE_DISABLED); 1225 PRIVACY_MODE_DISABLED);
1225 session_deps_.parse_alternative_services = true; 1226 session_deps_.parse_alternative_services = true;
1226 // Enable QUIC so that the alternative service header can be added to 1227 // Enable QUIC so that the alternative service header can be added to
1227 // HttpServerProperties. 1228 // HttpServerProperties.
1228 session_deps_.enable_quic = true; 1229 session_deps_.enable_quic = true;
1229 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); 1230 InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
1230 1231
1231 scoped_ptr<BidirectionalStreamRequestInfo> request_info( 1232 scoped_ptr<BidirectionalStreamRequestInfo> request_info(
1232 new BidirectionalStreamRequestInfo); 1233 new BidirectionalStreamRequestInfo);
(...skipping 15 matching lines...) Expand all
1248 EXPECT_EQ(0, delegate->on_data_sent_count()); 1249 EXPECT_EQ(0, delegate->on_data_sent_count());
1249 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); 1250 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol());
1250 EXPECT_EQ(kUploadData, delegate->data_received()); 1251 EXPECT_EQ(kUploadData, delegate->data_received());
1251 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), 1252 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)),
1252 delegate->GetTotalSentBytes()); 1253 delegate->GetTotalSentBytes());
1253 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), 1254 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)),
1254 delegate->GetTotalReceivedBytes()); 1255 delegate->GetTotalReceivedBytes());
1255 1256
1256 AlternativeServiceVector alternative_service_vector = 1257 AlternativeServiceVector alternative_service_vector =
1257 http_session_->http_server_properties()->GetAlternativeServices( 1258 http_session_->http_server_properties()->GetAlternativeServices(
1258 host_port_pair); 1259 scheme_host_port);
1259 ASSERT_EQ(1u, alternative_service_vector.size()); 1260 ASSERT_EQ(1u, alternative_service_vector.size());
1260 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3), 1261 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3),
1261 alternative_service_vector[0].protocol); 1262 alternative_service_vector[0].protocol);
1262 EXPECT_EQ("www.example.org", alternative_service_vector[0].host); 1263 EXPECT_EQ("www.example.org", alternative_service_vector[0].host);
1263 EXPECT_EQ(443, alternative_service_vector[0].port); 1264 EXPECT_EQ(443, alternative_service_vector[0].port);
1264 } 1265 }
1265 1266
1266 } // namespace net 1267 } // namespace net
OLDNEW
« no previous file with comments | « net/http/bidirectional_stream.cc ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698