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

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

Issue 23597045: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged QuicPriority to RequestPriority changes Created 7 years, 3 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_session.cc ('k') | net/quic/quic_stream_factory_test.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/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 bool IsClosedStream(QuicStreamId id) { 88 bool IsClosedStream(QuicStreamId id) {
89 return QuicSession::IsClosedStream(id); 89 return QuicSession::IsClosedStream(id);
90 } 90 }
91 91
92 ReliableQuicStream* GetIncomingReliableStream(QuicStreamId stream_id) { 92 ReliableQuicStream* GetIncomingReliableStream(QuicStreamId stream_id) {
93 return QuicSession::GetIncomingReliableStream(stream_id); 93 return QuicSession::GetIncomingReliableStream(stream_id);
94 } 94 }
95 95
96 // Helper method for gmock 96 // Helper method for gmock
97 void MarkTwoWriteBlocked() { 97 void MarkTwoWriteBlocked() {
98 this->MarkWriteBlocked(2); 98 this->MarkWriteBlocked(2, 0);
99 } 99 }
100 100
101 TestCryptoStream crypto_stream_; 101 TestCryptoStream crypto_stream_;
102 }; 102 };
103 103
104 class QuicSessionTest : public ::testing::Test { 104 class QuicSessionTest : public ::testing::Test {
105 protected: 105 protected:
106 QuicSessionTest() 106 QuicSessionTest()
107 : guid_(1), 107 : guid_(1),
108 connection_(new MockConnection(guid_, IPEndPoint(), false)), 108 connection_(new MockConnection(guid_, IPEndPoint(), false)),
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 "\0\0\0\4" // length 233 "\0\0\0\4" // length
234 "abcd"; // invalid compressed data 234 "abcd"; // invalid compressed data
235 stream->ProcessRawData(data, arraysize(data)); 235 stream->ProcessRawData(data, arraysize(data));
236 } 236 }
237 237
238 TEST_F(QuicSessionTest, OnCanWrite) { 238 TEST_F(QuicSessionTest, OnCanWrite) {
239 TestStream* stream2 = session_.CreateOutgoingReliableStream(); 239 TestStream* stream2 = session_.CreateOutgoingReliableStream();
240 TestStream* stream4 = session_.CreateOutgoingReliableStream(); 240 TestStream* stream4 = session_.CreateOutgoingReliableStream();
241 TestStream* stream6 = session_.CreateOutgoingReliableStream(); 241 TestStream* stream6 = session_.CreateOutgoingReliableStream();
242 242
243 session_.MarkWriteBlocked(2); 243 session_.MarkWriteBlocked(2, 0);
244 session_.MarkWriteBlocked(6); 244 session_.MarkWriteBlocked(6, 0);
245 session_.MarkWriteBlocked(4); 245 session_.MarkWriteBlocked(4, 0);
246 246
247 InSequence s; 247 InSequence s;
248 EXPECT_CALL(*stream2, OnCanWrite()).WillOnce( 248 EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(
249 // Reregister, to test the loop limit. 249 // Reregister, to test the loop limit.
250 testing::InvokeWithoutArgs(&session_, &TestSession::MarkTwoWriteBlocked)); 250 testing::InvokeWithoutArgs(&session_, &TestSession::MarkTwoWriteBlocked));
251 EXPECT_CALL(*stream6, OnCanWrite()); 251 EXPECT_CALL(*stream6, OnCanWrite());
252 EXPECT_CALL(*stream4, OnCanWrite()); 252 EXPECT_CALL(*stream4, OnCanWrite());
253 253
254 EXPECT_FALSE(session_.OnCanWrite()); 254 EXPECT_FALSE(session_.OnCanWrite());
255 } 255 }
256 256
257 TEST_F(QuicSessionTest, OnCanWriteWithClosedStream) { 257 TEST_F(QuicSessionTest, OnCanWriteWithClosedStream) {
258 TestStream* stream2 = session_.CreateOutgoingReliableStream(); 258 TestStream* stream2 = session_.CreateOutgoingReliableStream();
259 TestStream* stream4 = session_.CreateOutgoingReliableStream(); 259 TestStream* stream4 = session_.CreateOutgoingReliableStream();
260 session_.CreateOutgoingReliableStream(); // stream 6 260 session_.CreateOutgoingReliableStream(); // stream 6
261 261
262 session_.MarkWriteBlocked(2); 262 session_.MarkWriteBlocked(2, 0);
263 session_.MarkWriteBlocked(6); 263 session_.MarkWriteBlocked(6, 0);
264 session_.MarkWriteBlocked(4); 264 session_.MarkWriteBlocked(4, 0);
265 CloseStream(6); 265 CloseStream(6);
266 266
267 InSequence s; 267 InSequence s;
268 EXPECT_CALL(*stream2, OnCanWrite()); 268 EXPECT_CALL(*stream2, OnCanWrite());
269 EXPECT_CALL(*stream4, OnCanWrite()); 269 EXPECT_CALL(*stream4, OnCanWrite());
270 EXPECT_TRUE(session_.OnCanWrite()); 270 EXPECT_TRUE(session_.OnCanWrite());
271 } 271 }
272 272
273 // Regression test for http://crbug.com/248737 273 // Regression test for http://crbug.com/248737
274 TEST_F(QuicSessionTest, OutOfOrderHeaders) { 274 TEST_F(QuicSessionTest, OutOfOrderHeaders) {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 EXPECT_EQ(1u, session.GetNumOpenStreams()); 383 EXPECT_EQ(1u, session.GetNumOpenStreams());
384 384
385 connection->CloseConnection(QUIC_CONNECTION_TIMED_OUT, false); 385 connection->CloseConnection(QUIC_CONNECTION_TIMED_OUT, false);
386 386
387 EXPECT_EQ(0u, session.GetNumOpenStreams()); 387 EXPECT_EQ(0u, session.GetNumOpenStreams());
388 } 388 }
389 389
390 } // namespace 390 } // namespace
391 } // namespace test 391 } // namespace test
392 } // namespace net 392 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_stream_factory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698