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

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

Issue 944883003: QUIC - Cache the connection type and connection description. Make the (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move description caching into a distinct class Created 5 years, 10 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
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 <vector> 7 #include <vector>
8 8
9 #include "net/base/chunked_upload_data_stream.h" 9 #include "net/base/chunked_upload_data_stream.h"
10 #include "net/base/elements_upload_data_stream.h" 10 #include "net/base/elements_upload_data_stream.h"
11 #include "net/base/net_errors.h" 11 #include "net/base/net_errors.h"
12 #include "net/base/test_completion_callback.h" 12 #include "net/base/test_completion_callback.h"
13 #include "net/base/upload_bytes_element_reader.h" 13 #include "net/base/upload_bytes_element_reader.h"
14 #include "net/http/http_response_headers.h" 14 #include "net/http/http_response_headers.h"
15 #include "net/http/transport_security_state.h" 15 #include "net/http/transport_security_state.h"
16 #include "net/quic/congestion_control/send_algorithm_interface.h" 16 #include "net/quic/congestion_control/send_algorithm_interface.h"
17 #include "net/quic/crypto/crypto_protocol.h" 17 #include "net/quic/crypto/crypto_protocol.h"
18 #include "net/quic/crypto/quic_decrypter.h" 18 #include "net/quic/crypto/quic_decrypter.h"
19 #include "net/quic/crypto/quic_encrypter.h" 19 #include "net/quic/crypto/quic_encrypter.h"
20 #include "net/quic/crypto/quic_server_info.h" 20 #include "net/quic/crypto/quic_server_info.h"
21 #include "net/quic/network_connection.h"
21 #include "net/quic/quic_client_session.h" 22 #include "net/quic/quic_client_session.h"
22 #include "net/quic/quic_connection.h" 23 #include "net/quic/quic_connection.h"
23 #include "net/quic/quic_connection_helper.h" 24 #include "net/quic/quic_connection_helper.h"
24 #include "net/quic/quic_default_packet_writer.h" 25 #include "net/quic/quic_default_packet_writer.h"
25 #include "net/quic/quic_http_utils.h" 26 #include "net/quic/quic_http_utils.h"
26 #include "net/quic/quic_reliable_client_stream.h" 27 #include "net/quic/quic_reliable_client_stream.h"
27 #include "net/quic/quic_write_blocked_list.h" 28 #include "net/quic/quic_write_blocked_list.h"
28 #include "net/quic/spdy_utils.h" 29 #include "net/quic/spdy_utils.h"
29 #include "net/quic/test_tools/mock_clock.h" 30 #include "net/quic/test_tools/mock_clock.h"
30 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h" 31 #include "net/quic/test_tools/mock_crypto_client_stream_factory.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 Return(QuicBandwidth::Zero())); 200 Return(QuicBandwidth::Zero()));
200 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)).Times(AnyNumber()); 201 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _, _)).Times(AnyNumber());
201 helper_.reset(new QuicConnectionHelper(runner_.get(), &clock_, 202 helper_.reset(new QuicConnectionHelper(runner_.get(), &clock_,
202 &random_generator_)); 203 &random_generator_));
203 TestPacketWriterFactory writer_factory(socket); 204 TestPacketWriterFactory writer_factory(socket);
204 connection_ = new TestQuicConnection(SupportedVersions(GetParam()), 205 connection_ = new TestQuicConnection(SupportedVersions(GetParam()),
205 connection_id_, peer_addr_, 206 connection_id_, peer_addr_,
206 helper_.get(), writer_factory); 207 helper_.get(), writer_factory);
207 connection_->set_visitor(&visitor_); 208 connection_->set_visitor(&visitor_);
208 connection_->SetSendAlgorithm(send_algorithm_); 209 connection_->SetSendAlgorithm(send_algorithm_);
209 session_.reset( 210 session_.reset(new QuicClientSession(
210 new QuicClientSession(connection_, 211 connection_, scoped_ptr<DatagramClientSocket>(socket), nullptr,
211 scoped_ptr<DatagramClientSocket>(socket), 212 &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr),
212 nullptr, 213 DefaultQuicConfig(), &network_connection_,
213 &transport_security_state_, 214 base::MessageLoop::current()->message_loop_proxy().get(), nullptr));
214 make_scoped_ptr((QuicServerInfo*)nullptr),
215 DefaultQuicConfig(),
216 base::MessageLoop::current()->
217 message_loop_proxy().get(),
218 nullptr));
219 session_->InitializeSession(QuicServerId(kServerHostname, kServerPort, 215 session_->InitializeSession(QuicServerId(kServerHostname, kServerPort,
220 /*is_secure=*/false, 216 /*is_secure=*/false,
221 PRIVACY_MODE_DISABLED), 217 PRIVACY_MODE_DISABLED),
222 &crypto_config_, 218 &crypto_config_,
223 &crypto_client_stream_factory_); 219 &crypto_client_stream_factory_);
224 session_->GetCryptoStream()->CryptoConnect(); 220 session_->GetCryptoStream()->CryptoConnect();
225 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); 221 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
226 stream_.reset(use_closing_stream_ ? 222 stream_.reset(use_closing_stream_ ?
227 new AutoClosingStream(session_->GetWeakPtr()) : 223 new AutoClosingStream(session_->GetWeakPtr()) :
228 new QuicHttpStream(session_->GetWeakPtr())); 224 new QuicHttpStream(session_->GetWeakPtr()));
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 std::string response_data_; 309 std::string response_data_;
314 310
315 private: 311 private:
316 const QuicConnectionId connection_id_; 312 const QuicConnectionId connection_id_;
317 const QuicStreamId stream_id_; 313 const QuicStreamId stream_id_;
318 QuicTestPacketMaker maker_; 314 QuicTestPacketMaker maker_;
319 IPEndPoint self_addr_; 315 IPEndPoint self_addr_;
320 IPEndPoint peer_addr_; 316 IPEndPoint peer_addr_;
321 MockRandom random_generator_; 317 MockRandom random_generator_;
322 MockCryptoClientStreamFactory crypto_client_stream_factory_; 318 MockCryptoClientStreamFactory crypto_client_stream_factory_;
319 NetworkConnection network_connection_;
323 scoped_ptr<StaticSocketDataProvider> socket_data_; 320 scoped_ptr<StaticSocketDataProvider> socket_data_;
324 std::vector<PacketToWrite> writes_; 321 std::vector<PacketToWrite> writes_;
325 }; 322 };
326 323
327 INSTANTIATE_TEST_CASE_P(Version, QuicHttpStreamTest, 324 INSTANTIATE_TEST_CASE_P(Version, QuicHttpStreamTest,
328 ::testing::ValuesIn(QuicSupportedVersions())); 325 ::testing::ValuesIn(QuicSupportedVersions()));
329 326
330 TEST_P(QuicHttpStreamTest, RenewStreamForAuth) { 327 TEST_P(QuicHttpStreamTest, RenewStreamForAuth) {
331 Initialize(); 328 Initialize();
332 EXPECT_EQ(nullptr, stream_->RenewStreamForAuth()); 329 EXPECT_EQ(nullptr, stream_->RenewStreamForAuth());
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 // Set Delegate to nullptr and make sure EffectivePriority returns highest 754 // Set Delegate to nullptr and make sure EffectivePriority returns highest
758 // priority. 755 // priority.
759 reliable_stream->SetDelegate(nullptr); 756 reliable_stream->SetDelegate(nullptr);
760 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 757 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
761 reliable_stream->EffectivePriority()); 758 reliable_stream->EffectivePriority());
762 reliable_stream->SetDelegate(delegate); 759 reliable_stream->SetDelegate(delegate);
763 } 760 }
764 761
765 } // namespace test 762 } // namespace test
766 } // namespace net 763 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698