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

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

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: Self review Created 3 years, 6 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 (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 <memory> 5 #include <memory>
6 #include <ostream> 6 #include <ostream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
17 #include "base/test/histogram_tester.h" 18 #include "base/test/histogram_tester.h"
18 #include "net/base/chunked_upload_data_stream.h" 19 #include "net/base/chunked_upload_data_stream.h"
19 #include "net/base/mock_network_change_notifier.h" 20 #include "net/base/mock_network_change_notifier.h"
20 #include "net/base/test_completion_callback.h" 21 #include "net/base/test_completion_callback.h"
21 #include "net/base/test_proxy_delegate.h" 22 #include "net/base/test_proxy_delegate.h"
22 #include "net/cert/ct_policy_enforcer.h" 23 #include "net/cert/ct_policy_enforcer.h"
23 #include "net/cert/mock_cert_verifier.h" 24 #include "net/cert/mock_cert_verifier.h"
24 #include "net/cert/multi_log_ct_verifier.h" 25 #include "net/cert/multi_log_ct_verifier.h"
25 #include "net/dns/mock_host_resolver.h" 26 #include "net/dns/mock_host_resolver.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 break; 120 break;
120 } 121 }
121 os << " }"; 122 os << " }";
122 return os; 123 return os;
123 } 124 }
124 125
125 QuicVersion version; 126 QuicVersion version;
126 DestinationType destination_type; 127 DestinationType destination_type;
127 }; 128 };
128 129
130 std::string GenerateQuicVersionsListForAltSvcHeader(
131 const QuicVersionVector& versions) {
132 std::string result = "";
133 for (size_t i = 0; i < versions.size(); ++i) {
134 if (i != 0)
135 result.append(",");
136 result.append(base::IntToString(versions[i]));
137 }
138 return result;
139 }
140
129 std::vector<PoolingTestParams> GetPoolingTestParams() { 141 std::vector<PoolingTestParams> GetPoolingTestParams() {
130 std::vector<PoolingTestParams> params; 142 std::vector<PoolingTestParams> params;
131 QuicVersionVector all_supported_versions = AllSupportedVersions(); 143 QuicVersionVector all_supported_versions = AllSupportedVersions();
132 for (const QuicVersion version : all_supported_versions) { 144 for (const QuicVersion version : all_supported_versions) {
133 params.push_back(PoolingTestParams{version, SAME_AS_FIRST}); 145 params.push_back(PoolingTestParams{version, SAME_AS_FIRST});
134 params.push_back(PoolingTestParams{version, SAME_AS_SECOND}); 146 params.push_back(PoolingTestParams{version, SAME_AS_SECOND});
135 params.push_back(PoolingTestParams{version, DIFFERENT}); 147 params.push_back(PoolingTestParams{version, DIFFERENT});
136 } 148 }
137 return params; 149 return params;
138 } 150 }
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 QuicStreamId stream_id, 503 QuicStreamId stream_id,
492 bool should_include_version, 504 bool should_include_version,
493 bool fin, 505 bool fin,
494 SpdyHeaderBlock headers, 506 SpdyHeaderBlock headers,
495 QuicStreamOffset* offset) { 507 QuicStreamOffset* offset) {
496 return server_maker_.MakeResponseHeadersPacketWithOffsetTracking( 508 return server_maker_.MakeResponseHeadersPacketWithOffsetTracking(
497 packet_number, stream_id, should_include_version, fin, 509 packet_number, stream_id, should_include_version, fin,
498 std::move(headers), offset); 510 std::move(headers), offset);
499 } 511 }
500 512
501 void CreateSession() { 513 void CreateSession(const QuicVersionVector& supported_versions) {
502 params_.enable_quic = true; 514 params_.enable_quic = true;
503 params_.quic_clock = &clock_; 515 params_.quic_clock = &clock_;
504 params_.quic_random = &random_generator_; 516 params_.quic_random = &random_generator_;
505 params_.client_socket_factory = &socket_factory_; 517 params_.client_socket_factory = &socket_factory_;
506 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_; 518 params_.quic_crypto_client_stream_factory = &crypto_client_stream_factory_;
507 params_.host_resolver = &host_resolver_; 519 params_.host_resolver = &host_resolver_;
508 params_.cert_verifier = &cert_verifier_; 520 params_.cert_verifier = &cert_verifier_;
509 params_.transport_security_state = &transport_security_state_; 521 params_.transport_security_state = &transport_security_state_;
510 params_.cert_transparency_verifier = cert_transparency_verifier_.get(); 522 params_.cert_transparency_verifier = cert_transparency_verifier_.get();
511 params_.ct_policy_enforcer = &ct_policy_enforcer_; 523 params_.ct_policy_enforcer = &ct_policy_enforcer_;
512 params_.socket_performance_watcher_factory = 524 params_.socket_performance_watcher_factory =
513 &test_socket_performance_watcher_factory_; 525 &test_socket_performance_watcher_factory_;
514 params_.proxy_service = proxy_service_.get(); 526 params_.proxy_service = proxy_service_.get();
515 params_.ssl_config_service = ssl_config_service_.get(); 527 params_.ssl_config_service = ssl_config_service_.get();
516 params_.http_auth_handler_factory = auth_handler_factory_.get(); 528 params_.http_auth_handler_factory = auth_handler_factory_.get();
517 params_.http_server_properties = &http_server_properties_; 529 params_.http_server_properties = &http_server_properties_;
518 params_.quic_supported_versions = SupportedVersions(version_); 530 params_.quic_supported_versions = supported_versions;
519 params_.net_log = net_log_.bound().net_log(); 531 params_.net_log = net_log_.bound().net_log();
520 532
521 session_.reset(new HttpNetworkSession(params_)); 533 session_.reset(new HttpNetworkSession(params_));
522 session_->quic_stream_factory()->set_require_confirmation(false); 534 session_->quic_stream_factory()->set_require_confirmation(false);
523 } 535 }
524 536
537 void CreateSession() { return CreateSession(SupportedVersions(version_)); }
538
525 void CheckWasQuicResponse(HttpNetworkTransaction* trans) { 539 void CheckWasQuicResponse(HttpNetworkTransaction* trans) {
526 const HttpResponseInfo* response = trans->GetResponseInfo(); 540 const HttpResponseInfo* response = trans->GetResponseInfo();
527 ASSERT_TRUE(response != nullptr); 541 ASSERT_TRUE(response != nullptr);
528 ASSERT_TRUE(response->headers.get() != nullptr); 542 ASSERT_TRUE(response->headers.get() != nullptr);
529 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine()); 543 EXPECT_EQ("HTTP/1.1 200 OK", response->headers->GetStatusLine());
530 EXPECT_TRUE(response->was_fetched_via_spdy); 544 EXPECT_TRUE(response->was_fetched_via_spdy);
531 EXPECT_TRUE(response->was_alpn_negotiated); 545 EXPECT_TRUE(response->was_alpn_negotiated);
532 EXPECT_EQ(QuicHttpStream::ConnectionInfoFromQuicVersion(version_), 546 EXPECT_EQ(QuicHttpStream::ConnectionInfoFromQuicVersion(version_),
533 response->connection_info); 547 response->connection_info);
534 } 548 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 uint16_t port) { 614 uint16_t port) {
601 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port); 615 SendRequestAndExpectQuicResponseMaybeFromProxy(expected, true, port);
602 } 616 }
603 617
604 void AddQuicAlternateProtocolMapping( 618 void AddQuicAlternateProtocolMapping(
605 MockCryptoClientStream::HandshakeMode handshake_mode) { 619 MockCryptoClientStream::HandshakeMode handshake_mode) {
606 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); 620 crypto_client_stream_factory_.set_handshake_mode(handshake_mode);
607 url::SchemeHostPort server(request_.url); 621 url::SchemeHostPort server(request_.url);
608 AlternativeService alternative_service(kProtoQUIC, server.host(), 443); 622 AlternativeService alternative_service(kProtoQUIC, server.host(), 443);
609 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 623 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
610 http_server_properties_.SetAlternativeService(server, alternative_service, 624 http_server_properties_.SetAlternativeService(
611 expiration); 625 server, alternative_service, expiration,
626 HttpNetworkSession::Params().quic_supported_versions);
612 } 627 }
613 628
614 void AddQuicRemoteAlternativeServiceMapping( 629 void AddQuicRemoteAlternativeServiceMapping(
615 MockCryptoClientStream::HandshakeMode handshake_mode, 630 MockCryptoClientStream::HandshakeMode handshake_mode,
616 const HostPortPair& alternative) { 631 const HostPortPair& alternative) {
617 crypto_client_stream_factory_.set_handshake_mode(handshake_mode); 632 crypto_client_stream_factory_.set_handshake_mode(handshake_mode);
618 url::SchemeHostPort server(request_.url); 633 url::SchemeHostPort server(request_.url);
619 AlternativeService alternative_service(kProtoQUIC, alternative.host(), 634 AlternativeService alternative_service(kProtoQUIC, alternative.host(),
620 alternative.port()); 635 alternative.port());
621 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 636 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
622 http_server_properties_.SetAlternativeService(server, alternative_service, 637 http_server_properties_.SetAlternativeService(
623 expiration); 638 server, alternative_service, expiration,
639 HttpNetworkSession::Params().quic_supported_versions);
624 } 640 }
625 641
626 void ExpectBrokenAlternateProtocolMapping() { 642 void ExpectBrokenAlternateProtocolMapping() {
627 const url::SchemeHostPort server(request_.url); 643 const url::SchemeHostPort server(request_.url);
628 const AlternativeServiceInfoVector alternative_service_info_vector = 644 const AlternativeServiceInfoVector alternative_service_info_vector =
629 http_server_properties_.GetAlternativeServiceInfos(server); 645 http_server_properties_.GetAlternativeServiceInfos(server);
630 EXPECT_EQ(1u, alternative_service_info_vector.size()); 646 EXPECT_EQ(1u, alternative_service_info_vector.size());
631 EXPECT_TRUE(http_server_properties_.IsAlternativeServiceBroken( 647 EXPECT_TRUE(http_server_properties_.IsAlternativeServiceBroken(
632 alternative_service_info_vector[0].alternative_service)); 648 alternative_service_info_vector[0].alternative_service));
633 } 649 }
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 // HttpNetworkTransaction should reset the request and retry without using 1084 // HttpNetworkTransaction should reset the request and retry without using
1069 // alternative services. 1085 // alternative services.
1070 TEST_P(QuicNetworkTransactionTest, RetryMisdirectedRequest) { 1086 TEST_P(QuicNetworkTransactionTest, RetryMisdirectedRequest) {
1071 // Set up alternative service to use QUIC. 1087 // Set up alternative service to use QUIC.
1072 // Note that |origins_to_force_quic_on| cannot be used in this test, because 1088 // Note that |origins_to_force_quic_on| cannot be used in this test, because
1073 // that overrides |enable_alternative_services|. 1089 // that overrides |enable_alternative_services|.
1074 url::SchemeHostPort server(request_.url); 1090 url::SchemeHostPort server(request_.url);
1075 AlternativeService alternative_service(kProtoQUIC, kDefaultServerHostName, 1091 AlternativeService alternative_service(kProtoQUIC, kDefaultServerHostName,
1076 443); 1092 443);
1077 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 1093 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
1078 http_server_properties_.SetAlternativeService(server, alternative_service, 1094 http_server_properties_.SetAlternativeService(
1079 expiration); 1095 server, alternative_service, expiration,
1096 HttpNetworkSession::Params().quic_supported_versions);
1080 1097
1081 // First try: The alternative job uses QUIC and reports an HTTP 421 1098 // First try: The alternative job uses QUIC and reports an HTTP 421
1082 // Misdirected Request error. The main job uses TCP, but |http_data| below is 1099 // Misdirected Request error. The main job uses TCP, but |http_data| below is
1083 // paused at Connect(), so it will never exit the socket pool. This ensures 1100 // paused at Connect(), so it will never exit the socket pool. This ensures
1084 // that the alternate job always wins the race and keeps whether the 1101 // that the alternate job always wins the race and keeps whether the
1085 // |http_data| exits the socket pool before the main job is aborted 1102 // |http_data| exits the socket pool before the main job is aborted
1086 // deterministic. The first main job gets aborted without the socket pool ever 1103 // deterministic. The first main job gets aborted without the socket pool ever
1087 // dispensing the socket, making it available for the second try. 1104 // dispensing the socket, making it available for the second try.
1088 MockQuicData mock_quic_data; 1105 MockQuicData mock_quic_data;
1089 QuicStreamOffset request_header_offset = 0; 1106 QuicStreamOffset request_header_offset = 0;
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 EXPECT_EQ( 1348 EXPECT_EQ(
1332 2u, 1349 2u,
1333 http_server_properties->GetAlternativeServiceInfos(https_server).size()); 1350 http_server_properties->GetAlternativeServiceInfos(https_server).size());
1334 1351
1335 // Send http request to the same origin but with diffrent scheme, should not 1352 // Send http request to the same origin but with diffrent scheme, should not
1336 // use QUIC. 1353 // use QUIC.
1337 request_.url = GURL("http://mail.example.org:443"); 1354 request_.url = GURL("http://mail.example.org:443");
1338 SendRequestAndExpectHttpResponse("hello world"); 1355 SendRequestAndExpectHttpResponse("hello world");
1339 } 1356 }
1340 1357
1358 TEST_P(QuicNetworkTransactionTest,
1359 StoreMutuallySupportedVersionsWhenProcessAltSvc) {
1360 std::string advertised_versions_list_str =
1361 GenerateQuicVersionsListForAltSvcHeader(AllSupportedVersions());
1362 std::string altsvc_header =
1363 base::StringPrintf("Alt-Svc: quic=\":443\"; v=\"%s\"\r\n\r\n",
1364 advertised_versions_list_str.c_str());
1365 MockRead http_reads[] = {
1366 MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()),
1367 MockRead("hello world"),
1368 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
1369 MockRead(ASYNC, OK)};
1370
1371 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
1372 0);
1373 socket_factory_.AddSocketDataProvider(&http_data);
1374 socket_factory_.AddSSLSocketDataProvider(&ssl_data_);
1375
1376 MockQuicData mock_quic_data;
1377 QuicStreamOffset header_stream_offset = 0;
1378 mock_quic_data.AddWrite(
1379 ConstructInitialSettingsPacket(1, &header_stream_offset));
1380 mock_quic_data.AddWrite(ConstructClientRequestHeadersPacket(
1381 2, GetNthClientInitiatedStreamId(0), true, true,
1382 GetRequestHeaders("GET", "https", "/"), &header_stream_offset));
1383 mock_quic_data.AddRead(ConstructServerResponseHeadersPacket(
1384 1, GetNthClientInitiatedStreamId(0), false, false,
1385 GetResponseHeaders("200 OK")));
1386 mock_quic_data.AddRead(ConstructServerDataPacket(
1387 2, GetNthClientInitiatedStreamId(0), false, true, 0, "hello!"));
1388 mock_quic_data.AddWrite(ConstructClientAckPacket(3, 2, 1, 1));
1389 mock_quic_data.AddRead(ASYNC, ERR_IO_PENDING); // No more data to read
1390 mock_quic_data.AddRead(ASYNC, 0); // EOF
1391
1392 mock_quic_data.AddSocketDataToFactory(&socket_factory_);
1393
1394 AddHangingNonAlternateProtocolSocketData();
1395
1396 // Generate a list of QUIC versions suppored by netstack.
1397 QuicVersionVector current_supported_versions = SupportedVersions(version_);
1398 if (version_ != QUIC_VERSION_40) {
1399 current_supported_versions.push_back(QUIC_VERSION_40);
1400 } else {
1401 current_supported_versions.push_back(QUIC_VERSION_37);
1402 }
1403
1404 CreateSession(current_supported_versions);
1405
1406 SendRequestAndExpectHttpResponse("hello world");
1407 SendRequestAndExpectQuicResponse("hello!");
1408
1409 // Check alternative service is set with only mutually supported versions.
1410 const url::SchemeHostPort https_server(request_.url);
1411 const AlternativeServiceInfoVector alt_svc_info_vector =
1412 session_->http_server_properties()->GetAlternativeServiceInfos(
1413 https_server);
1414 EXPECT_EQ(1u, alt_svc_info_vector.size());
1415 EXPECT_EQ(kProtoQUIC, alt_svc_info_vector[0].alternative_service.protocol);
1416 EXPECT_EQ(2u, alt_svc_info_vector[0].advertised_versions().size());
1417 // Advertised versions will be lised in a sorted order.
1418 std::sort(current_supported_versions.begin(),
1419 current_supported_versions.end());
1420 EXPECT_EQ(current_supported_versions[0],
1421 alt_svc_info_vector[0].advertised_versions()[0]);
1422 EXPECT_EQ(current_supported_versions[1],
1423 alt_svc_info_vector[0].advertised_versions()[1]);
1424 }
1425
1341 TEST_P(QuicNetworkTransactionTest, UseAlternativeServiceAllSupportedVersion) { 1426 TEST_P(QuicNetworkTransactionTest, UseAlternativeServiceAllSupportedVersion) {
1342 std::string altsvc_header = 1427 std::string altsvc_header =
1343 base::StringPrintf("Alt-Svc: quic=\":443\"; v=\"%u\"\r\n\r\n", version_); 1428 base::StringPrintf("Alt-Svc: quic=\":443\"; v=\"%u\"\r\n\r\n", version_);
1344 MockRead http_reads[] = { 1429 MockRead http_reads[] = {
1345 MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()), 1430 MockRead("HTTP/1.1 200 OK\r\n"), MockRead(altsvc_header.c_str()),
1346 MockRead("hello world"), 1431 MockRead("hello world"),
1347 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), 1432 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ),
1348 MockRead(ASYNC, OK)}; 1433 MockRead(ASYNC, OK)};
1349 1434
1350 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, 1435 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr,
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2667 2752
2668 CreateSession(); 2753 CreateSession();
2669 2754
2670 const char destination1[] = "first.example.com"; 2755 const char destination1[] = "first.example.com";
2671 const char destination2[] = "second.example.com"; 2756 const char destination2[] = "second.example.com";
2672 2757
2673 // Set up alternative service entry to destination1. 2758 // Set up alternative service entry to destination1.
2674 url::SchemeHostPort server(request_.url); 2759 url::SchemeHostPort server(request_.url);
2675 AlternativeService alternative_service(kProtoQUIC, destination1, 443); 2760 AlternativeService alternative_service(kProtoQUIC, destination1, 443);
2676 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 2761 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
2677 http_server_properties_.SetAlternativeService(server, alternative_service, 2762 http_server_properties_.SetAlternativeService(
2678 expiration); 2763 server, alternative_service, expiration,
2764 HttpNetworkSession::Params().quic_supported_versions);
2679 // First request opens connection to |destination1| 2765 // First request opens connection to |destination1|
2680 // with QuicServerId.host() == kDefaultServerHostName. 2766 // with QuicServerId.host() == kDefaultServerHostName.
2681 SendRequestAndExpectQuicResponse("hello!"); 2767 SendRequestAndExpectQuicResponse("hello!");
2682 2768
2683 // Set up alternative service entry to a different destination. 2769 // Set up alternative service entry to a different destination.
2684 alternative_service = AlternativeService(kProtoQUIC, destination2, 443); 2770 alternative_service = AlternativeService(kProtoQUIC, destination2, 443);
2685 http_server_properties_.SetAlternativeService(server, alternative_service, 2771 http_server_properties_.SetAlternativeService(
2686 expiration); 2772 server, alternative_service, expiration,
2773 HttpNetworkSession::Params().quic_supported_versions);
2687 // Second request pools to existing connection with same QuicServerId, 2774 // Second request pools to existing connection with same QuicServerId,
2688 // even though alternative service destination is different. 2775 // even though alternative service destination is different.
2689 SendRequestAndExpectQuicResponse("hello!"); 2776 SendRequestAndExpectQuicResponse("hello!");
2690 } 2777 }
2691 2778
2692 // Pool to existing session with matching destination and matching certificate 2779 // Pool to existing session with matching destination and matching certificate
2693 // even if origin is different, and even if the alternative service with 2780 // even if origin is different, and even if the alternative service with
2694 // matching destination is not the first one on the list. 2781 // matching destination is not the first one on the list.
2695 TEST_P(QuicNetworkTransactionTest, PoolByDestination) { 2782 TEST_P(QuicNetworkTransactionTest, PoolByDestination) {
2696 GURL origin1 = request_.url; 2783 GURL origin1 = request_.url;
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2740 2827
2741 CreateSession(); 2828 CreateSession();
2742 2829
2743 const char destination1[] = "first.example.com"; 2830 const char destination1[] = "first.example.com";
2744 const char destination2[] = "second.example.com"; 2831 const char destination2[] = "second.example.com";
2745 2832
2746 // Set up alternative service for |origin1|. 2833 // Set up alternative service for |origin1|.
2747 AlternativeService alternative_service1(kProtoQUIC, destination1, 443); 2834 AlternativeService alternative_service1(kProtoQUIC, destination1, 443);
2748 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 2835 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
2749 http_server_properties_.SetAlternativeService( 2836 http_server_properties_.SetAlternativeService(
2750 url::SchemeHostPort(origin1), alternative_service1, expiration); 2837 url::SchemeHostPort(origin1), alternative_service1, expiration,
2838 HttpNetworkSession::Params().quic_supported_versions);
2751 2839
2752 // Set up multiple alternative service entries for |origin2|, 2840 // Set up multiple alternative service entries for |origin2|,
2753 // the first one with a different destination as for |origin1|, 2841 // the first one with a different destination as for |origin1|,
2754 // the second one with the same. The second one should be used, 2842 // the second one with the same. The second one should be used,
2755 // because the request can be pooled to that one. 2843 // because the request can be pooled to that one.
2756 AlternativeService alternative_service2(kProtoQUIC, destination2, 443); 2844 AlternativeService alternative_service2(kProtoQUIC, destination2, 443);
2757 AlternativeServiceInfoVector alternative_services; 2845 AlternativeServiceInfoVector alternative_services;
2758 alternative_services.push_back( 2846 alternative_services.push_back(
2759 AlternativeServiceInfo(alternative_service2, expiration)); 2847 AlternativeServiceInfo(alternative_service2, expiration));
2760 alternative_services.push_back( 2848 alternative_services.push_back(
(...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after
4254 destination = HostPortPair(origin2_, 443); 4342 destination = HostPortPair(origin2_, 443);
4255 break; 4343 break;
4256 case DIFFERENT: 4344 case DIFFERENT:
4257 destination = HostPortPair(kDifferentHostname, 443); 4345 destination = HostPortPair(kDifferentHostname, 443);
4258 break; 4346 break;
4259 } 4347 }
4260 AlternativeService alternative_service(kProtoQUIC, destination); 4348 AlternativeService alternative_service(kProtoQUIC, destination);
4261 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1); 4349 base::Time expiration = base::Time::Now() + base::TimeDelta::FromDays(1);
4262 http_server_properties_.SetAlternativeService( 4350 http_server_properties_.SetAlternativeService(
4263 url::SchemeHostPort("https", origin, 443), alternative_service, 4351 url::SchemeHostPort("https", origin, 443), alternative_service,
4264 expiration); 4352 expiration, HttpNetworkSession::Params().quic_supported_versions);
4265 } 4353 }
4266 4354
4267 std::unique_ptr<QuicEncryptedPacket> ConstructClientRequestHeadersPacket( 4355 std::unique_ptr<QuicEncryptedPacket> ConstructClientRequestHeadersPacket(
4268 QuicPacketNumber packet_number, 4356 QuicPacketNumber packet_number,
4269 QuicStreamId stream_id, 4357 QuicStreamId stream_id,
4270 bool should_include_version, 4358 bool should_include_version,
4271 QuicStreamOffset* offset, 4359 QuicStreamOffset* offset,
4272 QuicTestPacketMaker* maker) { 4360 QuicTestPacketMaker* maker) {
4273 SpdyPriority priority = 4361 SpdyPriority priority =
4274 ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY); 4362 ConvertRequestPriorityToQuicPriority(DEFAULT_PRIORITY);
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
4689 4777
4690 request_.url = GURL("https://mail.example.org/pushed.jpg"); 4778 request_.url = GURL("https://mail.example.org/pushed.jpg");
4691 ChunkedUploadDataStream upload_data(0); 4779 ChunkedUploadDataStream upload_data(0);
4692 upload_data.AppendData("1", 1, true); 4780 upload_data.AppendData("1", 1, true);
4693 request_.upload_data_stream = &upload_data; 4781 request_.upload_data_stream = &upload_data;
4694 SendRequestAndExpectQuicResponse("and hello!"); 4782 SendRequestAndExpectQuicResponse("and hello!");
4695 } 4783 }
4696 4784
4697 } // namespace test 4785 } // namespace test
4698 } // namespace net 4786 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698