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

Side by Side Diff: net/quic/quic_network_transaction_unittest.cc

Issue 1216703002: Implement multiple alternative services per origin. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 5 years, 5 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.cc ('k') | net/quic/quic_stream_factory.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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 MockCryptoClientStream::HandshakeMode handshake_mode) { 324 MockCryptoClientStream::HandshakeMode handshake_mode) {
325 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); 325 crypto_client_stream_factory_.set_handshake_mode(handshake_mode);
326 HostPortPair host_port_pair = HostPortPair::FromURL(request_.url); 326 HostPortPair host_port_pair = HostPortPair::FromURL(request_.url);
327 AlternativeService alternative_service(QUIC, host_port_pair.host(), 80); 327 AlternativeService alternative_service(QUIC, host_port_pair.host(), 80);
328 http_server_properties_.SetAlternativeService(host_port_pair, 328 http_server_properties_.SetAlternativeService(host_port_pair,
329 alternative_service, 1.0); 329 alternative_service, 1.0);
330 } 330 }
331 331
332 void ExpectBrokenAlternateProtocolMapping() { 332 void ExpectBrokenAlternateProtocolMapping() {
333 const HostPortPair origin = HostPortPair::FromURL(request_.url); 333 const HostPortPair origin = HostPortPair::FromURL(request_.url);
334 const AlternativeService alternative_service = 334 const AlternativeServiceVector alternative_service_vector =
335 http_server_properties_.GetAlternativeService(origin); 335 http_server_properties_.GetAlternativeServices(origin);
336 EXPECT_NE(UNINITIALIZED_ALTERNATE_PROTOCOL, alternative_service.protocol); 336 EXPECT_EQ(1u, alternative_service_vector.size());
337 EXPECT_TRUE(http_server_properties_.IsAlternativeServiceBroken( 337 EXPECT_TRUE(http_server_properties_.IsAlternativeServiceBroken(
338 alternative_service)); 338 alternative_service_vector[0]));
339 } 339 }
340 340
341 void ExpectQuicAlternateProtocolMapping() { 341 void ExpectQuicAlternateProtocolMapping() {
342 const AlternativeService alternative_service = 342 const HostPortPair origin = HostPortPair::FromURL(request_.url);
343 http_server_properties_.GetAlternativeService( 343 const AlternativeServiceVector alternative_service_vector =
344 HostPortPair::FromURL(request_.url)); 344 http_server_properties_.GetAlternativeServices(origin);
345 EXPECT_EQ(QUIC, alternative_service.protocol); 345 EXPECT_EQ(1u, alternative_service_vector.size());
346 EXPECT_EQ(QUIC, alternative_service_vector[0].protocol);
346 } 347 }
347 348
348 void AddHangingNonAlternateProtocolSocketData() { 349 void AddHangingNonAlternateProtocolSocketData() {
349 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING); 350 MockConnect hanging_connect(SYNCHRONOUS, ERR_IO_PENDING);
350 hanging_data_.set_connect_data(hanging_connect); 351 hanging_data_.set_connect_data(hanging_connect);
351 socket_factory_.AddSocketDataProvider(&hanging_data_); 352 socket_factory_.AddSocketDataProvider(&hanging_data_);
352 } 353 }
353 354
354 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession. 355 MockClock* clock_; // Owned by QuicStreamFactory after CreateSession.
355 QuicTestPacketMaker maker_; 356 QuicTestPacketMaker maker_;
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 1383
1383 request_.url = GURL("https://www.example.org:443"); 1384 request_.url = GURL("https://www.example.org:443");
1384 AddHangingNonAlternateProtocolSocketData(); 1385 AddHangingNonAlternateProtocolSocketData();
1385 CreateSessionWithNextProtos(); 1386 CreateSessionWithNextProtos();
1386 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); 1387 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE);
1387 SendRequestAndExpectQuicResponse("hello!"); 1388 SendRequestAndExpectQuicResponse("hello!");
1388 } 1389 }
1389 1390
1390 } // namespace test 1391 } // namespace test
1391 } // namespace net 1392 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | net/quic/quic_stream_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698