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

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

Issue 1411063004: Remove insecure QUIC support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: enough! Created 5 years, 1 month 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/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_protocol.h » ('j') | 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 "net/quic/quic_http_stream.h" 5 #include "net/quic/quic_http_stream.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 13 matching lines...) Expand all
24 #include "net/quic/crypto/quic_server_info.h" 24 #include "net/quic/crypto/quic_server_info.h"
25 #include "net/quic/quic_chromium_client_session.h" 25 #include "net/quic/quic_chromium_client_session.h"
26 #include "net/quic/quic_connection.h" 26 #include "net/quic/quic_connection.h"
27 #include "net/quic/quic_connection_helper.h" 27 #include "net/quic/quic_connection_helper.h"
28 #include "net/quic/quic_default_packet_writer.h" 28 #include "net/quic/quic_default_packet_writer.h"
29 #include "net/quic/quic_http_utils.h" 29 #include "net/quic/quic_http_utils.h"
30 #include "net/quic/quic_packet_reader.h" 30 #include "net/quic/quic_packet_reader.h"
31 #include "net/quic/quic_reliable_client_stream.h" 31 #include "net/quic/quic_reliable_client_stream.h"
32 #include "net/quic/quic_write_blocked_list.h" 32 #include "net/quic/quic_write_blocked_list.h"
33 #include "net/quic/spdy_utils.h" 33 #include "net/quic/spdy_utils.h"
34 #include "net/quic/test_tools/crypto_test_utils.h"
34 #include "net/quic/test_tools/mock_clock.h" 35 #include "net/quic/test_tools/mock_clock.h"
35 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" 36 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h"
36 #include "net/quic/test_tools/mock_random.h" 37 #include "net/quic/test_tools/mock_random.h"
37 #include "net/quic/test_tools/quic_connection_peer.h" 38 #include "net/quic/test_tools/quic_connection_peer.h"
38 #include "net/quic/test_tools/quic_test_packet_maker.h" 39 #include "net/quic/test_tools/quic_test_packet_maker.h"
39 #include "net/quic/test_tools/quic_test_utils.h" 40 #include "net/quic/test_tools/quic_test_utils.h"
40 #include "net/quic/test_tools/test_task_runner.h" 41 #include "net/quic/test_tools/test_task_runner.h"
41 #include "net/socket/socket_test_util.h" 42 #include "net/socket/socket_test_util.h"
42 #include "net/spdy/spdy_frame_builder.h" 43 #include "net/spdy/spdy_frame_builder.h"
43 #include "net/spdy/spdy_framer.h" 44 #include "net/spdy/spdy_framer.h"
(...skipping 20 matching lines...) Expand all
64 QuicConnectionId connection_id, 65 QuicConnectionId connection_id,
65 IPEndPoint address, 66 IPEndPoint address,
66 QuicConnectionHelper* helper, 67 QuicConnectionHelper* helper,
67 const QuicConnection::PacketWriterFactory& writer_factory) 68 const QuicConnection::PacketWriterFactory& writer_factory)
68 : QuicConnection(connection_id, 69 : QuicConnection(connection_id,
69 address, 70 address,
70 helper, 71 helper,
71 writer_factory, 72 writer_factory,
72 true /* owns_writer */, 73 true /* owns_writer */,
73 Perspective::IS_CLIENT, 74 Perspective::IS_CLIENT,
74 false /* is_secure */,
75 versions) {} 75 versions) {}
76 76
77 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { 77 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) {
78 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); 78 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm);
79 } 79 }
80 }; 80 };
81 81
82 // Subclass of QuicHttpStream that closes itself when the first piece of data 82 // Subclass of QuicHttpStream that closes itself when the first piece of data
83 // is received. 83 // is received.
84 class AutoClosingStream : public QuicHttpStream { 84 class AutoClosingStream : public QuicHttpStream {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 : mode(mode), 132 : mode(mode),
133 packet(packet) { 133 packet(packet) {
134 } 134 }
135 IoMode mode; 135 IoMode mode;
136 QuicEncryptedPacket* packet; 136 QuicEncryptedPacket* packet;
137 }; 137 };
138 138
139 QuicHttpStreamTest() 139 QuicHttpStreamTest()
140 : net_log_(BoundNetLog()), 140 : net_log_(BoundNetLog()),
141 use_closing_stream_(false), 141 use_closing_stream_(false),
142 crypto_config_(CryptoTestUtils::ProofVerifierForTesting()),
142 read_buffer_(new IOBufferWithSize(4096)), 143 read_buffer_(new IOBufferWithSize(4096)),
143 connection_id_(2), 144 connection_id_(2),
144 stream_id_(kClientDataStreamId1), 145 stream_id_(kClientDataStreamId1),
145 maker_(GetParam(), connection_id_, &clock_, kDefaultServerHostName), 146 maker_(GetParam(), connection_id_, &clock_, kDefaultServerHostName),
146 random_generator_(0) { 147 random_generator_(0) {
147 IPAddressNumber ip; 148 IPAddressNumber ip;
148 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 149 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
149 peer_addr_ = IPEndPoint(ip, 443); 150 peer_addr_ = IPEndPoint(ip, 443);
150 self_addr_ = IPEndPoint(ip, 8435); 151 self_addr_ = IPEndPoint(ip, 8435);
151 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(20)); 152 clock_.AdvanceTime(QuicTime::Delta::FromMilliseconds(20));
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 connection_ = new TestQuicConnection(SupportedVersions(GetParam()), 216 connection_ = new TestQuicConnection(SupportedVersions(GetParam()),
216 connection_id_, peer_addr_, 217 connection_id_, peer_addr_,
217 helper_.get(), writer_factory); 218 helper_.get(), writer_factory);
218 connection_->set_visitor(&visitor_); 219 connection_->set_visitor(&visitor_);
219 connection_->SetSendAlgorithm(send_algorithm_); 220 connection_->SetSendAlgorithm(send_algorithm_);
220 session_.reset(new QuicChromiumClientSession( 221 session_.reset(new QuicChromiumClientSession(
221 connection_, scoped_ptr<DatagramClientSocket>(socket), 222 connection_, scoped_ptr<DatagramClientSocket>(socket),
222 /*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_, 223 /*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_,
223 &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr), 224 &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr),
224 QuicServerId(kDefaultServerHostName, kDefaultServerPort, 225 QuicServerId(kDefaultServerHostName, kDefaultServerPort,
225 /*is_secure=*/false, PRIVACY_MODE_DISABLED), 226 PRIVACY_MODE_DISABLED),
226 kQuicYieldAfterPacketsRead, 227 kQuicYieldAfterPacketsRead,
227 QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), 228 QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds),
228 /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_, 229 /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
229 "CONNECTION_UNKNOWN", base::TimeTicks::Now(), 230 "CONNECTION_UNKNOWN", base::TimeTicks::Now(),
230 base::ThreadTaskRunnerHandle::Get().get(), 231 base::ThreadTaskRunnerHandle::Get().get(),
231 /*socket_performance_watcher=*/nullptr, nullptr)); 232 /*socket_performance_watcher=*/nullptr, nullptr));
232 session_->Initialize(); 233 session_->Initialize();
233 session_->GetCryptoStream()->CryptoConnect(); 234 session_->GetCryptoStream()->CryptoConnect();
234 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); 235 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
235 stream_.reset(use_closing_stream_ ? 236 stream_.reset(use_closing_stream_ ?
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 884 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
884 reliable_stream->EffectivePriority()); 885 reliable_stream->EffectivePriority());
885 reliable_stream->SetDelegate(delegate); 886 reliable_stream->SetDelegate(delegate);
886 887
887 EXPECT_EQ(0, stream_->GetTotalSentBytes()); 888 EXPECT_EQ(0, stream_->GetTotalSentBytes());
888 EXPECT_EQ(0, stream_->GetTotalReceivedBytes()); 889 EXPECT_EQ(0, stream_->GetTotalReceivedBytes());
889 } 890 }
890 891
891 } // namespace test 892 } // namespace test
892 } // namespace net 893 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_end_to_end_unittest.cc ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698