OLD | NEW |
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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 namespace net { | 37 namespace net { |
38 namespace test { | 38 namespace test { |
39 namespace { | 39 namespace { |
40 | 40 |
41 const QuicPriority kHighestPriority = 0; | 41 const QuicPriority kHighestPriority = 0; |
42 const QuicPriority kSomeMiddlePriority = 3; | 42 const QuicPriority kSomeMiddlePriority = 3; |
43 | 43 |
44 class TestCryptoStream : public QuicCryptoStream { | 44 class TestCryptoStream : public QuicCryptoStream { |
45 public: | 45 public: |
46 explicit TestCryptoStream(QuicSession* session) | 46 explicit TestCryptoStream(QuicSession* session) : QuicCryptoStream(session) {} |
47 : QuicCryptoStream(session) { | |
48 } | |
49 | 47 |
50 virtual void OnHandshakeMessage( | 48 virtual void OnHandshakeMessage( |
51 const CryptoHandshakeMessage& message) OVERRIDE { | 49 const CryptoHandshakeMessage& message) OVERRIDE { |
52 encryption_established_ = true; | 50 encryption_established_ = true; |
53 handshake_confirmed_ = true; | 51 handshake_confirmed_ = true; |
54 CryptoHandshakeMessage msg; | 52 CryptoHandshakeMessage msg; |
55 string error_details; | 53 string error_details; |
56 session()->config()->SetInitialFlowControlWindowToSend( | 54 session()->config()->SetInitialFlowControlWindowToSend( |
57 kInitialFlowControlWindowForTest); | 55 kInitialFlowControlWindowForTest); |
58 session()->config()->ToHandshakeMessage(&msg); | 56 session()->config()->ToHandshakeMessage(&msg); |
59 const QuicErrorCode error = session()->config()->ProcessPeerHello( | 57 const QuicErrorCode error = |
60 msg, CLIENT, &error_details); | 58 session()->config()->ProcessPeerHello(msg, CLIENT, &error_details); |
61 EXPECT_EQ(QUIC_NO_ERROR, error); | 59 EXPECT_EQ(QUIC_NO_ERROR, error); |
62 session()->OnConfigNegotiated(); | 60 session()->OnConfigNegotiated(); |
63 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); | 61 session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED); |
64 } | 62 } |
65 | 63 |
66 MOCK_METHOD0(OnCanWrite, void()); | 64 MOCK_METHOD0(OnCanWrite, void()); |
67 }; | 65 }; |
68 | 66 |
69 class TestStream : public QuicDataStream { | 67 class TestStream : public QuicDataStream { |
70 public: | 68 public: |
71 TestStream(QuicStreamId id, QuicSession* session) | 69 TestStream(QuicStreamId id, QuicSession* session) |
72 : QuicDataStream(id, session) { | 70 : QuicDataStream(id, session) {} |
73 } | |
74 | 71 |
75 using ReliableQuicStream::CloseWriteSide; | 72 using ReliableQuicStream::CloseWriteSide; |
76 | 73 |
77 virtual uint32 ProcessData(const char* data, uint32 data_len) { | 74 virtual uint32 ProcessData(const char* data, uint32 data_len) { |
78 return data_len; | 75 return data_len; |
79 } | 76 } |
80 | 77 |
81 void SendBody(const string& data, bool fin) { | 78 void SendBody(const string& data, bool fin) { |
82 WriteOrBufferData(data, fin, NULL); | 79 WriteOrBufferData(data, fin, NULL); |
83 } | 80 } |
84 | 81 |
85 MOCK_METHOD0(OnCanWrite, void()); | 82 MOCK_METHOD0(OnCanWrite, void()); |
86 }; | 83 }; |
87 | 84 |
88 // Poor man's functor for use as callback in a mock. | 85 // Poor man's functor for use as callback in a mock. |
89 class StreamBlocker { | 86 class StreamBlocker { |
90 public: | 87 public: |
91 StreamBlocker(QuicSession* session, QuicStreamId stream_id) | 88 StreamBlocker(QuicSession* session, QuicStreamId stream_id) |
92 : session_(session), | 89 : session_(session), stream_id_(stream_id) {} |
93 stream_id_(stream_id) { | |
94 } | |
95 | 90 |
96 void MarkWriteBlocked() { | 91 void MarkWriteBlocked() { |
97 session_->MarkWriteBlocked(stream_id_, kSomeMiddlePriority); | 92 session_->MarkWriteBlocked(stream_id_, kSomeMiddlePriority); |
98 } | 93 } |
99 | 94 |
100 private: | 95 private: |
101 QuicSession* const session_; | 96 QuicSession* const session_; |
102 const QuicStreamId stream_id_; | 97 const QuicStreamId stream_id_; |
103 }; | 98 }; |
104 | 99 |
105 class TestSession : public QuicSession { | 100 class TestSession : public QuicSession { |
106 public: | 101 public: |
107 explicit TestSession(QuicConnection* connection) | 102 explicit TestSession(QuicConnection* connection) |
108 : QuicSession(connection, DefaultQuicConfig()), | 103 : QuicSession(connection, DefaultQuicConfig()), |
109 crypto_stream_(this), | 104 crypto_stream_(this), |
110 writev_consumes_all_data_(false) { | 105 writev_consumes_all_data_(false) {} |
111 } | |
112 | 106 |
113 virtual TestCryptoStream* GetCryptoStream() OVERRIDE { | 107 virtual TestCryptoStream* GetCryptoStream() OVERRIDE { |
114 return &crypto_stream_; | 108 return &crypto_stream_; |
115 } | 109 } |
116 | 110 |
117 virtual TestStream* CreateOutgoingDataStream() OVERRIDE { | 111 virtual TestStream* CreateOutgoingDataStream() OVERRIDE { |
118 TestStream* stream = new TestStream(GetNextStreamId(), this); | 112 TestStream* stream = new TestStream(GetNextStreamId(), this); |
119 ActivateStream(stream); | 113 ActivateStream(stream); |
120 return stream; | 114 return stream; |
121 } | 115 } |
(...skipping 13 matching lines...) Expand all Loading... |
135 virtual QuicConsumedData WritevData( | 129 virtual QuicConsumedData WritevData( |
136 QuicStreamId id, | 130 QuicStreamId id, |
137 const IOVector& data, | 131 const IOVector& data, |
138 QuicStreamOffset offset, | 132 QuicStreamOffset offset, |
139 bool fin, | 133 bool fin, |
140 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) OVERRIDE { | 134 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) OVERRIDE { |
141 // Always consumes everything. | 135 // Always consumes everything. |
142 if (writev_consumes_all_data_) { | 136 if (writev_consumes_all_data_) { |
143 return QuicConsumedData(data.TotalBufferSize(), fin); | 137 return QuicConsumedData(data.TotalBufferSize(), fin); |
144 } else { | 138 } else { |
145 return QuicSession::WritevData(id, data, offset, fin, | 139 return QuicSession::WritevData( |
146 ack_notifier_delegate); | 140 id, data, offset, fin, ack_notifier_delegate); |
147 } | 141 } |
148 } | 142 } |
149 | 143 |
150 void set_writev_consumes_all_data(bool val) { | 144 void set_writev_consumes_all_data(bool val) { |
151 writev_consumes_all_data_ = val; | 145 writev_consumes_all_data_ = val; |
152 } | 146 } |
153 | 147 |
154 QuicConsumedData SendStreamData() { | 148 QuicConsumedData SendStreamData() { |
155 return WritevData(5, IOVector(), 0, true, NULL); | 149 return WritevData(5, IOVector(), 0, true, NULL); |
156 } | 150 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 } | 205 } |
212 | 206 |
213 QuicVersion version() const { return connection_->version(); } | 207 QuicVersion version() const { return connection_->version(); } |
214 | 208 |
215 MockConnection* connection_; | 209 MockConnection* connection_; |
216 TestSession session_; | 210 TestSession session_; |
217 set<QuicStreamId> closed_streams_; | 211 set<QuicStreamId> closed_streams_; |
218 SpdyHeaderBlock headers_; | 212 SpdyHeaderBlock headers_; |
219 }; | 213 }; |
220 | 214 |
221 INSTANTIATE_TEST_CASE_P(Tests, QuicSessionTest, | 215 INSTANTIATE_TEST_CASE_P(Tests, |
| 216 QuicSessionTest, |
222 ::testing::ValuesIn(QuicSupportedVersions())); | 217 ::testing::ValuesIn(QuicSupportedVersions())); |
223 | 218 |
224 TEST_P(QuicSessionTest, PeerAddress) { | 219 TEST_P(QuicSessionTest, PeerAddress) { |
225 EXPECT_EQ(IPEndPoint(Loopback4(), kTestPort), session_.peer_address()); | 220 EXPECT_EQ(IPEndPoint(Loopback4(), kTestPort), session_.peer_address()); |
226 } | 221 } |
227 | 222 |
228 TEST_P(QuicSessionTest, IsCryptoHandshakeConfirmed) { | 223 TEST_P(QuicSessionTest, IsCryptoHandshakeConfirmed) { |
229 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); | 224 EXPECT_FALSE(session_.IsCryptoHandshakeConfirmed()); |
230 CryptoHandshakeMessage message; | 225 CryptoHandshakeMessage message; |
231 session_.GetCryptoStream()->OnHandshakeMessage(message); | 226 session_.GetCryptoStream()->OnHandshakeMessage(message); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 TEST_P(QuicSessionTest, StreamIdTooLarge) { | 280 TEST_P(QuicSessionTest, StreamIdTooLarge) { |
286 QuicStreamId stream_id = 5; | 281 QuicStreamId stream_id = 5; |
287 session_.GetIncomingDataStream(stream_id); | 282 session_.GetIncomingDataStream(stream_id); |
288 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); | 283 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_INVALID_STREAM_ID)); |
289 session_.GetIncomingDataStream(stream_id + kMaxStreamIdDelta + 2); | 284 session_.GetIncomingDataStream(stream_id + kMaxStreamIdDelta + 2); |
290 } | 285 } |
291 | 286 |
292 TEST_P(QuicSessionTest, DecompressionError) { | 287 TEST_P(QuicSessionTest, DecompressionError) { |
293 QuicHeadersStream* stream = QuicSessionPeer::GetHeadersStream(&session_); | 288 QuicHeadersStream* stream = QuicSessionPeer::GetHeadersStream(&session_); |
294 const unsigned char data[] = { | 289 const unsigned char data[] = { |
295 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame | 290 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame |
296 0x00, 0x00, 0x00, 0x25, // flags/length | 291 0x00, 0x00, 0x00, 0x25, // flags/length |
297 0x00, 0x00, 0x00, 0x05, // stream id | 292 0x00, 0x00, 0x00, 0x05, // stream id |
298 0x00, 0x00, 0x00, 0x00, // associated stream id | 293 0x00, 0x00, 0x00, 0x00, // associated stream id |
299 0x00, 0x00, | 294 0x00, 0x00, 'a', 'b', |
300 'a', 'b', 'c', 'd' // invalid compressed data | 295 'c', 'd' // invalid compressed data |
301 }; | 296 }; |
302 EXPECT_CALL(*connection_, | 297 EXPECT_CALL(*connection_, |
303 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, | 298 SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA, |
304 "SPDY framing error.")); | 299 "SPDY framing error.")); |
305 stream->ProcessRawData(reinterpret_cast<const char*>(data), | 300 stream->ProcessRawData(reinterpret_cast<const char*>(data), arraysize(data)); |
306 arraysize(data)); | |
307 } | 301 } |
308 | 302 |
309 TEST_P(QuicSessionTest, DebugDFatalIfMarkingClosedStreamWriteBlocked) { | 303 TEST_P(QuicSessionTest, DebugDFatalIfMarkingClosedStreamWriteBlocked) { |
310 TestStream* stream2 = session_.CreateOutgoingDataStream(); | 304 TestStream* stream2 = session_.CreateOutgoingDataStream(); |
311 // Close the stream. | 305 // Close the stream. |
312 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); | 306 stream2->Reset(QUIC_BAD_APPLICATION_PAYLOAD); |
313 // TODO(rtenneti): enable when chromium supports EXPECT_DEBUG_DFATAL. | 307 // TODO(rtenneti): enable when chromium supports EXPECT_DEBUG_DFATAL. |
314 /* | 308 /* |
315 QuicStreamId kClosedStreamId = stream2->id(); | 309 QuicStreamId kClosedStreamId = stream2->id(); |
316 EXPECT_DEBUG_DFATAL( | 310 EXPECT_DEBUG_DFATAL( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); | 352 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); |
359 | 353 |
360 TestStream* stream2 = session_.CreateOutgoingDataStream(); | 354 TestStream* stream2 = session_.CreateOutgoingDataStream(); |
361 TestStream* stream4 = session_.CreateOutgoingDataStream(); | 355 TestStream* stream4 = session_.CreateOutgoingDataStream(); |
362 TestStream* stream6 = session_.CreateOutgoingDataStream(); | 356 TestStream* stream6 = session_.CreateOutgoingDataStream(); |
363 | 357 |
364 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); | 358 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); |
365 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); | 359 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); |
366 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); | 360 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); |
367 | 361 |
368 | 362 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
369 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillRepeatedly( | 363 .WillRepeatedly(Return(QuicTime::Delta::Zero())); |
370 Return(QuicTime::Delta::Zero())); | 364 EXPECT_CALL(*send_algorithm, GetCongestionWindow()) |
371 EXPECT_CALL(*send_algorithm, GetCongestionWindow()).WillOnce( | 365 .WillOnce(Return(kMaxPacketSize * 10)); |
372 Return(kMaxPacketSize * 10)); | 366 EXPECT_CALL(*stream2, OnCanWrite()).WillOnce( |
373 EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(IgnoreResult( | 367 IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); |
374 InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); | 368 EXPECT_CALL(*stream6, OnCanWrite()).WillOnce( |
375 EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(IgnoreResult( | 369 IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); |
376 InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); | 370 EXPECT_CALL(*stream4, OnCanWrite()).WillOnce( |
377 EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(IgnoreResult( | 371 IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); |
378 InvokeWithoutArgs(&session_, &TestSession::SendStreamData))); | 372 MockPacketWriter* writer = static_cast<MockPacketWriter*>( |
379 MockPacketWriter* writer = | 373 QuicConnectionPeer::GetWriter(session_.connection())); |
380 static_cast<MockPacketWriter*>( | 374 EXPECT_CALL(*writer, WritePacket(_, _, _, _)) |
381 QuicConnectionPeer::GetWriter(session_.connection())); | 375 .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0))); |
382 EXPECT_CALL(*writer, WritePacket(_, _, _, _)).WillOnce( | |
383 Return(WriteResult(WRITE_STATUS_OK, 0))); | |
384 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _)); | 376 EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _)); |
385 session_.OnCanWrite(); | 377 session_.OnCanWrite(); |
386 EXPECT_FALSE(session_.HasPendingWrites()); | 378 EXPECT_FALSE(session_.HasPendingWrites()); |
387 } | 379 } |
388 | 380 |
389 TEST_P(QuicSessionTest, OnCanWriteCongestionControlBlocks) { | 381 TEST_P(QuicSessionTest, OnCanWriteCongestionControlBlocks) { |
390 InSequence s; | 382 InSequence s; |
391 | 383 |
392 // Drive congestion control manually. | 384 // Drive congestion control manually. |
393 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; | 385 MockSendAlgorithm* send_algorithm = new StrictMock<MockSendAlgorithm>; |
394 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); | 386 QuicConnectionPeer::SetSendAlgorithm(session_.connection(), send_algorithm); |
395 | 387 |
396 TestStream* stream2 = session_.CreateOutgoingDataStream(); | 388 TestStream* stream2 = session_.CreateOutgoingDataStream(); |
397 TestStream* stream4 = session_.CreateOutgoingDataStream(); | 389 TestStream* stream4 = session_.CreateOutgoingDataStream(); |
398 TestStream* stream6 = session_.CreateOutgoingDataStream(); | 390 TestStream* stream6 = session_.CreateOutgoingDataStream(); |
399 | 391 |
400 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); | 392 session_.MarkWriteBlocked(stream2->id(), kSomeMiddlePriority); |
401 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); | 393 session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority); |
402 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); | 394 session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority); |
403 | 395 |
404 StreamBlocker stream2_blocker(&session_, stream2->id()); | 396 StreamBlocker stream2_blocker(&session_, stream2->id()); |
405 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return( | 397 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
406 QuicTime::Delta::Zero())); | 398 .WillOnce(Return(QuicTime::Delta::Zero())); |
407 EXPECT_CALL(*stream2, OnCanWrite()); | 399 EXPECT_CALL(*stream2, OnCanWrite()); |
408 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return( | 400 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
409 QuicTime::Delta::Zero())); | 401 .WillOnce(Return(QuicTime::Delta::Zero())); |
410 EXPECT_CALL(*stream6, OnCanWrite()); | 402 EXPECT_CALL(*stream6, OnCanWrite()); |
411 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return( | 403 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
412 QuicTime::Delta::Infinite())); | 404 .WillOnce(Return(QuicTime::Delta::Infinite())); |
413 // stream4->OnCanWrite is not called. | 405 // stream4->OnCanWrite is not called. |
414 | 406 |
415 session_.OnCanWrite(); | 407 session_.OnCanWrite(); |
416 EXPECT_TRUE(session_.HasPendingWrites()); | 408 EXPECT_TRUE(session_.HasPendingWrites()); |
417 | 409 |
418 // Still congestion-control blocked. | 410 // Still congestion-control blocked. |
419 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return( | 411 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
420 QuicTime::Delta::Infinite())); | 412 .WillOnce(Return(QuicTime::Delta::Infinite())); |
421 session_.OnCanWrite(); | 413 session_.OnCanWrite(); |
422 EXPECT_TRUE(session_.HasPendingWrites()); | 414 EXPECT_TRUE(session_.HasPendingWrites()); |
423 | 415 |
424 // stream4->OnCanWrite is called once the connection stops being | 416 // stream4->OnCanWrite is called once the connection stops being |
425 // congestion-control blocked. | 417 // congestion-control blocked. |
426 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return( | 418 EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)) |
427 QuicTime::Delta::Zero())); | 419 .WillOnce(Return(QuicTime::Delta::Zero())); |
428 EXPECT_CALL(*stream4, OnCanWrite()); | 420 EXPECT_CALL(*stream4, OnCanWrite()); |
429 session_.OnCanWrite(); | 421 session_.OnCanWrite(); |
430 EXPECT_FALSE(session_.HasPendingWrites()); | 422 EXPECT_FALSE(session_.HasPendingWrites()); |
431 } | 423 } |
432 | 424 |
433 TEST_P(QuicSessionTest, BufferedHandshake) { | 425 TEST_P(QuicSessionTest, BufferedHandshake) { |
434 EXPECT_FALSE(session_.HasPendingHandshake()); // Default value. | 426 EXPECT_FALSE(session_.HasPendingHandshake()); // Default value. |
435 | 427 |
436 // Test that blocking other streams does not change our status. | 428 // Test that blocking other streams does not change our status. |
437 TestStream* stream2 = session_.CreateOutgoingDataStream(); | 429 TestStream* stream2 = session_.CreateOutgoingDataStream(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 session_.OnCanWrite(); | 486 session_.OnCanWrite(); |
495 EXPECT_FALSE(session_.HasPendingWrites()); | 487 EXPECT_FALSE(session_.HasPendingWrites()); |
496 } | 488 } |
497 | 489 |
498 TEST_P(QuicSessionTest, SendGoAway) { | 490 TEST_P(QuicSessionTest, SendGoAway) { |
499 EXPECT_CALL(*connection_, | 491 EXPECT_CALL(*connection_, |
500 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); | 492 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); |
501 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 493 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
502 EXPECT_TRUE(session_.goaway_sent()); | 494 EXPECT_TRUE(session_.goaway_sent()); |
503 | 495 |
504 EXPECT_CALL(*connection_, | 496 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0)) |
505 SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0)).Times(0); | 497 .Times(0); |
506 EXPECT_TRUE(session_.GetIncomingDataStream(3u)); | 498 EXPECT_TRUE(session_.GetIncomingDataStream(3u)); |
507 } | 499 } |
508 | 500 |
509 TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) { | 501 TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) { |
510 EXPECT_CALL(*connection_, | 502 EXPECT_CALL(*connection_, SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")) |
511 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")).Times(1); | 503 .Times(1); |
512 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 504 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
513 EXPECT_TRUE(session_.goaway_sent()); | 505 EXPECT_TRUE(session_.goaway_sent()); |
514 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); | 506 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); |
515 } | 507 } |
516 | 508 |
517 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { | 509 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { |
518 EXPECT_EQ(kDefaultInitialTimeoutSecs, | 510 EXPECT_EQ(kDefaultInitialTimeoutSecs, |
519 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); | 511 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); |
520 CryptoHandshakeMessage msg; | 512 CryptoHandshakeMessage msg; |
521 session_.GetCryptoStream()->OnHandshakeMessage(msg); | 513 session_.GetCryptoStream()->OnHandshakeMessage(msg); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 session_.config()->ProcessPeerHello(msg, CLIENT, &error_details); | 605 session_.config()->ProcessPeerHello(msg, CLIENT, &error_details); |
614 EXPECT_EQ(QUIC_NO_ERROR, error); | 606 EXPECT_EQ(QUIC_NO_ERROR, error); |
615 | 607 |
616 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_FLOW_CONTROL_ERROR)); | 608 EXPECT_CALL(*connection_, SendConnectionClose(QUIC_FLOW_CONTROL_ERROR)); |
617 session_.OnConfigNegotiated(); | 609 session_.OnConfigNegotiated(); |
618 } | 610 } |
619 | 611 |
620 } // namespace | 612 } // namespace |
621 } // namespace test | 613 } // namespace test |
622 } // namespace net | 614 } // namespace net |
OLD | NEW |