Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(344)

Side by Side Diff: net/quic/quic_network_transaction_unittest.cc

Issue 1137073003: Add a new disable_insecure_quic finch parameter to disable insecure QUIC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « net/http/http_stream_factory_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698