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

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

Issue 20227003: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Land Recent QUIC changes Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_framer_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 <vector> 7 #include <vector>
8 8
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/test_completion_callback.h" 10 #include "net/base/test_completion_callback.h"
(...skipping 28 matching lines...) Expand all
39 namespace test { 39 namespace test {
40 namespace { 40 namespace {
41 41
42 const char kUploadData[] = "hello world!"; 42 const char kUploadData[] = "hello world!";
43 43
44 class TestQuicConnection : public QuicConnection { 44 class TestQuicConnection : public QuicConnection {
45 public: 45 public:
46 TestQuicConnection(QuicGuid guid, 46 TestQuicConnection(QuicGuid guid,
47 IPEndPoint address, 47 IPEndPoint address,
48 QuicConnectionHelper* helper) 48 QuicConnectionHelper* helper)
49 : QuicConnection(guid, address, helper, false) { 49 : QuicConnection(guid, address, helper, false, QuicVersionMax()) {
50 } 50 }
51 51
52 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) { 52 void SetSendAlgorithm(SendAlgorithmInterface* send_algorithm) {
53 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm); 53 QuicConnectionPeer::SetSendAlgorithm(this, send_algorithm);
54 } 54 }
55 55
56 void SetReceiveAlgorithm(ReceiveAlgorithmInterface* receive_algorithm) { 56 void SetReceiveAlgorithm(ReceiveAlgorithmInterface* receive_algorithm) {
57 QuicConnectionPeer::SetReceiveAlgorithm(this, receive_algorithm); 57 QuicConnectionPeer::SetReceiveAlgorithm(this, receive_algorithm);
58 } 58 }
59 }; 59 };
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 } 111 }
112 IoMode mode; 112 IoMode mode;
113 QuicEncryptedPacket* packet; 113 QuicEncryptedPacket* packet;
114 }; 114 };
115 115
116 QuicHttpStreamTest() 116 QuicHttpStreamTest()
117 : net_log_(BoundNetLog()), 117 : net_log_(BoundNetLog()),
118 use_closing_stream_(false), 118 use_closing_stream_(false),
119 read_buffer_(new IOBufferWithSize(4096)), 119 read_buffer_(new IOBufferWithSize(4096)),
120 guid_(2), 120 guid_(2),
121 framer_(kQuicVersion1, QuicTime::Zero(), false), 121 framer_(QuicVersionMax(), QuicTime::Zero(), false),
122 creator_(guid_, &framer_, &random_, false) { 122 creator_(guid_, &framer_, &random_, false) {
123 IPAddressNumber ip; 123 IPAddressNumber ip;
124 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip)); 124 CHECK(ParseIPLiteralToNumber("192.0.2.33", &ip));
125 peer_addr_ = IPEndPoint(ip, 443); 125 peer_addr_ = IPEndPoint(ip, 443);
126 self_addr_ = IPEndPoint(ip, 8435); 126 self_addr_ = IPEndPoint(ip, 8435);
127 } 127 }
128 128
129 ~QuicHttpStreamTest() { 129 ~QuicHttpStreamTest() {
130 for (size_t i = 0; i < writes_.size(); i++) { 130 for (size_t i = 0; i < writes_.size(); i++) {
131 delete writes_[i].packet; 131 delete writes_[i].packet;
(...skipping 29 matching lines...) Expand all
161 161
162 socket_data_.reset(new StaticSocketDataProvider(NULL, 0, mock_writes_.get(), 162 socket_data_.reset(new StaticSocketDataProvider(NULL, 0, mock_writes_.get(),
163 writes_.size())); 163 writes_.size()));
164 164
165 MockUDPClientSocket* socket = new MockUDPClientSocket(socket_data_.get(), 165 MockUDPClientSocket* socket = new MockUDPClientSocket(socket_data_.get(),
166 net_log_.net_log()); 166 net_log_.net_log());
167 socket->Connect(peer_addr_); 167 socket->Connect(peer_addr_);
168 runner_ = new TestTaskRunner(&clock_); 168 runner_ = new TestTaskRunner(&clock_);
169 send_algorithm_ = new MockSendAlgorithm(); 169 send_algorithm_ = new MockSendAlgorithm();
170 receive_algorithm_ = new TestReceiveAlgorithm(NULL); 170 receive_algorithm_ = new TestReceiveAlgorithm(NULL);
171 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()).WillRepeatedly(
172 testing::Return(QuicTime::Delta::Zero()));
171 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)). 173 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _, _)).
172 WillRepeatedly(testing::Return(QuicTime::Delta::Zero())); 174 WillRepeatedly(testing::Return(QuicTime::Delta::Zero()));
173 helper_ = new QuicConnectionHelper(runner_.get(), &clock_, 175 helper_ = new QuicConnectionHelper(runner_.get(), &clock_,
174 &random_generator_, socket); 176 &random_generator_, socket);
175 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_); 177 connection_ = new TestQuicConnection(guid_, peer_addr_, helper_);
176 connection_->set_visitor(&visitor_); 178 connection_->set_visitor(&visitor_);
177 connection_->SetSendAlgorithm(send_algorithm_); 179 connection_->SetSendAlgorithm(send_algorithm_);
178 connection_->SetReceiveAlgorithm(receive_algorithm_); 180 connection_->SetReceiveAlgorithm(receive_algorithm_);
179 crypto_config_.SetDefaults(); 181 crypto_config_.SetDefaults();
180 session_.reset(new QuicClientSession(connection_, socket, NULL, 182 session_.reset(new QuicClientSession(connection_, socket, NULL,
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 556
555 // In the course of processing this packet, the QuicHttpStream close itself. 557 // In the course of processing this packet, the QuicHttpStream close itself.
556 ProcessPacket(*resp); 558 ProcessPacket(*resp);
557 559
558 EXPECT_TRUE(AtEof()); 560 EXPECT_TRUE(AtEof());
559 } 561 }
560 562
561 } // namespace test 563 } // namespace test
562 564
563 } // namespace net 565 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer_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