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

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

Issue 1825423003: Use scoped_ptr for MockUDPClientSocket in quic_http_stream_test.cc and bidirectional_stream_quic_im… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@log
Patch Set: Created 4 years, 9 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/bidirectional_stream_quic_impl_unittest.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 "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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].rv, i); 189 mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].rv, i);
190 } else { 190 } else {
191 mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].packet->data(), 191 mock_writes_[i] = MockWrite(writes_[i].mode, writes_[i].packet->data(),
192 writes_[i].packet->length()); 192 writes_[i].packet->length());
193 } 193 }
194 }; 194 };
195 195
196 socket_data_.reset(new StaticSocketDataProvider( 196 socket_data_.reset(new StaticSocketDataProvider(
197 nullptr, 0, mock_writes_.get(), writes_.size())); 197 nullptr, 0, mock_writes_.get(), writes_.size()));
198 198
199 MockUDPClientSocket* socket = 199 scoped_ptr<MockUDPClientSocket> socket(new MockUDPClientSocket(
200 new MockUDPClientSocket(socket_data_.get(), net_log_.bound().net_log()); 200 socket_data_.get(), net_log_.bound().net_log()));
201 socket->Connect(peer_addr_); 201 socket->Connect(peer_addr_);
202 runner_ = new TestTaskRunner(&clock_); 202 runner_ = new TestTaskRunner(&clock_);
203 send_algorithm_ = new MockSendAlgorithm(); 203 send_algorithm_ = new MockSendAlgorithm();
204 EXPECT_CALL(*send_algorithm_, InRecovery()).WillRepeatedly(Return(false)); 204 EXPECT_CALL(*send_algorithm_, InRecovery()).WillRepeatedly(Return(false));
205 EXPECT_CALL(*send_algorithm_, InSlowStart()).WillRepeatedly(Return(false)); 205 EXPECT_CALL(*send_algorithm_, InSlowStart()).WillRepeatedly(Return(false));
206 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _)) 206 EXPECT_CALL(*send_algorithm_, OnPacketSent(_, _, _, _, _))
207 .WillRepeatedly(Return(true)); 207 .WillRepeatedly(Return(true));
208 EXPECT_CALL(*send_algorithm_, RetransmissionDelay()) 208 EXPECT_CALL(*send_algorithm_, RetransmissionDelay())
209 .WillRepeatedly(Return(QuicTime::Delta::Zero())); 209 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
210 EXPECT_CALL(*send_algorithm_, GetCongestionWindow()) 210 EXPECT_CALL(*send_algorithm_, GetCongestionWindow())
211 .WillRepeatedly(Return(kMaxPacketSize)); 211 .WillRepeatedly(Return(kMaxPacketSize));
212 EXPECT_CALL(*send_algorithm_, PacingRate()) 212 EXPECT_CALL(*send_algorithm_, PacingRate())
213 .WillRepeatedly(Return(QuicBandwidth::Zero())); 213 .WillRepeatedly(Return(QuicBandwidth::Zero()));
214 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _)) 214 EXPECT_CALL(*send_algorithm_, TimeUntilSend(_, _))
215 .WillRepeatedly(Return(QuicTime::Delta::Zero())); 215 .WillRepeatedly(Return(QuicTime::Delta::Zero()));
216 EXPECT_CALL(*send_algorithm_, BandwidthEstimate()) 216 EXPECT_CALL(*send_algorithm_, BandwidthEstimate())
217 .WillRepeatedly(Return(QuicBandwidth::Zero())); 217 .WillRepeatedly(Return(QuicBandwidth::Zero()));
218 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber()); 218 EXPECT_CALL(*send_algorithm_, SetFromConfig(_, _)).Times(AnyNumber());
219 helper_.reset(new QuicChromiumConnectionHelper(runner_.get(), &clock_, 219 helper_.reset(new QuicChromiumConnectionHelper(runner_.get(), &clock_,
220 &random_generator_)); 220 &random_generator_));
221 connection_ = new TestQuicConnection( 221 connection_ = new TestQuicConnection(
222 SupportedVersions(GetParam()), connection_id_, peer_addr_, 222 SupportedVersions(GetParam()), connection_id_, peer_addr_,
223 helper_.get(), new QuicChromiumPacketWriter(socket)); 223 helper_.get(), new QuicChromiumPacketWriter(socket.get()));
224 connection_->set_visitor(&visitor_); 224 connection_->set_visitor(&visitor_);
225 connection_->SetSendAlgorithm(send_algorithm_); 225 connection_->SetSendAlgorithm(send_algorithm_);
226 226
227 // Load a certificate that is valid for *.example.org 227 // Load a certificate that is valid for *.example.org
228 scoped_refptr<X509Certificate> test_cert( 228 scoped_refptr<X509Certificate> test_cert(
229 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem")); 229 ImportCertFromFile(GetTestCertsDirectory(), "wildcard.pem"));
230 EXPECT_TRUE(test_cert.get()); 230 EXPECT_TRUE(test_cert.get());
231 231
232 verify_details_.cert_verify_result.verified_cert = test_cert; 232 verify_details_.cert_verify_result.verified_cert = test_cert;
233 verify_details_.cert_verify_result.is_issued_by_known_root = true; 233 verify_details_.cert_verify_result.is_issued_by_known_root = true;
234 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details_); 234 crypto_client_stream_factory_.AddProofVerifyDetails(&verify_details_);
235 235
236 session_.reset(new QuicChromiumClientSession( 236 session_.reset(new QuicChromiumClientSession(
237 connection_, scoped_ptr<DatagramClientSocket>(socket), 237 connection_, std::move(socket),
238 /*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_, 238 /*stream_factory=*/nullptr, &crypto_client_stream_factory_, &clock_,
239 &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr), 239 &transport_security_state_, make_scoped_ptr((QuicServerInfo*)nullptr),
240 QuicServerId(kDefaultServerHostName, kDefaultServerPort, 240 QuicServerId(kDefaultServerHostName, kDefaultServerPort,
241 PRIVACY_MODE_DISABLED), 241 PRIVACY_MODE_DISABLED),
242 kQuicYieldAfterPacketsRead, 242 kQuicYieldAfterPacketsRead,
243 QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds), 243 QuicTime::Delta::FromMilliseconds(kQuicYieldAfterDurationMilliseconds),
244 /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_, 244 /*cert_verify_flags=*/0, DefaultQuicConfig(), &crypto_config_,
245 "CONNECTION_UNKNOWN", base::TimeTicks::Now(), &push_promise_index_, 245 "CONNECTION_UNKNOWN", base::TimeTicks::Now(), &push_promise_index_,
246 base::ThreadTaskRunnerHandle::Get().get(), 246 base::ThreadTaskRunnerHandle::Get().get(),
247 /*socket_performance_watcher=*/nullptr, net_log_.bound().net_log())); 247 /*socket_performance_watcher=*/nullptr, net_log_.bound().net_log()));
(...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1675 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the 1675 // QuicHttpStream::GetTotalSent/ReceivedBytes currently only includes the
1676 // headers and payload. 1676 // headers and payload.
1677 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length), 1677 EXPECT_EQ(static_cast<int64_t>(spdy_request_header_frame_length),
1678 promised_stream_->GetTotalSentBytes()); 1678 promised_stream_->GetTotalSentBytes());
1679 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length), 1679 EXPECT_EQ(static_cast<int64_t>(spdy_response_header_frame_length),
1680 promised_stream_->GetTotalReceivedBytes()); 1680 promised_stream_->GetTotalReceivedBytes());
1681 } 1681 }
1682 1682
1683 } // namespace test 1683 } // namespace test
1684 } // namespace net 1684 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/bidirectional_stream_quic_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698