| OLD | NEW |
| 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 5630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5641 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( | 5641 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( |
| 5642 session_origin); | 5642 session_origin); |
| 5643 ASSERT_TRUE(altsvc_info_vector.empty()); | 5643 ASSERT_TRUE(altsvc_info_vector.empty()); |
| 5644 | 5644 |
| 5645 altsvc_info_vector = | 5645 altsvc_info_vector = |
| 5646 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( | 5646 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( |
| 5647 url::SchemeHostPort(GURL(origin))); | 5647 url::SchemeHostPort(GURL(origin))); |
| 5648 ASSERT_EQ(1u, altsvc_info_vector.size()); | 5648 ASSERT_EQ(1u, altsvc_info_vector.size()); |
| 5649 AlternativeService alternative_service(kProtoQUIC, "alternative.example.org", | 5649 AlternativeService alternative_service(kProtoQUIC, "alternative.example.org", |
| 5650 443u); | 5650 443u); |
| 5651 EXPECT_EQ(alternative_service, altsvc_info_vector[0].alternative_service); | 5651 EXPECT_EQ(alternative_service, altsvc_info_vector[0].alternative_service()); |
| 5652 } | 5652 } |
| 5653 | 5653 |
| 5654 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) { | 5654 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) { |
| 5655 const char origin[] = "https://mail.example.org"; | 5655 const char origin[] = "https://mail.example.org"; |
| 5656 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 0); | 5656 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 0); |
| 5657 altsvc_ir.add_altsvc(alternative_service_); | 5657 altsvc_ir.add_altsvc(alternative_service_); |
| 5658 altsvc_ir.set_origin(origin); | 5658 altsvc_ir.set_origin(origin); |
| 5659 AddSocketData(altsvc_ir); | 5659 AddSocketData(altsvc_ir); |
| 5660 AddSSLSocketData(); | 5660 AddSSLSocketData(); |
| 5661 | 5661 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5784 const url::SchemeHostPort session_origin("https", test_url_.host(), | 5784 const url::SchemeHostPort session_origin("https", test_url_.host(), |
| 5785 test_url_.EffectiveIntPort()); | 5785 test_url_.EffectiveIntPort()); |
| 5786 ASSERT_TRUE(spdy_session_pool_->http_server_properties() | 5786 ASSERT_TRUE(spdy_session_pool_->http_server_properties() |
| 5787 ->GetAlternativeServiceInfos(session_origin) | 5787 ->GetAlternativeServiceInfos(session_origin) |
| 5788 .empty()); | 5788 .empty()); |
| 5789 | 5789 |
| 5790 AlternativeServiceInfoVector altsvc_info_vector = | 5790 AlternativeServiceInfoVector altsvc_info_vector = |
| 5791 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( | 5791 spdy_session_pool_->http_server_properties()->GetAlternativeServiceInfos( |
| 5792 url::SchemeHostPort(GURL(request_origin))); | 5792 url::SchemeHostPort(GURL(request_origin))); |
| 5793 ASSERT_EQ(1u, altsvc_info_vector.size()); | 5793 ASSERT_EQ(1u, altsvc_info_vector.size()); |
| 5794 EXPECT_EQ(kProtoQUIC, altsvc_info_vector[0].alternative_service.protocol); | 5794 EXPECT_EQ(kProtoQUIC, altsvc_info_vector[0].alternative_service().protocol); |
| 5795 EXPECT_EQ("alternative.example.org", | 5795 EXPECT_EQ("alternative.example.org", |
| 5796 altsvc_info_vector[0].alternative_service.host); | 5796 altsvc_info_vector[0].alternative_service().host); |
| 5797 EXPECT_EQ(443u, altsvc_info_vector[0].alternative_service.port); | 5797 EXPECT_EQ(443u, altsvc_info_vector[0].alternative_service().port); |
| 5798 } | 5798 } |
| 5799 | 5799 |
| 5800 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnStreamWithInsecureOrigin) { | 5800 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnStreamWithInsecureOrigin) { |
| 5801 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 1); | 5801 SpdyAltSvcIR altsvc_ir(/* stream_id = */ 1); |
| 5802 altsvc_ir.add_altsvc(alternative_service_); | 5802 altsvc_ir.add_altsvc(alternative_service_); |
| 5803 | 5803 |
| 5804 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir)); | 5804 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir)); |
| 5805 SpdySerializedFrame rst( | 5805 SpdySerializedFrame rst( |
| 5806 spdy_util_.ConstructSpdyRstStream(1, ERROR_CODE_REFUSED_STREAM)); | 5806 spdy_util_.ConstructSpdyRstStream(1, ERROR_CODE_REFUSED_STREAM)); |
| 5807 MockRead reads[] = { | 5807 MockRead reads[] = { |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6140 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 6140 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 6141 "spdy_pooling.pem"); | 6141 "spdy_pooling.pem"); |
| 6142 ssl_info.is_issued_by_known_root = true; | 6142 ssl_info.is_issued_by_known_root = true; |
| 6143 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 6143 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 6144 | 6144 |
| 6145 EXPECT_TRUE(SpdySession::CanPool( | 6145 EXPECT_TRUE(SpdySession::CanPool( |
| 6146 &tss, ssl_info, "www.example.org", "mail.example.org")); | 6146 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 6147 } | 6147 } |
| 6148 | 6148 |
| 6149 } // namespace net | 6149 } // namespace net |
| OLD | NEW |