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

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

Issue 1908103002: Landing Recent QUIC changes until 4/15/2016 17:20 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 8 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/quic/quic_headers_stream_test.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('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 <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 #include "net/http/http_response_headers.h" 22 #include "net/http/http_response_headers.h"
23 #include "net/http/transport_security_state.h" 23 #include "net/http/transport_security_state.h"
24 #include "net/log/test_net_log.h" 24 #include "net/log/test_net_log.h"
25 #include "net/log/test_net_log_util.h" 25 #include "net/log/test_net_log_util.h"
26 #include "net/quic/congestion_control/send_algorithm_interface.h" 26 #include "net/quic/congestion_control/send_algorithm_interface.h"
27 #include "net/quic/crypto/crypto_protocol.h" 27 #include "net/quic/crypto/crypto_protocol.h"
28 #include "net/quic/crypto/proof_verifier_chromium.h" 28 #include "net/quic/crypto/proof_verifier_chromium.h"
29 #include "net/quic/crypto/quic_decrypter.h" 29 #include "net/quic/crypto/quic_decrypter.h"
30 #include "net/quic/crypto/quic_encrypter.h" 30 #include "net/quic/crypto/quic_encrypter.h"
31 #include "net/quic/crypto/quic_server_info.h" 31 #include "net/quic/crypto/quic_server_info.h"
32 #include "net/quic/quic_chromium_alarm_factory.h"
32 #include "net/quic/quic_chromium_client_session.h" 33 #include "net/quic/quic_chromium_client_session.h"
33 #include "net/quic/quic_chromium_client_stream.h" 34 #include "net/quic/quic_chromium_client_stream.h"
34 #include "net/quic/quic_chromium_connection_helper.h" 35 #include "net/quic/quic_chromium_connection_helper.h"
35 #include "net/quic/quic_chromium_packet_reader.h" 36 #include "net/quic/quic_chromium_packet_reader.h"
36 #include "net/quic/quic_chromium_packet_writer.h" 37 #include "net/quic/quic_chromium_packet_writer.h"
37 #include "net/quic/quic_connection.h" 38 #include "net/quic/quic_connection.h"
38 #include "net/quic/quic_http_utils.h" 39 #include "net/quic/quic_http_utils.h"
39 #include "net/quic/quic_write_blocked_list.h" 40 #include "net/quic/quic_write_blocked_list.h"
40 #include "net/quic/spdy_utils.h" 41 #include "net/quic/spdy_utils.h"
41 #include "net/quic/test_tools/crypto_test_utils.h" 42 #include "net/quic/test_tools/crypto_test_utils.h"
(...skipping 25 matching lines...) Expand all
67 const char kUploadData[] = "Really nifty data!"; 68 const char kUploadData[] = "Really nifty data!";
68 const char kDefaultServerHostName[] = "www.example.org"; 69 const char kDefaultServerHostName[] = "www.example.org";
69 const uint16_t kDefaultServerPort = 80; 70 const uint16_t kDefaultServerPort = 80;
70 71
71 class TestQuicConnection : public QuicConnection { 72 class TestQuicConnection : public QuicConnection {
72 public: 73 public:
73 TestQuicConnection(const QuicVersionVector& versions, 74 TestQuicConnection(const QuicVersionVector& versions,
74 QuicConnectionId connection_id, 75 QuicConnectionId connection_id,
75 IPEndPoint address, 76 IPEndPoint address,
76 QuicChromiumConnectionHelper* helper, 77 QuicChromiumConnectionHelper* helper,
78 QuicChromiumAlarmFactory* alarm_factory,
77 QuicPacketWriter* writer) 79 QuicPacketWriter* writer)
78 : QuicConnection(connection_id, 80 : QuicConnection(connection_id,
79 address, 81 address,
80 helper, 82 helper,
83 alarm_factory,
81 writer, 84 writer,
82 true /* owns_writer */, 85 true /* owns_writer */,
83 Perspective::IS_CLIENT, 86 Perspective::IS_CLIENT,
84 versions) {} 87 versions) {}
85 88
86 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { 89 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) {
87 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); 90 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm);
88 } 91 }
89 }; 92 };
90 93
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 .WillRepeatedly(Return(QuicTime::Delta::Zero())); 214 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
212 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 215 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
213 .WillRepeatedly(Return(kMaxPacketSize)); 216 .WillRepeatedly(Return(kMaxPacketSize));
214 EXPECT_CALL(*send_algorithm_, PacingRate()) 217 EXPECT_CALL(*send_algorithm_, PacingRate())
215 .WillRepeatedly(Return(QuicBandwidth::Zero())); 218 .WillRepeatedly(Return(QuicBandwidth::Zero()));
216 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) 219 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
217 .WillRepeatedly(Return(QuicTime::Delta::Zero())); 220 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
218 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) 221 EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
219 .WillRepeatedly(Return(QuicBandwidth::Zero())); 222 .WillRepeatedly(Return(QuicBandwidth::Zero()));
220 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber()); 223 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber());
221 helper_.reset(new QuicChromiumConnectionHelper(runner_.get(), &clock_, 224 helper_.reset(
222 &random_generator_)); 225 new QuicChromiumConnectionHelper(&clock_, &random_generator_));
223 connection_ = new TestQuicConnection( 226 alarm_factory_.reset(new QuicChromiumAlarmFactory(runner_.get(), &clock_));
224 SupportedVersions(GetParam()), connection_id_, peer_addr_, 227
225 helper_.get(), new QuicChromiumPacketWriter(socket.get())); 228 connection_ =
229 new TestQuicConnection(SupportedVersions(GetParam()), connection_id_,
230 peer_addr_, helper_.get(), alarm_factory_.get(),
231 new QuicChromiumPacketWriter(socket.get()));
226 connection_->set_visitor(&visitor_); 232 connection_->set_visitor(&visitor_);
227 connection_->SetSendAlgorithm(send_algorithm_); 233 connection_->SetSendAlgorithm(send_algorithm_);
228 234
229 // Load a certificate that is valid for *.example.org 235 // Load a certificate that is valid for *.example.org
230 scoped_refptr<X509Certificate> test_cert( 236 scoped_refptr<X509Certificate> test_cert(
231 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem")); 237 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem"));
232 EXPECT_TRUE(test_cert.get()); 238 EXPECT_TRUE(test_cert.get());
233 239
234 verify_details_.cert_verify_result.verified_cert = test_cert; 240 verify_details_.cert_verify_result.verified_cert = test_cert;
235 verify_details_.cert_verify_result.is_issued_by_known_root = true; 241 verify_details_.cert_verify_result.is_issued_by_known_root = true;
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 } 428 }
423 429
424 BoundTestNetLog net_log_; 430 BoundTestNetLog net_log_;
425 bool use_closing_stream_; 431 bool use_closing_stream_;
426 MockSendAlgorithm* send_algorithm_; 432 MockSendAlgorithm* send_algorithm_;
427 scoped_refptr<TestTaskRunner> runner_; 433 scoped_refptr<TestTaskRunner> runner_;
428 std::unique_ptr<MockWrite[]> mock_writes_; 434 std::unique_ptr<MockWrite[]> mock_writes_;
429 MockClock clock_; 435 MockClock clock_;
430 TestQuicConnection* connection_; 436 TestQuicConnection* connection_;
431 std::unique_ptr<QuicChromiumConnectionHelper> helper_; 437 std::unique_ptr<QuicChromiumConnectionHelper> helper_;
438 std::unique_ptr<QuicChromiumAlarmFactory> alarm_factory_;
432 testing::StrictMock<MockConnectionVisitor> visitor_; 439 testing::StrictMock<MockConnectionVisitor> visitor_;
433 std::unique_ptr<QuicHttpStream> stream_; 440 std::unique_ptr<QuicHttpStream> stream_;
434 TransportSecurityState transport_security_state_; 441 TransportSecurityState transport_security_state_;
435 std::unique_ptr<QuicChromiumClientSession> session_; 442 std::unique_ptr<QuicChromiumClientSession> session_;
436 QuicCryptoClientConfig crypto_config_; 443 QuicCryptoClientConfig crypto_config_;
437 TestCompletionCallback callback_; 444 TestCompletionCallback callback_;
438 HttpRequestInfo request_; 445 HttpRequestInfo request_;
439 HttpRequestHeaders headers_; 446 HttpRequestHeaders headers_;
440 HttpResponseInfo response_; 447 HttpResponseInfo response_;
441 scoped_refptr<IOBufferWithSize> read_buffer_; 448 scoped_refptr<IOBufferWithSize> read_buffer_;
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1678 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the 1685 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
1679 // headers and payload. 1686 // headers and payload.
1680 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length), 1687 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length),
1681 promised_stream_->GetTotalSentBytes()); 1688 promised_stream_->GetTotalSentBytes());
1682 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length), 1689 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length),
1683 promised_stream_->GetTotalReceivedBytes()); 1690 promised_stream_->GetTotalReceivedBytes());
1684 } 1691 }
1685 1692
1686 } // namespace test 1693 } // namespace test
1687 } // namespace net 1694 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream_test.cc ('k') | net/quic/quic_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698