| Index: net/quic/quic_session_test.cc
|
| diff --git a/net/quic/quic_session_test.cc b/net/quic/quic_session_test.cc
|
| index 019e27bafe6ad138748cde811644b424d96d4796..73b58a288e8e425b90367ee2f2fe1dddc5ef64e5 100644
|
| --- a/net/quic/quic_session_test.cc
|
| +++ b/net/quic/quic_session_test.cc
|
| @@ -43,9 +43,7 @@ const QuicPriority kSomeMiddlePriority = 3;
|
|
|
| class TestCryptoStream : public QuicCryptoStream {
|
| public:
|
| - explicit TestCryptoStream(QuicSession* session)
|
| - : QuicCryptoStream(session) {
|
| - }
|
| + explicit TestCryptoStream(QuicSession* session) : QuicCryptoStream(session) {}
|
|
|
| virtual void OnHandshakeMessage(
|
| const CryptoHandshakeMessage& message) OVERRIDE {
|
| @@ -56,8 +54,8 @@ class TestCryptoStream : public QuicCryptoStream {
|
| session()->config()->SetInitialFlowControlWindowToSend(
|
| kInitialFlowControlWindowForTest);
|
| session()->config()->ToHandshakeMessage(&msg);
|
| - const QuicErrorCode error = session()->config()->ProcessPeerHello(
|
| - msg, CLIENT, &error_details);
|
| + const QuicErrorCode error =
|
| + session()->config()->ProcessPeerHello(msg, CLIENT, &error_details);
|
| EXPECT_EQ(QUIC_NO_ERROR, error);
|
| session()->OnConfigNegotiated();
|
| session()->OnCryptoHandshakeEvent(QuicSession::HANDSHAKE_CONFIRMED);
|
| @@ -69,8 +67,7 @@ class TestCryptoStream : public QuicCryptoStream {
|
| class TestStream : public QuicDataStream {
|
| public:
|
| TestStream(QuicStreamId id, QuicSession* session)
|
| - : QuicDataStream(id, session) {
|
| - }
|
| + : QuicDataStream(id, session) {}
|
|
|
| using ReliableQuicStream::CloseWriteSide;
|
|
|
| @@ -89,9 +86,7 @@ class TestStream : public QuicDataStream {
|
| class StreamBlocker {
|
| public:
|
| StreamBlocker(QuicSession* session, QuicStreamId stream_id)
|
| - : session_(session),
|
| - stream_id_(stream_id) {
|
| - }
|
| + : session_(session), stream_id_(stream_id) {}
|
|
|
| void MarkWriteBlocked() {
|
| session_->MarkWriteBlocked(stream_id_, kSomeMiddlePriority);
|
| @@ -107,8 +102,7 @@ class TestSession : public QuicSession {
|
| explicit TestSession(QuicConnection* connection)
|
| : QuicSession(connection, DefaultQuicConfig()),
|
| crypto_stream_(this),
|
| - writev_consumes_all_data_(false) {
|
| - }
|
| + writev_consumes_all_data_(false) {}
|
|
|
| virtual TestCryptoStream* GetCryptoStream() OVERRIDE {
|
| return &crypto_stream_;
|
| @@ -142,8 +136,8 @@ class TestSession : public QuicSession {
|
| if (writev_consumes_all_data_) {
|
| return QuicConsumedData(data.TotalBufferSize(), fin);
|
| } else {
|
| - return QuicSession::WritevData(id, data, offset, fin,
|
| - ack_notifier_delegate);
|
| + return QuicSession::WritevData(
|
| + id, data, offset, fin, ack_notifier_delegate);
|
| }
|
| }
|
|
|
| @@ -218,7 +212,8 @@ class QuicSessionTest : public ::testing::TestWithParam<QuicVersion> {
|
| SpdyHeaderBlock headers_;
|
| };
|
|
|
| -INSTANTIATE_TEST_CASE_P(Tests, QuicSessionTest,
|
| +INSTANTIATE_TEST_CASE_P(Tests,
|
| + QuicSessionTest,
|
| ::testing::ValuesIn(QuicSupportedVersions()));
|
|
|
| TEST_P(QuicSessionTest, PeerAddress) {
|
| @@ -292,18 +287,17 @@ TEST_P(QuicSessionTest, StreamIdTooLarge) {
|
| TEST_P(QuicSessionTest, DecompressionError) {
|
| QuicHeadersStream* stream = QuicSessionPeer::GetHeadersStream(&session_);
|
| const unsigned char data[] = {
|
| - 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame
|
| - 0x00, 0x00, 0x00, 0x25, // flags/length
|
| - 0x00, 0x00, 0x00, 0x05, // stream id
|
| - 0x00, 0x00, 0x00, 0x00, // associated stream id
|
| - 0x00, 0x00,
|
| - 'a', 'b', 'c', 'd' // invalid compressed data
|
| + 0x80, 0x03, 0x00, 0x01, // SPDY/3 SYN_STREAM frame
|
| + 0x00, 0x00, 0x00, 0x25, // flags/length
|
| + 0x00, 0x00, 0x00, 0x05, // stream id
|
| + 0x00, 0x00, 0x00, 0x00, // associated stream id
|
| + 0x00, 0x00, 'a', 'b',
|
| + 'c', 'd' // invalid compressed data
|
| };
|
| EXPECT_CALL(*connection_,
|
| SendConnectionCloseWithDetails(QUIC_INVALID_HEADERS_STREAM_DATA,
|
| "SPDY framing error."));
|
| - stream->ProcessRawData(reinterpret_cast<const char*>(data),
|
| - arraysize(data));
|
| + stream->ProcessRawData(reinterpret_cast<const char*>(data), arraysize(data));
|
| }
|
|
|
| TEST_P(QuicSessionTest, DebugDFatalIfMarkingClosedStreamWriteBlocked) {
|
| @@ -365,22 +359,20 @@ TEST_P(QuicSessionTest, OnCanWriteBundlesStreams) {
|
| session_.MarkWriteBlocked(stream6->id(), kSomeMiddlePriority);
|
| session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority);
|
|
|
| -
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillRepeatedly(
|
| - Return(QuicTime::Delta::Zero()));
|
| - EXPECT_CALL(*send_algorithm, GetCongestionWindow()).WillOnce(
|
| - Return(kMaxPacketSize * 10));
|
| - EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(IgnoreResult(
|
| - InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| - EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(IgnoreResult(
|
| - InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| - EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(IgnoreResult(
|
| - InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| - MockPacketWriter* writer =
|
| - static_cast<MockPacketWriter*>(
|
| - QuicConnectionPeer::GetWriter(session_.connection()));
|
| - EXPECT_CALL(*writer, WritePacket(_, _, _, _)).WillOnce(
|
| - Return(WriteResult(WRITE_STATUS_OK, 0)));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillRepeatedly(Return(QuicTime::Delta::Zero()));
|
| + EXPECT_CALL(*send_algorithm, GetCongestionWindow())
|
| + .WillOnce(Return(kMaxPacketSize * 10));
|
| + EXPECT_CALL(*stream2, OnCanWrite()).WillOnce(
|
| + IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| + EXPECT_CALL(*stream6, OnCanWrite()).WillOnce(
|
| + IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| + EXPECT_CALL(*stream4, OnCanWrite()).WillOnce(
|
| + IgnoreResult(InvokeWithoutArgs(&session_, &TestSession::SendStreamData)));
|
| + MockPacketWriter* writer = static_cast<MockPacketWriter*>(
|
| + QuicConnectionPeer::GetWriter(session_.connection()));
|
| + EXPECT_CALL(*writer, WritePacket(_, _, _, _))
|
| + .WillOnce(Return(WriteResult(WRITE_STATUS_OK, 0)));
|
| EXPECT_CALL(*send_algorithm, OnPacketSent(_, _, _, _));
|
| session_.OnCanWrite();
|
| EXPECT_FALSE(session_.HasPendingWrites());
|
| @@ -402,29 +394,29 @@ TEST_P(QuicSessionTest, OnCanWriteCongestionControlBlocks) {
|
| session_.MarkWriteBlocked(stream4->id(), kSomeMiddlePriority);
|
|
|
| StreamBlocker stream2_blocker(&session_, stream2->id());
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return(
|
| - QuicTime::Delta::Zero()));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillOnce(Return(QuicTime::Delta::Zero()));
|
| EXPECT_CALL(*stream2, OnCanWrite());
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return(
|
| - QuicTime::Delta::Zero()));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillOnce(Return(QuicTime::Delta::Zero()));
|
| EXPECT_CALL(*stream6, OnCanWrite());
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return(
|
| - QuicTime::Delta::Infinite()));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillOnce(Return(QuicTime::Delta::Infinite()));
|
| // stream4->OnCanWrite is not called.
|
|
|
| session_.OnCanWrite();
|
| EXPECT_TRUE(session_.HasPendingWrites());
|
|
|
| // Still congestion-control blocked.
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return(
|
| - QuicTime::Delta::Infinite()));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillOnce(Return(QuicTime::Delta::Infinite()));
|
| session_.OnCanWrite();
|
| EXPECT_TRUE(session_.HasPendingWrites());
|
|
|
| // stream4->OnCanWrite is called once the connection stops being
|
| // congestion-control blocked.
|
| - EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _)).WillOnce(Return(
|
| - QuicTime::Delta::Zero()));
|
| + EXPECT_CALL(*send_algorithm, TimeUntilSend(_, _))
|
| + .WillOnce(Return(QuicTime::Delta::Zero()));
|
| EXPECT_CALL(*stream4, OnCanWrite());
|
| session_.OnCanWrite();
|
| EXPECT_FALSE(session_.HasPendingWrites());
|
| @@ -501,14 +493,14 @@ TEST_P(QuicSessionTest, SendGoAway) {
|
| session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
|
| EXPECT_TRUE(session_.goaway_sent());
|
|
|
| - EXPECT_CALL(*connection_,
|
| - SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0)).Times(0);
|
| + EXPECT_CALL(*connection_, SendRstStream(3u, QUIC_STREAM_PEER_GOING_AWAY, 0))
|
| + .Times(0);
|
| EXPECT_TRUE(session_.GetIncomingDataStream(3u));
|
| }
|
|
|
| TEST_P(QuicSessionTest, DoNotSendGoAwayTwice) {
|
| - EXPECT_CALL(*connection_,
|
| - SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away.")).Times(1);
|
| + EXPECT_CALL(*connection_, SendGoAway(QUIC_PEER_GOING_AWAY, 0u, "Going Away."))
|
| + .Times(1);
|
| session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
|
| EXPECT_TRUE(session_.goaway_sent());
|
| session_.SendGoAway(QUIC_PEER_GOING_AWAY, "Going Away.");
|
|
|