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

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

Issue 2724703002: Add AltSvcFrameTest for non-empty origin on non-zero frame. (Closed)
Patch Set: Add comment; rename one existing test. Created 3 years, 9 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 | « no previous file | 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/spdy_session.h" 5 #include "net/spdy/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 5607 matching lines...) Expand 10 before | Expand all | Expand 10 after
5618 spdy_session_pool_->http_server_properties()->GetAlternativeServices( 5618 spdy_session_pool_->http_server_properties()->GetAlternativeServices(
5619 session_origin); 5619 session_origin);
5620 ASSERT_TRUE(altsvc_vector.empty()); 5620 ASSERT_TRUE(altsvc_vector.empty());
5621 5621
5622 altsvc_vector = 5622 altsvc_vector =
5623 spdy_session_pool_->http_server_properties()->GetAlternativeServices( 5623 spdy_session_pool_->http_server_properties()->GetAlternativeServices(
5624 url::SchemeHostPort(GURL(origin))); 5624 url::SchemeHostPort(GURL(origin)));
5625 ASSERT_TRUE(altsvc_vector.empty()); 5625 ASSERT_TRUE(altsvc_vector.empty());
5626 } 5626 }
5627 5627
5628 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameWithEmptyOriginOnZeroStream) { 5628 // An ALTSVC frame on stream 0 with empty origin MUST be ignored.
5629 // (RFC 7838 Section 4)
5630 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameWithEmptyOriginOnStreamZero) {
5629 SpdyAltSvcIR altsvc_ir(0); 5631 SpdyAltSvcIR altsvc_ir(0);
5630 altsvc_ir.add_altsvc(alternative_service_); 5632 altsvc_ir.add_altsvc(alternative_service_);
5631 AddSocketData(altsvc_ir); 5633 AddSocketData(altsvc_ir);
5632 AddSSLSocketData(); 5634 AddSSLSocketData();
5633 5635
5634 CreateNetworkSession(); 5636 CreateNetworkSession();
5635 CreateSecureSpdySession(); 5637 CreateSecureSpdySession();
5636 5638
5637 base::RunLoop().RunUntilIdle(); 5639 base::RunLoop().RunUntilIdle();
5638 5640
5639 const url::SchemeHostPort session_origin("https", test_url_.host(), 5641 const url::SchemeHostPort session_origin("https", test_url_.host(),
5640 test_url_.EffectiveIntPort()); 5642 test_url_.EffectiveIntPort());
5641 AlternativeServiceVector altsvc_vector = 5643 AlternativeServiceVector altsvc_vector =
5642 spdy_session_pool_->http_server_properties()->GetAlternativeServices( 5644 spdy_session_pool_->http_server_properties()->GetAlternativeServices(
5643 session_origin); 5645 session_origin);
5644 ASSERT_TRUE(altsvc_vector.empty()); 5646 ASSERT_TRUE(altsvc_vector.empty());
5645 } 5647 }
5646 5648
5649 // An ALTSVC frame on a stream other than stream 0 with non-empty origin MUST be
5650 // ignored. (RFC 7838 Section 4)
5651 TEST_F(AltSvcFrameTest,
5652 DoNotProcessAltSvcFrameWithNonEmptyOriginOnNonZeroStream) {
5653 SpdyAltSvcIR altsvc_ir(1);
5654 altsvc_ir.add_altsvc(alternative_service_);
5655 altsvc_ir.set_origin("https://mail.example.org");
5656 AddSocketData(altsvc_ir);
5657 AddSSLSocketData();
5658
5659 CreateNetworkSession();
5660 CreateSecureSpdySession();
5661
5662 base::RunLoop().RunUntilIdle();
5663
5664 const url::SchemeHostPort session_origin("https", test_url_.host(),
5665 test_url_.EffectiveIntPort());
5666 AlternativeServiceVector altsvc_vector =
5667 spdy_session_pool_->http_server_properties()->GetAlternativeServices(
5668 session_origin);
5669 ASSERT_TRUE(altsvc_vector.empty());
5670 }
5671
5647 TEST_F(AltSvcFrameTest, ProcessAltSvcFrameOnActiveStream) { 5672 TEST_F(AltSvcFrameTest, ProcessAltSvcFrameOnActiveStream) {
5648 SpdyAltSvcIR altsvc_ir(1); 5673 SpdyAltSvcIR altsvc_ir(1);
5649 altsvc_ir.add_altsvc(alternative_service_); 5674 altsvc_ir.add_altsvc(alternative_service_);
5650 5675
5651 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir)); 5676 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir));
5652 SpdySerializedFrame rst( 5677 SpdySerializedFrame rst(
5653 spdy_util_.ConstructSpdyRstStream(1, ERROR_CODE_REFUSED_STREAM)); 5678 spdy_util_.ConstructSpdyRstStream(1, ERROR_CODE_REFUSED_STREAM));
5654 MockRead reads[] = { 5679 MockRead reads[] = {
5655 CreateMockRead(altsvc_frame, 1), CreateMockRead(rst, 2), 5680 CreateMockRead(altsvc_frame, 1), CreateMockRead(rst, 2),
5656 MockRead(ASYNC, 0, 3) // EOF 5681 MockRead(ASYNC, 0, 3) // EOF
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
6000 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), 6025 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(),
6001 "spdy_pooling.pem"); 6026 "spdy_pooling.pem");
6002 ssl_info.is_issued_by_known_root = true; 6027 ssl_info.is_issued_by_known_root = true;
6003 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); 6028 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin));
6004 6029
6005 EXPECT_TRUE(SpdySession::CanPool( 6030 EXPECT_TRUE(SpdySession::CanPool(
6006 &tss, ssl_info, "www.example.org", "mail.example.org")); 6031 &tss, ssl_info, "www.example.org", "mail.example.org"));
6007 } 6032 }
6008 6033
6009 } // namespace net 6034 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698