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

Side by Side Diff: net/quic/quic_session_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_session.cc ('k') | net/quic/quic_spdy_server_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 (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_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 : QuicDataStream(id, session) { 89 : QuicDataStream(id, session) {
90 } 90 }
91 91
92 using ReliableQuicStream::CloseWriteSide; 92 using ReliableQuicStream::CloseWriteSide;
93 93
94 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE { 94 virtual uint32 ProcessData(const char* data, uint32 data_len) OVERRIDE {
95 return data_len; 95 return data_len;
96 } 96 }
97 97
98 void SendBody(const string& data, bool fin) { 98 void SendBody(const string& data, bool fin) {
99 WriteOrBufferData(data, fin, NULL); 99 WriteOrBufferData(data, fin, nullptr);
100 } 100 }
101 101
102 MOCK_METHOD0(OnCanWrite, void()); 102 MOCK_METHOD0(OnCanWrite, void());
103 }; 103 };
104 104
105 // Poor man's functor for use as callback in a mock. 105 // Poor man's functor for use as callback in a mock.
106 class StreamBlocker { 106 class StreamBlocker {
107 public: 107 public:
108 StreamBlocker(QuicSession* session, QuicStreamId stream_id) 108 StreamBlocker(QuicSession* session, QuicStreamId stream_id)
109 : session_(session), 109 : session_(session),
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 return QuicSession::WritevData(id, data, offset, fin, fec_protection, 165 return QuicSession::WritevData(id, data, offset, fin, fec_protection,
166 ack_notifier_delegate); 166 ack_notifier_delegate);
167 } 167 }
168 } 168 }
169 169
170 void set_writev_consumes_all_data(bool val) { 170 void set_writev_consumes_all_data(bool val) {
171 writev_consumes_all_data_ = val; 171 writev_consumes_all_data_ = val;
172 } 172 }
173 173
174 QuicConsumedData SendStreamData(QuicStreamId id) { 174 QuicConsumedData SendStreamData(QuicStreamId id) {
175 return WritevData(id, IOVector(), 0, true, MAY_FEC_PROTECT, NULL); 175 return WritevData(id, IOVector(), 0, true, MAY_FEC_PROTECT, nullptr);
176 } 176 }
177 177
178 using QuicSession::PostProcessAfterData; 178 using QuicSession::PostProcessAfterData;
179 179
180 private: 180 private:
181 StrictMock<TestCryptoStream> crypto_stream_; 181 StrictMock<TestCryptoStream> crypto_stream_;
182 182
183 bool writev_consumes_all_data_; 183 bool writev_consumes_all_data_;
184 }; 184 };
185 185
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 262
263 TEST_P(QuicSessionTest, IsClosedStreamDefault) { 263 TEST_P(QuicSessionTest, IsClosedStreamDefault) {
264 // Ensure that no streams are initially closed. 264 // Ensure that no streams are initially closed.
265 for (int i = kCryptoStreamId; i < 100; i++) { 265 for (int i = kCryptoStreamId; i < 100; i++) {
266 EXPECT_FALSE(session_.IsClosedStream(i)) << "stream id: " << i; 266 EXPECT_FALSE(session_.IsClosedStream(i)) << "stream id: " << i;
267 } 267 }
268 } 268 }
269 269
270 TEST_P(QuicSessionTest, ImplicitlyCreatedStreams) { 270 TEST_P(QuicSessionTest, ImplicitlyCreatedStreams) {
271 ASSERT_TRUE(session_.GetIncomingDataStream(7) != NULL); 271 ASSERT_TRUE(session_.GetIncomingDataStream(7) != nullptr);
272 // Both 3 and 5 should be implicitly created. 272 // Both 3 and 5 should be implicitly created.
273 EXPECT_FALSE(session_.IsClosedStream(3)); 273 EXPECT_FALSE(session_.IsClosedStream(3));
274 EXPECT_FALSE(session_.IsClosedStream(5)); 274 EXPECT_FALSE(session_.IsClosedStream(5));
275 ASSERT_TRUE(session_.GetIncomingDataStream(5) != NULL); 275 ASSERT_TRUE(session_.GetIncomingDataStream(5) != nullptr);
276 ASSERT_TRUE(session_.GetIncomingDataStream(3) != NULL); 276 ASSERT_TRUE(session_.GetIncomingDataStream(3) != nullptr);
277 } 277 }
278 278
279 TEST_P(QuicSessionTest, IsClosedStreamLocallyCreated) { 279 TEST_P(QuicSessionTest, IsClosedStreamLocallyCreated) {
280 TestStream* stream2 = session_.CreateOutgoingDataStream(); 280 TestStream* stream2 = session_.CreateOutgoingDataStream();
281 EXPECT_EQ(2u, stream2->id()); 281 EXPECT_EQ(2u, stream2->id());
282 TestStream* stream4 = session_.CreateOutgoingDataStream(); 282 TestStream* stream4 = session_.CreateOutgoingDataStream();
283 EXPECT_EQ(4u, stream4->id()); 283 EXPECT_EQ(4u, stream4->id());
284 284
285 CheckClosedStreams(); 285 CheckClosedStreams();
286 CloseStream(4); 286 CloseStream(4);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
945 } 945 }
946 946
947 // Called after any new data is received by the session, and triggers the call 947 // Called after any new data is received by the session, and triggers the call
948 // to close the connection. 948 // to close the connection.
949 session_.PostProcessAfterData(); 949 session_.PostProcessAfterData();
950 } 950 }
951 951
952 } // namespace 952 } // namespace
953 } // namespace test 953 } // namespace test
954 } // namespace net 954 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_spdy_server_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698