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

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

Issue 612323013: QUIC - (no behavior change) s/NULL/nullptr/g in .../quic/... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_http_stream.cc ('k') | net/quic/quic_in_memory_cache.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 <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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 186
187 // Configures the test fixture to use the list of expected writes. 187 // Configures the test fixture to use the list of expected writes.
188 void Initialize() { 188 void Initialize() {
189 mock_writes_.reset(new MockWrite[writes_.size()]); 189 mock_writes_.reset(new MockWrite[writes_.size()]);
190 for (size_t i = 0; i < writes_.size(); i++) { 190 for (size_t i = 0; i < writes_.size(); i++) {
191 mock_writes_[i] = MockWrite(writes_[i].mode, 191 mock_writes_[i] = MockWrite(writes_[i].mode,
192 writes_[i].packet->data(), 192 writes_[i].packet->data(),
193 writes_[i].packet->length()); 193 writes_[i].packet->length());
194 }; 194 };
195 195
196 socket_data_.reset(new StaticSocketDataProvider(NULL, 0, mock_writes_.get(), 196 socket_data_.reset(new StaticSocketDataProvider(
197 writes_.size())); 197 nullptr, 0, mock_writes_.get(), writes_.size()));
198 198
199 MockUDPClientSocket* socket = new MockUDPClientSocket(socket_data_.get(), 199 MockUDPClientSocket* socket = new MockUDPClientSocket(socket_data_.get(),
200 net_log_.net_log()); 200 net_log_.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 receive_algorithm_ = new TestReceiveAlgorithm(); 204 receive_algorithm_ = new TestReceiveAlgorithm();
205 EXPECT_CALL(*receive_algorithm_, RecordIncomingPacket(_, _, _)). 205 EXPECT_CALL(*receive_algorithm_, RecordIncomingPacket(_, _, _)).
206 Times(AnyNumber()); 206 Times(AnyNumber());
207 EXPECT_CALL(*send_algorithm_, 207 EXPECT_CALL(*send_algorithm_,
(...skipping 13 matching lines...) Expand all
221 connection_ = new TestQuicConnection(SupportedVersions(GetParam()), 221 connection_ = new TestQuicConnection(SupportedVersions(GetParam()),
222 connection_id_, peer_addr_, 222 connection_id_, peer_addr_,
223 helper_.get(), writer_factory); 223 helper_.get(), writer_factory);
224 connection_->set_visitor(&visitor_); 224 connection_->set_visitor(&visitor_);
225 connection_->SetSendAlgorithm(send_algorithm_); 225 connection_->SetSendAlgorithm(send_algorithm_);
226 connection_->SetReceiveAlgorithm(receive_algorithm_); 226 connection_->SetReceiveAlgorithm(receive_algorithm_);
227 crypto_config_.SetDefaults(); 227 crypto_config_.SetDefaults();
228 session_.reset( 228 session_.reset(
229 new QuicClientSession(connection_, 229 new QuicClientSession(connection_,
230 scoped_ptr<DatagramClientSocket>(socket), 230 scoped_ptr<DatagramClientSocket>(socket),
231 NULL, 231 nullptr,
232 &transport_security_state_, 232 &transport_security_state_,
233 make_scoped_ptr((QuicServerInfo*)NULL), 233 make_scoped_ptr((QuicServerInfo*)nullptr),
234 DefaultQuicConfig(), 234 DefaultQuicConfig(),
235 base::MessageLoop::current()-> 235 base::MessageLoop::current()->
236 message_loop_proxy().get(), 236 message_loop_proxy().get(),
237 NULL)); 237 nullptr));
238 session_->InitializeSession(QuicServerId(kServerHostname, kServerPort, 238 session_->InitializeSession(QuicServerId(kServerHostname, kServerPort,
239 false, PRIVACY_MODE_DISABLED), 239 false, PRIVACY_MODE_DISABLED),
240 &crypto_config_, 240 &crypto_config_,
241 &crypto_client_stream_factory_); 241 &crypto_client_stream_factory_);
242 session_->GetCryptoStream()->CryptoConnect(); 242 session_->GetCryptoStream()->CryptoConnect();
243 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed()); 243 EXPECT_TRUE(session_->IsCryptoHandshakeConfirmed());
244 stream_.reset(use_closing_stream_ ? 244 stream_.reset(use_closing_stream_ ?
245 new AutoClosingStream(session_->GetWeakPtr()) : 245 new AutoClosingStream(session_->GetWeakPtr()) :
246 new QuicHttpStream(session_->GetWeakPtr())); 246 new QuicHttpStream(session_->GetWeakPtr()));
247 } 247 }
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 MockCryptoClientStreamFactory crypto_client_stream_factory_; 337 MockCryptoClientStreamFactory crypto_client_stream_factory_;
338 scoped_ptr<StaticSocketDataProvider> socket_data_; 338 scoped_ptr<StaticSocketDataProvider> socket_data_;
339 std::vector<PacketToWrite> writes_; 339 std::vector<PacketToWrite> writes_;
340 }; 340 };
341 341
342 INSTANTIATE_TEST_CASE_P(Version, QuicHttpStreamTest, 342 INSTANTIATE_TEST_CASE_P(Version, QuicHttpStreamTest,
343 ::testing::ValuesIn(QuicSupportedVersions())); 343 ::testing::ValuesIn(QuicSupportedVersions()));
344 344
345 TEST_P(QuicHttpStreamTest, RenewStreamForAuth) { 345 TEST_P(QuicHttpStreamTest, RenewStreamForAuth) {
346 Initialize(); 346 Initialize();
347 EXPECT_EQ(NULL, stream_->RenewStreamForAuth()); 347 EXPECT_EQ(nullptr, stream_->RenewStreamForAuth());
348 } 348 }
349 349
350 TEST_P(QuicHttpStreamTest, CanFindEndOfResponse) { 350 TEST_P(QuicHttpStreamTest, CanFindEndOfResponse) {
351 Initialize(); 351 Initialize();
352 EXPECT_TRUE(stream_->CanFindEndOfResponse()); 352 EXPECT_TRUE(stream_->CanFindEndOfResponse());
353 } 353 }
354 354
355 TEST_P(QuicHttpStreamTest, IsConnectionReusable) { 355 TEST_P(QuicHttpStreamTest, IsConnectionReusable) {
356 Initialize(); 356 Initialize();
357 EXPECT_FALSE(stream_->IsConnectionReusable()); 357 EXPECT_FALSE(stream_->IsConnectionReusable());
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 request_.method = "POST"; 592 request_.method = "POST";
593 request_.url = GURL("http://www.google.com/"); 593 request_.url = GURL("http://www.google.com/");
594 request_.upload_data_stream = &upload_data_stream; 594 request_.upload_data_stream = &upload_data_stream;
595 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); 595 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
596 596
597 ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, 597 ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
598 net_log_, callback_.callback())); 598 net_log_, callback_.callback()));
599 ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_, 599 ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_,
600 callback_.callback())); 600 callback_.callback()));
601 601
602 upload_data_stream.AppendChunk(NULL, 0, true); 602 upload_data_stream.AppendChunk(nullptr, 0, true);
603 603
604 ProcessPacket(ConstructAckPacket(1, 0, 0)); 604 ProcessPacket(ConstructAckPacket(1, 0, 0));
605 605
606 // Send the response headers (but not the body). 606 // Send the response headers (but not the body).
607 SetResponse("200 OK", std::string()); 607 SetResponse("200 OK", std::string());
608 ProcessPacket(ConstructResponseHeadersPacket(2, !kFin)); 608 ProcessPacket(ConstructResponseHeadersPacket(2, !kFin));
609 609
610 // Since the headers have already arrived, this should return immediately. 610 // Since the headers have already arrived, this should return immediately.
611 ASSERT_EQ(OK, stream_->ReadResponseHeaders(callback_.callback())); 611 ASSERT_EQ(OK, stream_->ReadResponseHeaders(callback_.callback()));
612 ASSERT_TRUE(response_.headers.get()); 612 ASSERT_TRUE(response_.headers.get());
(...skipping 26 matching lines...) Expand all
639 request_.method = "POST"; 639 request_.method = "POST";
640 request_.url = GURL("http://www.google.com/"); 640 request_.url = GURL("http://www.google.com/");
641 request_.upload_data_stream = &upload_data_stream; 641 request_.upload_data_stream = &upload_data_stream;
642 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback())); 642 ASSERT_EQ(OK, request_.upload_data_stream->Init(CompletionCallback()));
643 643
644 ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY, 644 ASSERT_EQ(OK, stream_->InitializeStream(&request_, DEFAULT_PRIORITY,
645 net_log_, callback_.callback())); 645 net_log_, callback_.callback()));
646 ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_, 646 ASSERT_EQ(ERR_IO_PENDING, stream_->SendRequest(headers_, &response_,
647 callback_.callback())); 647 callback_.callback()));
648 648
649 upload_data_stream.AppendChunk(NULL, 0, true); 649 upload_data_stream.AppendChunk(nullptr, 0, true);
650 650
651 ProcessPacket(ConstructAckPacket(1, 0, 0)); 651 ProcessPacket(ConstructAckPacket(1, 0, 0));
652 652
653 // Send the response headers (but not the body). 653 // Send the response headers (but not the body).
654 SetResponse("200 OK", std::string()); 654 SetResponse("200 OK", std::string());
655 ProcessPacket(ConstructResponseHeadersPacket(2, !kFin)); 655 ProcessPacket(ConstructResponseHeadersPacket(2, !kFin));
656 656
657 // Since the headers have already arrived, this should return immediately. 657 // Since the headers have already arrived, this should return immediately.
658 ASSERT_EQ(OK, stream_->ReadResponseHeaders(callback_.callback())); 658 ASSERT_EQ(OK, stream_->ReadResponseHeaders(callback_.callback()));
659 ASSERT_TRUE(response_.headers.get()); 659 ASSERT_TRUE(response_.headers.get());
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
759 759
760 // Check that priority is highest. 760 // Check that priority is highest.
761 QuicReliableClientStream* reliable_stream = 761 QuicReliableClientStream* reliable_stream =
762 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get()); 762 QuicHttpStreamPeer::GetQuicReliableClientStream(stream_.get());
763 DCHECK(reliable_stream); 763 DCHECK(reliable_stream);
764 QuicReliableClientStream::Delegate* delegate = reliable_stream->GetDelegate(); 764 QuicReliableClientStream::Delegate* delegate = reliable_stream->GetDelegate();
765 DCHECK(delegate); 765 DCHECK(delegate);
766 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 766 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
767 reliable_stream->EffectivePriority()); 767 reliable_stream->EffectivePriority());
768 768
769 // Set Delegate to NULL and make sure EffectivePriority returns highest 769 // Set Delegate to nullptr and make sure EffectivePriority returns highest
770 // priority. 770 // priority.
771 reliable_stream->SetDelegate(NULL); 771 reliable_stream->SetDelegate(nullptr);
772 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority, 772 DCHECK_EQ(QuicWriteBlockedList::kHighestPriority,
773 reliable_stream->EffectivePriority()); 773 reliable_stream->EffectivePriority());
774 reliable_stream->SetDelegate(delegate); 774 reliable_stream->SetDelegate(delegate);
775 } 775 }
776 776
777 } // namespace test 777 } // namespace test
778 } // namespace net 778 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream.cc ('k') | net/quic/quic_in_memory_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698