| 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/spdy_session.h" | 5 #include "net/spdy/spdy_session.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 5371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5382 test_url_.EffectiveIntPort()); | 5382 test_url_.EffectiveIntPort()); |
| 5383 AlternativeServiceVector altsvc_vector = | 5383 AlternativeServiceVector altsvc_vector = |
| 5384 spdy_session_pool_->http_server_properties()->GetAlternativeServices( | 5384 spdy_session_pool_->http_server_properties()->GetAlternativeServices( |
| 5385 session_origin); | 5385 session_origin); |
| 5386 ASSERT_TRUE(altsvc_vector.empty()); | 5386 ASSERT_TRUE(altsvc_vector.empty()); |
| 5387 | 5387 |
| 5388 altsvc_vector = | 5388 altsvc_vector = |
| 5389 spdy_session_pool_->http_server_properties()->GetAlternativeServices( | 5389 spdy_session_pool_->http_server_properties()->GetAlternativeServices( |
| 5390 url::SchemeHostPort(GURL(origin))); | 5390 url::SchemeHostPort(GURL(origin))); |
| 5391 ASSERT_EQ(1u, altsvc_vector.size()); | 5391 ASSERT_EQ(1u, altsvc_vector.size()); |
| 5392 EXPECT_EQ(kProtoQUIC, altsvc_vector[0].protocol); | 5392 EXPECT_EQ(QUIC, altsvc_vector[0].protocol); |
| 5393 EXPECT_EQ("alternative.example.org", altsvc_vector[0].host); | 5393 EXPECT_EQ("alternative.example.org", altsvc_vector[0].host); |
| 5394 EXPECT_EQ(443u, altsvc_vector[0].port); | 5394 EXPECT_EQ(443u, altsvc_vector[0].port); |
| 5395 } | 5395 } |
| 5396 | 5396 |
| 5397 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) { | 5397 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnInsecureSession) { |
| 5398 const char origin[] = "https://mail.example.org"; | 5398 const char origin[] = "https://mail.example.org"; |
| 5399 SpdyAltSvcIR altsvc_ir(0); | 5399 SpdyAltSvcIR altsvc_ir(0); |
| 5400 altsvc_ir.add_altsvc(alternative_service_); | 5400 altsvc_ir.add_altsvc(alternative_service_); |
| 5401 altsvc_ir.set_origin(origin); | 5401 altsvc_ir.set_origin(origin); |
| 5402 AddSocketData(altsvc_ir); | 5402 AddSocketData(altsvc_ir); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5507 test_url_.EffectiveIntPort()); | 5507 test_url_.EffectiveIntPort()); |
| 5508 AlternativeServiceVector altsvc_vector = | 5508 AlternativeServiceVector altsvc_vector = |
| 5509 spdy_session_pool_->http_server_properties()->GetAlternativeServices( | 5509 spdy_session_pool_->http_server_properties()->GetAlternativeServices( |
| 5510 session_origin); | 5510 session_origin); |
| 5511 ASSERT_TRUE(altsvc_vector.empty()); | 5511 ASSERT_TRUE(altsvc_vector.empty()); |
| 5512 | 5512 |
| 5513 altsvc_vector = | 5513 altsvc_vector = |
| 5514 spdy_session_pool_->http_server_properties()->GetAlternativeServices( | 5514 spdy_session_pool_->http_server_properties()->GetAlternativeServices( |
| 5515 url::SchemeHostPort(GURL(request_origin))); | 5515 url::SchemeHostPort(GURL(request_origin))); |
| 5516 ASSERT_EQ(1u, altsvc_vector.size()); | 5516 ASSERT_EQ(1u, altsvc_vector.size()); |
| 5517 EXPECT_EQ(kProtoQUIC, altsvc_vector[0].protocol); | 5517 EXPECT_EQ(QUIC, altsvc_vector[0].protocol); |
| 5518 EXPECT_EQ("alternative.example.org", altsvc_vector[0].host); | 5518 EXPECT_EQ("alternative.example.org", altsvc_vector[0].host); |
| 5519 EXPECT_EQ(443u, altsvc_vector[0].port); | 5519 EXPECT_EQ(443u, altsvc_vector[0].port); |
| 5520 } | 5520 } |
| 5521 | 5521 |
| 5522 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnStreamWithInsecureOrigin) { | 5522 TEST_F(AltSvcFrameTest, DoNotProcessAltSvcFrameOnStreamWithInsecureOrigin) { |
| 5523 SpdyAltSvcIR altsvc_ir(1); | 5523 SpdyAltSvcIR altsvc_ir(1); |
| 5524 altsvc_ir.add_altsvc(alternative_service_); | 5524 altsvc_ir.add_altsvc(alternative_service_); |
| 5525 | 5525 |
| 5526 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir)); | 5526 SpdySerializedFrame altsvc_frame(spdy_util_.SerializeFrame(altsvc_ir)); |
| 5527 SpdySerializedFrame rst( | 5527 SpdySerializedFrame rst( |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5818 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), | 5818 ssl_info.cert = ImportCertFromFile(GetTestCertsDirectory(), |
| 5819 "spdy_pooling.pem"); | 5819 "spdy_pooling.pem"); |
| 5820 ssl_info.is_issued_by_known_root = true; | 5820 ssl_info.is_issued_by_known_root = true; |
| 5821 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); | 5821 ssl_info.public_key_hashes.push_back(test::GetTestHashValue(primary_pin)); |
| 5822 | 5822 |
| 5823 EXPECT_TRUE(SpdySession::CanPool( | 5823 EXPECT_TRUE(SpdySession::CanPool( |
| 5824 &tss, ssl_info, "www.example.org", "mail.example.org")); | 5824 &tss, ssl_info, "www.example.org", "mail.example.org")); |
| 5825 } | 5825 } |
| 5826 | 5826 |
| 5827 } // namespace net | 5827 } // namespace net |
| OLD | NEW |