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

Side by Side Diff: net/spdy/chromium/spdy_session_unittest.cc

Issue 2955673002: Filter QUIC alternative service if the versions advertised by the server (Closed)
Patch Set: address comments #7 Created 3 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/spdy/chromium/spdy_session_pool.cc ('k') | no next file » | 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/spdy/chromium/spdy_session.h" 5 #include "net/spdy/chromium/spdy_session.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 5639 matching lines...) Expand 10 before | Expand all | Expand 10 after
5650 5650
5651 altsvc_info_vector = 5651 altsvc_info_vector =
5652 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( 5652 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos(
5653 url::SchemeHostPort(GURL(origin))); 5653 url::SchemeHostPort(GURL(origin)));
5654 ASSERT_EQ(1u, altsvc_info_vector.size()); 5654 ASSERT_EQ(1u, altsvc_info_vector.size());
5655 AlternativeService alternative_service(kProtoQUIC, "alternative.example.org", 5655 AlternativeService alternative_service(kProtoQUIC, "alternative.example.org",
5656 443u); 5656 443u);
5657 EXPECT_EQ(alternative_service, altsvc_info_vector[0].alternative_service()); 5657 EXPECT_EQ(alternative_service, altsvc_info_vector[0].alternative_service());
5658 } 5658 }
5659 5659
5660 // Regression test for https://crbug.com/736063.
5661 TEST_F(AltSvcFrameTest, IgnoreQuicAltSvcWithUnsupportedVersion) {
5662 const char origin[] = "https://mail.example.org";
5663 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 0);
5664 SpdyAltSvcWireFormat::AlternativeService quic_alternative_service(
5665 "quic", "alternative.example.org", 443, 86400,
5666 SpdyAltSvcWireFormat::VersionVector());
5667 // TODO(zhongyi): SpdyAltSvcWireFormat::ParseHeaderFieldValue expects positve
5668 // versions while VersionVector allows nonnegative verisons.
5669 // Fix the parse function and change the hardcoded invalid version to
5670 // QUIC_VERSION_UNSUPPORTED.
5671 quic_alternative_service.version.push_back(/* invalid QUIC version */ 1);
5672 altsvc_ir.add_altsvc(quic_alternative_service);
5673 altsvc_ir.set_origin(origin);
5674 AddSocketData(altsvc_ir);
5675 AddSSLSocketData();
5676
5677 CreateNetworkSession();
5678 CreateSecureSpdySession();
5679
5680 base::RunLoop().RunUntilIdle();
5681
5682 const url::SchemeHostPort session_origin("https", test_url_.host(),
5683 test_url_.EffectiveIntPort());
5684 AlternativeServiceInfoVector altsvc_info_vector =
5685 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos(
5686 session_origin);
5687 ASSERT_TRUE(altsvc_info_vector.empty());
5688
5689 altsvc_info_vector =
5690 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos(
5691 url::SchemeHostPort(GURL(origin)));
5692 ASSERT_EQ(0u, altsvc_info_vector.size());
5693 }
5694
5660 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) { 5695 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) {
5661 const char origin[] = "https://mail.example.org"; 5696 const char origin[] = "https://mail.example.org";
5662 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 0); 5697 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 0);
5663 altsvc_ir.add_altsvc(alternative_service_); 5698 altsvc_ir.add_altsvc(alternative_service_);
5664 altsvc_ir.set_origin(origin); 5699 altsvc_ir.set_origin(origin);
5665 AddSocketData(altsvc_ir); 5700 AddSocketData(altsvc_ir);
5666 AddSSLSocketData(); 5701 AddSSLSocketData();
5667 5702
5668 CreateNetworkSession(); 5703 CreateNetworkSession();
5669 CreateInsecureSpdySession(); 5704 CreateInsecureSpdySession();
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
6146 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 6181 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
6147 "spdy_pooling.pem"); 6182 "spdy_pooling.pem");
6148 ssl_info.is_issued_by_known_root = true; 6183 ssl_info.is_issued_by_known_root = true;
6149 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 6184 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
6150 6185
6151 EXPECT_TRUE(SpdySession::CanPool( 6186 EXPECT_TRUE(SpdySession::CanPool(
6152 &tss, ssl_info, "www.example.org", "mail.example.org")); 6187 &tss, ssl_info, "www.example.org", "mail.example.org"));
6153 } 6188 }
6154 6189
6155 } // namespace net 6190 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/chromium/spdy_session_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698