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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 EXPECT_LT(0, pos); | 461 EXPECT_LT(0, pos); |
462 | 462 |
463 int log_stream_id; | 463 int log_stream_id; |
464 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &log_stream_id)); | 464 ASSERT_TRUE(entries[pos].GetIntegerValue("stream_id", &log_stream_id)); |
465 EXPECT_EQ(3, log_stream_id); | 465 EXPECT_EQ(3, log_stream_id); |
466 } | 466 } |
467 | 467 |
468 TEST_P(QuicNetworkTransactionTest, QuicProxy) { | 468 TEST_P(QuicNetworkTransactionTest, QuicProxy) { |
469 params_.enable_insecure_quic = true; | 469 params_.enable_insecure_quic = true; |
470 params_.enable_quic_for_proxies = true; | 470 params_.enable_quic_for_proxies = true; |
471 proxy_service_.reset( | 471 proxy_service_ = ProxyService::CreateFixedFromPacResult("QUIC myproxy:70"); |
472 ProxyService::CreateFixedFromPacResult("QUIC myproxy:70")); | |
473 | 472 |
474 MockQuicData mock_quic_data; | 473 MockQuicData mock_quic_data; |
475 mock_quic_data.AddWrite( | 474 mock_quic_data.AddWrite( |
476 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, | 475 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, |
477 GetRequestHeaders("GET", "http", "/"))); | 476 GetRequestHeaders("GET", "http", "/"))); |
478 mock_quic_data.AddRead( | 477 mock_quic_data.AddRead( |
479 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, | 478 ConstructResponseHeadersPacket(1, kClientDataStreamId1, false, false, |
480 GetResponseHeaders("200 OK"))); | 479 GetResponseHeaders("200 OK"))); |
481 mock_quic_data.AddRead( | 480 mock_quic_data.AddRead( |
482 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); | 481 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); |
(...skipping 13 matching lines...) Expand all Loading... |
496 | 495 |
497 // Regression test for https://crbug.com/492458. Test that for an HTTP | 496 // Regression test for https://crbug.com/492458. Test that for an HTTP |
498 // connection through a QUIC proxy, the certificate exhibited by the proxy is | 497 // connection through a QUIC proxy, the certificate exhibited by the proxy is |
499 // checked against the proxy hostname, not the origin hostname. | 498 // checked against the proxy hostname, not the origin hostname. |
500 TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) { | 499 TEST_P(QuicNetworkTransactionTest, QuicProxyWithCert) { |
501 const std::string origin_host = "news.example.com"; | 500 const std::string origin_host = "news.example.com"; |
502 const std::string proxy_host = "www.example.org"; | 501 const std::string proxy_host = "www.example.org"; |
503 | 502 |
504 params_.enable_insecure_quic = true; | 503 params_.enable_insecure_quic = true; |
505 params_.enable_quic_for_proxies = true; | 504 params_.enable_quic_for_proxies = true; |
506 proxy_service_.reset( | 505 proxy_service_ = |
507 ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70")); | 506 ProxyService::CreateFixedFromPacResult("QUIC " + proxy_host + ":70"); |
508 | 507 |
509 maker_.set_hostname(origin_host); | 508 maker_.set_hostname(origin_host); |
510 MockQuicData mock_quic_data; | 509 MockQuicData mock_quic_data; |
511 mock_quic_data.AddWrite( | 510 mock_quic_data.AddWrite( |
512 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, | 511 ConstructRequestHeadersPacket(1, kClientDataStreamId1, true, true, |
513 GetRequestHeaders("GET", "http", "/"))); | 512 GetRequestHeaders("GET", "http", "/"))); |
514 mock_quic_data.AddRead(ConstructResponseHeadersPacket( | 513 mock_quic_data.AddRead(ConstructResponseHeadersPacket( |
515 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); | 514 1, kClientDataStreamId1, false, false, GetResponseHeaders("200 OK"))); |
516 mock_quic_data.AddRead( | 515 mock_quic_data.AddRead( |
517 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); | 516 ConstructDataPacket(2, kClientDataStreamId1, false, true, 0, "hello!")); |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 nullptr, | 1356 nullptr, |
1358 net_log_.bound()); | 1357 net_log_.bound()); |
1359 | 1358 |
1360 CreateSessionWithNextProtos(); | 1359 CreateSessionWithNextProtos(); |
1361 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1360 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
1362 SendRequestAndExpectQuicResponse("hello!"); | 1361 SendRequestAndExpectQuicResponse("hello!"); |
1363 } | 1362 } |
1364 | 1363 |
1365 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) { | 1364 TEST_P(QuicNetworkTransactionTest, ZeroRTTWithProxy) { |
1366 params_.enable_insecure_quic = true; | 1365 params_.enable_insecure_quic = true; |
1367 proxy_service_.reset( | 1366 proxy_service_ = ProxyService::CreateFixedFromPacResult("PROXY myproxy:70"); |
1368 ProxyService::CreateFixedFromPacResult("PROXY myproxy:70")); | |
1369 | 1367 |
1370 // Since we are using a proxy, the QUIC job will not succeed. | 1368 // Since we are using a proxy, the QUIC job will not succeed. |
1371 MockWrite http_writes[] = { | 1369 MockWrite http_writes[] = { |
1372 MockWrite(SYNCHRONOUS, 0, "GET http://www.google.com/ HTTP/1.1\r\n"), | 1370 MockWrite(SYNCHRONOUS, 0, "GET http://www.google.com/ HTTP/1.1\r\n"), |
1373 MockWrite(SYNCHRONOUS, 1, "Host: www.google.com\r\n"), | 1371 MockWrite(SYNCHRONOUS, 1, "Host: www.google.com\r\n"), |
1374 MockWrite(SYNCHRONOUS, 2, "Proxy-Connection: keep-alive\r\n\r\n") | 1372 MockWrite(SYNCHRONOUS, 2, "Proxy-Connection: keep-alive\r\n\r\n") |
1375 }; | 1373 }; |
1376 | 1374 |
1377 MockRead http_reads[] = { | 1375 MockRead http_reads[] = { |
1378 MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"), | 1376 MockRead(SYNCHRONOUS, 3, "HTTP/1.1 200 OK\r\n"), |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 | 1739 |
1742 request_.url = GURL("https://www.example.org:443"); | 1740 request_.url = GURL("https://www.example.org:443"); |
1743 AddHangingNonAlternateProtocolSocketData(); | 1741 AddHangingNonAlternateProtocolSocketData(); |
1744 CreateSessionWithNextProtos(); | 1742 CreateSessionWithNextProtos(); |
1745 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); | 1743 AddQuicAlternateProtocolMapping(MockCryptoClientStream::CONFIRM_HANDSHAKE); |
1746 SendRequestAndExpectQuicResponse("hello!"); | 1744 SendRequestAndExpectQuicResponse("hello!"); |
1747 } | 1745 } |
1748 | 1746 |
1749 } // namespace test | 1747 } // namespace test |
1750 } // namespace net | 1748 } // namespace net |
OLD | NEW |