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

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

Issue 1878143005: SHP 4: Change AlternativeServiceMap to use SchemeHostPort as the key. No change to Pref data. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SHP_3
Patch Set: fix a comment 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
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 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1217 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1)); 1217 spdy_util_.ConstructSpdyGetSynReply(kExtraResponseHeaders, 1, 1));
1218 scoped_ptr<SpdySerializedFrame> body_frame( 1218 scoped_ptr<SpdySerializedFrame> body_frame(
1219 spdy_util_.ConstructSpdyBodyFrame(1, true)); 1219 spdy_util_.ConstructSpdyBodyFrame(1, true));
1220 1220
1221 MockRead reads[] = { 1221 MockRead reads[] = {
1222 CreateMockRead(*resp, 1), CreateMockRead(*body_frame, 2), 1222 CreateMockRead(*resp, 1), CreateMockRead(*body_frame, 2),
1223 MockRead(SYNCHRONOUS, 0, 3), 1223 MockRead(SYNCHRONOUS, 0, 3),
1224 }; 1224 };
1225 1225
1226 HostPortPair host_port_pair("www.example.org", 443); 1226 HostPortPair host_port_pair("www.example.org", 443);
1227 url::SchemeHostPort server("https", "www.example.org", 443);
1227 SpdySessionKey key(host_port_pair, ProxyServer::Direct(), 1228 SpdySessionKey key(host_port_pair, ProxyServer::Direct(),
1228 PRIVACY_MODE_DISABLED); 1229 PRIVACY_MODE_DISABLED);
1229 session_deps_.parse_alternative_services = true; 1230 session_deps_.parse_alternative_services = true;
1230 // Enable QUIC so that the alternative service header can be added to 1231 // Enable QUIC so that the alternative service header can be added to
1231 // HttpServerProperties. 1232 // HttpServerProperties.
1232 session_deps_.enable_quic = true; 1233 session_deps_.enable_quic = true;
1233 InitSession(reads, arraysize(reads), writes, arraysize(writes), key); 1234 InitSession(reads, arraysize(reads), writes, arraysize(writes), key);
1234 1235
1235 scoped_ptr<BidirectionalStreamRequestInfo> request_info( 1236 scoped_ptr<BidirectionalStreamRequestInfo> request_info(
1236 new BidirectionalStreamRequestInfo); 1237 new BidirectionalStreamRequestInfo);
(...skipping 14 matching lines...) Expand all
1251 EXPECT_EQ(alt_svc_header_value, response_headers.find("alt-svc")->second); 1252 EXPECT_EQ(alt_svc_header_value, response_headers.find("alt-svc")->second);
1252 EXPECT_EQ(0, delegate->on_data_sent_count()); 1253 EXPECT_EQ(0, delegate->on_data_sent_count());
1253 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol()); 1254 EXPECT_EQ(kProtoHTTP2, delegate->GetProtocol());
1254 EXPECT_EQ(kUploadData, delegate->data_received()); 1255 EXPECT_EQ(kUploadData, delegate->data_received());
1255 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)), 1256 EXPECT_EQ(CountWriteBytes(writes, arraysize(writes)),
1256 delegate->GetTotalSentBytes()); 1257 delegate->GetTotalSentBytes());
1257 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)), 1258 EXPECT_EQ(CountReadBytes(reads, arraysize(reads)),
1258 delegate->GetTotalReceivedBytes()); 1259 delegate->GetTotalReceivedBytes());
1259 1260
1260 AlternativeServiceVector alternative_service_vector = 1261 AlternativeServiceVector alternative_service_vector =
1261 http_session_->http_server_properties()->GetAlternativeServices( 1262 http_session_->http_server_properties()->GetAlternativeServices(server);
1262 host_port_pair);
1263 ASSERT_EQ(1u, alternative_service_vector.size()); 1263 ASSERT_EQ(1u, alternative_service_vector.size());
1264 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3), 1264 EXPECT_EQ(AlternateProtocolFromNextProto(kProtoQUIC1SPDY3),
1265 alternative_service_vector[0].protocol); 1265 alternative_service_vector[0].protocol);
1266 EXPECT_EQ("www.example.org", alternative_service_vector[0].host); 1266 EXPECT_EQ("www.example.org", alternative_service_vector[0].host);
1267 EXPECT_EQ(443, alternative_service_vector[0].port); 1267 EXPECT_EQ(443, alternative_service_vector[0].port);
1268 } 1268 }
1269 1269
1270 } // namespace net 1270 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698