| 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 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 socket_factory_.AddSocketDataProvider(&http_data); | 684 socket_factory_.AddSocketDataProvider(&http_data); |
| 685 socket_factory_.AddSocketDataProvider(&http_data); | 685 socket_factory_.AddSocketDataProvider(&http_data); |
| 686 | 686 |
| 687 params_.alternative_service_probability_threshold = .75; | 687 params_.alternative_service_probability_threshold = .75; |
| 688 CreateSessionWithNextProtos(); | 688 CreateSessionWithNextProtos(); |
| 689 | 689 |
| 690 SendRequestAndExpectHttpResponse("hello world"); | 690 SendRequestAndExpectHttpResponse("hello world"); |
| 691 SendRequestAndExpectHttpResponse("hello world"); | 691 SendRequestAndExpectHttpResponse("hello world"); |
| 692 } | 692 } |
| 693 | 693 |
| 694 TEST_P(QuicNetworkTransactionTest, DontUseAlternateProtocolForInsecureQuic) { |
| 695 MockRead http_reads[] = {MockRead("HTTP/1.1 200 OK\r\n"), |
| 696 MockRead("Content-length: 11\r\n"), |
| 697 MockRead("Alternate-Protocol: 443:quic\r\n\r\n"), |
| 698 MockRead("hello world"), |
| 699 MockRead("HTTP/1.1 200 OK\r\n"), |
| 700 MockRead("Content-length: 11\r\n"), |
| 701 MockRead("Alternate-Protocol: 443:quic\r\n\r\n"), |
| 702 MockRead("hello world"), |
| 703 MockRead(ASYNC, OK)}; |
| 704 |
| 705 StaticSocketDataProvider http_data(http_reads, arraysize(http_reads), nullptr, |
| 706 0); |
| 707 socket_factory_.AddSocketDataProvider(&http_data); |
| 708 socket_factory_.AddSocketDataProvider(&http_data); |
| 709 |
| 710 params_.disable_insecure_quic = true; |
| 711 CreateSessionWithNextProtos(); |
| 712 |
| 713 SendRequestAndExpectHttpResponse("hello world"); |
| 714 SendRequestAndExpectHttpResponse("hello world"); |
| 715 } |
| 716 |
| 694 TEST_P(QuicNetworkTransactionTest, | 717 TEST_P(QuicNetworkTransactionTest, |
| 695 DontUseAlternateProtocolWithBadProbabilityForQuic) { | 718 DontUseAlternateProtocolWithBadProbabilityForQuic) { |
| 696 MockRead http_reads[] = { | 719 MockRead http_reads[] = { |
| 697 MockRead("HTTP/1.1 200 OK\r\n"), | 720 MockRead("HTTP/1.1 200 OK\r\n"), |
| 698 MockRead("Alternate-Protocol: 443:quic,p=2\r\n\r\n"), | 721 MockRead("Alternate-Protocol: 443:quic,p=2\r\n\r\n"), |
| 699 MockRead("hello world"), | 722 MockRead("hello world"), |
| 700 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), | 723 MockRead(SYNCHRONOUS, ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ), |
| 701 MockRead(ASYNC, OK) | 724 MockRead(ASYNC, OK) |
| 702 }; | 725 }; |
| 703 | 726 |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 nullptr, | 1195 nullptr, |
| 1173 net_log_.bound()); | 1196 net_log_.bound()); |
| 1174 | 1197 |
| 1175 CreateSessionWithNextProtos(); | 1198 CreateSessionWithNextProtos(); |
| 1176 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); | 1199 AddQuicAlternateProtocolMapping(MockCryptoClientStream::ZERO_RTT); |
| 1177 SendRequestAndExpectHttpResponse("hello world"); | 1200 SendRequestAndExpectHttpResponse("hello world"); |
| 1178 } | 1201 } |
| 1179 | 1202 |
| 1180 } // namespace test | 1203 } // namespace test |
| 1181 } // namespace net | 1204 } // namespace net |
| OLD | NEW |