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

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

Issue 198353003: Land Recent QUIC Changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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_utils.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_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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 CloseStream(stream6->id()); 420 CloseStream(stream6->id());
421 421
422 InSequence s; 422 InSequence s;
423 EXPECT_CALL(*stream2, OnCanWrite()); 423 EXPECT_CALL(*stream2, OnCanWrite());
424 EXPECT_CALL(*stream4, OnCanWrite()); 424 EXPECT_CALL(*stream4, OnCanWrite());
425 session_.OnCanWrite(); 425 session_.OnCanWrite();
426 EXPECT_FALSE(session_.HasPendingWrites()); 426 EXPECT_FALSE(session_.HasPendingWrites());
427 } 427 }
428 428
429 TEST_P(QuicSessionTest, SendGoAway) { 429 TEST_P(QuicSessionTest, SendGoAway) {
430 // After sending a GoAway, ensure new incoming streams cannot be created and
431 // result in a RST being sent.
432 EXPECT_CALL(*connection_, 430 EXPECT_CALL(*connection_,
433 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")); 431 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away."));
434 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away."); 432 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
435 EXPECT_TRUE(session_.goaway_sent()); 433 EXPECT_TRUE(session_.goaway_sent());
436 434
437 EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0)); 435 EXPECT_CALL(*connection_,
438 EXPECT_FALSE(session_.GetIncomingDataStream(3u)); 436 SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0)).Times(0);
437 EXPECT_TRUE(session_.GetIncomingDataStream(3u));
438 }
439
440 TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) {
441 EXPECT_CALL(*connection_,
442 SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")).Times(1);
443 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
444 EXPECT_TRUE(session_.goaway_sent());
445 session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
439 } 446 }
440 447
441 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) { 448 TEST_P(QuicSessionTest, IncreasedTimeoutAfterCryptoHandshake) {
442 EXPECT_EQ(kDefaultInitialTimeoutSecs, 449 EXPECT_EQ(kDefaultInitialTimeoutSecs,
443 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); 450 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds());
444 CryptoHandshakeMessage msg; 451 CryptoHandshakeMessage msg;
445 session_.crypto_stream_.OnHandshakeMessage(msg); 452 session_.crypto_stream_.OnHandshakeMessage(msg);
446 EXPECT_EQ(kDefaultTimeoutSecs, 453 EXPECT_EQ(kDefaultTimeoutSecs,
447 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds()); 454 QuicConnectionPeer::GetNetworkTimeout(connection_).ToSeconds());
448 } 455 }
449 456
450 TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) { 457 TEST_P(QuicSessionTest, RstStreamBeforeHeadersDecompressed) {
451 QuicStreamId stream_id1 = 5; 458 QuicStreamId stream_id1 = 5;
452 // Send two bytes of payload. 459 // Send two bytes of payload.
453 QuicStreamFrame data1(stream_id1, false, 0, MakeIOVector("HT")); 460 QuicStreamFrame data1(stream_id1, false, 0, MakeIOVector("HT"));
454 vector<QuicStreamFrame> frames; 461 vector<QuicStreamFrame> frames;
455 frames.push_back(data1); 462 frames.push_back(data1);
456 EXPECT_TRUE(session_.OnStreamFrames(frames)); 463 EXPECT_TRUE(session_.OnStreamFrames(frames));
457 EXPECT_EQ(1u, session_.GetNumOpenStreams()); 464 EXPECT_EQ(1u, session_.GetNumOpenStreams());
458 465
459 QuicRstStreamFrame rst1(stream_id1, QUIC_STREAM_NO_ERROR, 0); 466 QuicRstStreamFrame rst1(stream_id1, QUIC_STREAM_NO_ERROR, 0);
460 session_.OnRstStream(rst1); 467 session_.OnRstStream(rst1);
461 EXPECT_EQ(0u, session_.GetNumOpenStreams()); 468 EXPECT_EQ(0u, session_.GetNumOpenStreams());
462 } 469 }
463 470
464 } // namespace 471 } // namespace
465 } // namespace test 472 } // namespace test
466 } // namespace net 473 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.cc ('k') | net/quic/quic_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698