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

Side by Side Diff: net/quic/quic_headers_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_framer_test.cc ('k') | net/quic/quic_http_stream.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_headers_stream.h" 5 #include "net/quic/quic_headers_stream.h"
6 6
7 #include "net/quic/quic_utils.h" 7 #include "net/quic/quic_utils.h"
8 #include "net/quic/spdy_utils.h" 8 #include "net/quic/spdy_utils.h"
9 #include "net/quic/test_tools/quic_connection_peer.h" 9 #include "net/quic/test_tools/quic_connection_peer.h"
10 #include "net/quic/test_tools/quic_session_peer.h" 10 #include "net/quic/test_tools/quic_session_peer.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 : connection_(new StrictMock<MockConnection>(is_server(), GetVersions())), 83 : connection_(new StrictMock<MockConnection>(is_server(), GetVersions())),
84 session_(connection_), 84 session_(connection_),
85 headers_stream_(QuicSessionPeer::GetHeadersStream(&session_)), 85 headers_stream_(QuicSessionPeer::GetHeadersStream(&session_)),
86 body_("hello world"), 86 body_("hello world"),
87 framer_(SPDY3) { 87 framer_(SPDY3) {
88 headers_[":version"] = "HTTP/1.1"; 88 headers_[":version"] = "HTTP/1.1";
89 headers_[":status"] = "200 Ok"; 89 headers_[":status"] = "200 Ok";
90 headers_["content-length"] = "11"; 90 headers_["content-length"] = "11";
91 framer_.set_visitor(&visitor_); 91 framer_.set_visitor(&visitor_);
92 EXPECT_EQ(QuicVersionMax(), session_.connection()->version()); 92 EXPECT_EQ(QuicVersionMax(), session_.connection()->version());
93 EXPECT_TRUE(headers_stream_ != NULL); 93 EXPECT_TRUE(headers_stream_ != nullptr);
94 } 94 }
95 95
96 QuicConsumedData SaveIov(const IOVector& data) { 96 QuicConsumedData SaveIov(const IOVector& data) {
97 const iovec* iov = data.iovec(); 97 const iovec* iov = data.iovec();
98 int count = data.Capacity(); 98 int count = data.Capacity();
99 for (int i = 0 ; i < count; ++i) { 99 for (int i = 0 ; i < count; ++i) {
100 saved_data_.append(static_cast<char*>(iov[i].iov_base), iov[i].iov_len); 100 saved_data_.append(static_cast<char*>(iov[i].iov_base), iov[i].iov_len);
101 } 101 }
102 return QuicConsumedData(saved_data_.length(), false); 102 return QuicConsumedData(saved_data_.length(), false);
103 } 103 }
(...skipping 16 matching lines...) Expand all
120 void WriteHeadersAndExpectSynReply(QuicStreamId stream_id, 120 void WriteHeadersAndExpectSynReply(QuicStreamId stream_id,
121 bool fin) { 121 bool fin) {
122 WriteHeadersAndCheckData(stream_id, fin, 0, SYN_REPLY); 122 WriteHeadersAndCheckData(stream_id, fin, 0, SYN_REPLY);
123 } 123 }
124 124
125 void WriteHeadersAndCheckData(QuicStreamId stream_id, 125 void WriteHeadersAndCheckData(QuicStreamId stream_id,
126 bool fin, 126 bool fin,
127 QuicPriority priority, 127 QuicPriority priority,
128 SpdyFrameType type) { 128 SpdyFrameType type) {
129 // Write the headers and capture the outgoing data 129 // Write the headers and capture the outgoing data
130 EXPECT_CALL(session_, WritevData(kHeadersStreamId, _, _, false, _, NULL)) 130 EXPECT_CALL(session_, WritevData(kHeadersStreamId, _, _, false, _, nullptr))
131 .WillOnce(WithArgs<1>(Invoke(this, &QuicHeadersStreamTest::SaveIov))); 131 .WillOnce(WithArgs<1>(Invoke(this, &QuicHeadersStreamTest::SaveIov)));
132 headers_stream_->WriteHeaders(stream_id, headers_, fin, NULL); 132 headers_stream_->WriteHeaders(stream_id, headers_, fin, nullptr);
133 133
134 // Parse the outgoing data and check that it matches was was written. 134 // Parse the outgoing data and check that it matches was was written.
135 if (type == SYN_STREAM) { 135 if (type == SYN_STREAM) {
136 EXPECT_CALL(visitor_, OnSynStream(stream_id, kNoAssociatedStream, 0, 136 EXPECT_CALL(visitor_, OnSynStream(stream_id, kNoAssociatedStream, 0,
137 // priority, 137 // priority,
138 fin, kNotUnidirectional)); 138 fin, kNotUnidirectional));
139 } else { 139 } else {
140 EXPECT_CALL(visitor_, OnSynReply(stream_id, fin)); 140 EXPECT_CALL(visitor_, OnSynReply(stream_id, fin));
141 } 141 }
142 EXPECT_CALL(visitor_, OnControlFrameHeaderData(stream_id, _, _)) 142 EXPECT_CALL(visitor_, OnControlFrameHeaderData(stream_id, _, _))
143 .WillRepeatedly(WithArgs<1, 2>( 143 .WillRepeatedly(WithArgs<1, 2>(
144 Invoke(this, &QuicHeadersStreamTest::SaveHeaderData))); 144 Invoke(this, &QuicHeadersStreamTest::SaveHeaderData)));
145 if (fin) { 145 if (fin) {
146 EXPECT_CALL(visitor_, OnStreamFrameData(stream_id, NULL, 0, true)); 146 EXPECT_CALL(visitor_, OnStreamFrameData(stream_id, nullptr, 0, true));
147 } 147 }
148 framer_.ProcessInput(saved_data_.data(), saved_data_.length()); 148 framer_.ProcessInput(saved_data_.data(), saved_data_.length());
149 EXPECT_FALSE(framer_.HasError()) << framer_.error_code(); 149 EXPECT_FALSE(framer_.HasError()) << framer_.error_code();
150 150
151 CheckHeaders(); 151 CheckHeaders();
152 saved_data_.clear(); 152 saved_data_.clear();
153 } 153 }
154 154
155 void CheckHeaders() { 155 void CheckHeaders() {
156 SpdyHeaderBlock headers; 156 SpdyHeaderBlock headers;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 } else { 331 } else {
332 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled()); 332 EXPECT_TRUE(headers_stream_->flow_controller()->IsEnabled());
333 } 333 }
334 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl( 334 EXPECT_FALSE(ReliableQuicStreamPeer::StreamContributesToConnectionFlowControl(
335 headers_stream_)); 335 headers_stream_));
336 } 336 }
337 337
338 } // namespace 338 } // namespace
339 } // namespace test 339 } // namespace test
340 } // namespace net 340 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_http_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698