| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 EXPECT_LT(0, pos); | 467 EXPECT_LT(0, pos); |
| 468 | 468 |
| 469 int log_stream_id; | 469 int log_stream_id; |
| 470 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &log_stream_id)); | 470 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &log_stream_id)); |
| 471 EXPECT_EQ(3, log_stream_id); | 471 EXPECT_EQ(3, log_stream_id); |
| 472 } | 472 } |
| 473 | 473 |
| 474 TEST_P(QuicNetworkTransactionTest, QuicProxy) { | 474 TEST_P(QuicNetworkTransactionTest, QuicProxy) { |
| 475 params_.enable_insecure_quic = true; | 475 params_.enable_insecure_quic = true; |
| 476 params_.enable_quic_for_proxies = true; | 476 params_.enable_quic_for_proxies = true; |
| 477 proxy_service_.reset( | 477 proxy_service_ = ProxyService::CreateFixedFromPacResult("QUIC myproxy:70"); |
| 478 ProxyService::CreateFixedFromPacResult("QUIC myproxy:70")); | |
| 479 | 478 |
| 480 MockQuicData mock_quic_data; | 479 MockQuicData mock_quic_data; |
| 481 mock_quic_data.AddWrite( | 480 mock_quic_data.AddWrite( |
| 482 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, | 481 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, |
| 483 GetRequestHeaders("GET", "http", "/"))); | 482 GetRequestHeaders("GET", "http", "/"))); |
| 484 mock_quic_data.AddRead( | 483 mock_quic_data.AddRead( |
| 485 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, | 484 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, |
| 486 GetResponseHeaders("200 OK"))); | 485 GetResponseHeaders("200 OK"))); |
| 487 mock_quic_data.AddRead( | 486 mock_quic_data.AddRead( |
| 488 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); | 487 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 502 | 501 |
| 503 // Regression test for https://crbug.com/492458. Test that for an HTTP | 502 // Regression test for https://crbug.com/492458. Test that for an HTTP |
| 504 // connection through a QUIC proxy, the certificate exhibited by the proxy is | 503 // connection through a QUIC proxy, the certificate exhibited by the proxy is |
| 505 // checked against the proxy hostname, not the origin hostname. | 504 // checked against the proxy hostname, not the origin hostname. |
| 506 TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) { | 505 TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) { |
| 507 const std::string origin_host = "news.example.com"; | 506 const std::string origin_host = "news.example.com"; |
| 508 const std::string proxy_host = "www.example.org"; | 507 const std::string proxy_host = "www.example.org"; |
| 509 | 508 |
| 510 params_.enable_insecure_quic = true; | 509 params_.enable_insecure_quic = true; |
| 511 params_.enable_quic_for_proxies = true; | 510 params_.enable_quic_for_proxies = true; |
| 512 proxy_service_.reset( | 511 proxy_service_ = |
| 513 ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70")); | 512 ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70"); |
| 514 | 513 |
| 515 maker_.set_hostname(origin_host); | 514 maker_.set_hostname(origin_host); |
| 516 MockQuicData mock_quic_data; | 515 MockQuicData mock_quic_data; |
| 517 mock_quic_data.AddWrite( | 516 mock_quic_data.AddWrite( |
| 518 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, | 517 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, |
| 519 GetRequestHeaders("GET", "http", "/"))); | 518 GetRequestHeaders("GET", "http", "/"))); |
| 520 mock_quic_data.AddRead(ConstructResponseHeadersPacket( | 519 mock_quic_data.AddRead(ConstructResponseHeadersPacket( |
| 521 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); | 520 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); |
| 522 mock_quic_data.AddRead( | 521 mock_quic_data.AddRead( |
| 523 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); | 522 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); |
| (...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 nullptr, | 1362 nullptr, |
| 1364 net_log_.bound()); | 1363 net_log_.bound()); |
| 1365 | 1364 |
| 1366 CreateSessionWithNextProtos(); | 1365 CreateSessionWithNextProtos(); |
| 1367 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1366 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
| 1368 SendRequestAndExpectQuicResponse("hello!"); | 1367 SendRequestAndExpectQuicResponse("hello!"); |
| 1369 } | 1368 } |
| 1370 | 1369 |
| 1371 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) { | 1370 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) { |
| 1372 params_.enable_insecure_quic = true; | 1371 params_.enable_insecure_quic = true; |
| 1373 proxy_service_.reset( | 1372 proxy_service_ = ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
| 1374 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | |
| 1375 | 1373 |
| 1376 // Since we are using a proxy, the QUIC job will not succeed. | 1374 // Since we are using a proxy, the QUIC job will not succeed. |
| 1377 MockWrite http_writes[] = { | 1375 MockWrite http_writes[] = { |
| 1378 MockWrite(SYNCHRONOUS, 0, "GET http://www.google.com/ HTTP/1.1\r\n"), | 1376 MockWrite(SYNCHRONOUS, 0, "GET http://www.google.com/ HTTP/1.1\r\n"), |
| 1379 MockWrite(SYNCHRONOUS, 1, "Host: www.google.com\r\n"), | 1377 MockWrite(SYNCHRONOUS, 1, "Host: www.google.com\r\n"), |
| 1380 MockWrite(SYNCHRONOUS, 2, "Proxy-Connection: keep-alive\r\n\r\n") | 1378 MockWrite(SYNCHRONOUS, 2, "Proxy-Connection: keep-alive\r\n\r\n") |
| 1381 }; | 1379 }; |
| 1382 | 1380 |
| 1383 MockRead http_reads[] = { | 1381 MockRead http_reads[] = { |
| 1384 MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"), | 1382 MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"), |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 | 1745 |
| 1748 request_.url = GURL("https://www.example.org:443"); | 1746 request_.url = GURL("https://www.example.org:443"); |
| 1749 AddHangingNonAlternateProtocolSocketData(); | 1747 AddHangingNonAlternateProtocolSocketData(); |
| 1750 CreateSessionWithNextProtos(); | 1748 CreateSessionWithNextProtos(); |
| 1751 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); | 1749 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); |
| 1752 SendRequestAndExpectQuicResponse("hello!"); | 1750 SendRequestAndExpectQuicResponse("hello!"); |
| 1753 } | 1751 } |
| 1754 | 1752 |
| 1755 } // namespace test | 1753 } // namespace test |
| 1756 } // namespace net | 1754 } // namespace net |
| OLD | NEW |