src/net/spdy/spdy_stream_unittest.cc
// Call IncreaseSendWindowSize on a stream with a large enough delta to overflow
// an int32_t. The SpdyStream should handle that case gracefully.
Call IncreaseSendWindowSize on a stream with a large enough delta to overflow
an int32_t. The SpdyStream should handle that case gracefully.
Call IncreaseSendWindowSize on a stream with a large enough delta to overflow an int32_t . The SpdyStream should handle that case gracefully .
TEST_F(SpdyStreamTest, IncreaseSendWindowSizeOverflow) {
  spdy::SpdySerializedFrame req(spdy_util_.ConstructSpdyPost(
      kDefaultUrl, 1, kPostBodyLength, LOWEST, nullptr, 0));
  AddWrite(req);
  AddReadPause();
  spdy::SpdySerializedFrame rst(spdy_util_.ConstructSpdyRstStream(
      1, spdy::ERROR_CODE_FLOW_CONTROL_ERROR));
  AddWrite(rst);
  AddReadEOF();
  RecordingBoundTestNetLog log;
  SequencedSocketData data(GetReads(), GetWrites());
  MockConnect connect_data(SYNCHRONOUS, OK);
  data.set_connect_data(connect_data);
  session_deps_.socket_factory->AddSocketDataProvider(&data);
  AddSSLSocketData();
  base::WeakPtr<SpdySession> session(CreateDefaultSpdySession());
  base::WeakPtr<SpdyStream> stream = CreateStreamSynchronously(
      SPDY_BIDIRECTIONAL_STREAM, session, url_, LOWEST, log.bound());
  ASSERT_TRUE(stream);
  EXPECT_EQ(kDefaultUrl, stream->url().spec());
  StreamDelegateSendImmediate delegate(stream, kPostBodyStringPiece);
  stream->SetDelegate(&delegate);
  spdy::SpdyHeaderBlock headers(
      spdy_util_.ConstructPostHeaderBlock(kDefaultUrl, kPostBodyLength));
  EXPECT_THAT(stream->SendRequestHeaders(std::move(headers), MORE_DATA_TO_SEND),
              IsError(ERR_IO_PENDING));
  data.RunUntilPaused();
  int32_t old_send_window_size = stream->send_window_size();
  ASSERT_GT(old_send_window_size, 0);
  int32_t delta_window_size =
      std::numeric_limits<int32_t>::max() - old_send_window_size + 1;
  stream->IncreaseSendWindowSize(delta_window_size);
  EXPECT_FALSE(stream);
  data.Resume();
  base::RunLoop().RunUntilIdle();
  EXPECT_THAT(delegate.WaitForClose(), IsError(ERR_HTTP2_FLOW_CONTROL_ERROR));
}
TEST_F ( SpdyStreamTest , IncreaseSendWindowSizeOverflow ) { spdy :: SpdySerializedFrame req ( spdy_util_ . ConstructSpdyPost ( kDefaultUrl , 1 , kPostBodyLength , LOWEST , nullptr , 0 ) ) ; AddWrite ( req ) ; AddReadPause ( ) ; spdy :: SpdySerializedFrame rst ( spdy_util_ . ConstructSpdyRstStream ( 1 , spdy :: ERROR_CODE_FLOW_CONTROL_ERROR ) ) ; AddWrite ( rst ) ; AddReadEOF ( ) ; RecordingBoundTestNetLog log ; SequencedSocketData data ( GetReads ( ) , GetWrites ( ) ) ; MockConnect connect_data ( SYNCHRONOUS , OK ) ; data . set_connect_data ( connect_data ) ; session_deps_ . socket_factory -> AddSocketDataProvider ( & data ) ; AddSSLSocketData ( ) ; base :: WeakPtr < SpdySession > session ( CreateDefaultSpdySession ( ) ) ; base :: WeakPtr < SpdyStream > stream = CreateStreamSynchronously ( SPDY_BIDIRECTIONAL_STREAM , session , url_ , LOWEST , log . bound ( ) ) ; ASSERT_TRUE ( stream ) ; EXPECT_EQ ( kDefaultUrl , stream -> url ( ) . spec ( ) ) ; StreamDelegateSendImmediate delegate ( stream , kPostBodyStringPiece ) ; stream -> SetDelegate ( & delegate ) ; spdy :: SpdyHeaderBlock headers ( spdy_util_ . ConstructPostHeaderBlock ( kDefaultUrl , kPostBodyLength ) ) ; EXPECT_THAT ( stream -> SendRequestHeaders ( std :: move ( headers ) , MORE_DATA_TO_SEND ) , IsError ( ERR_IO_PENDING ) ) ; data . RunUntilPaused ( ) ; int32_t old_send_window_size = stream -> send_window_size ( ) ; ASSERT_GT ( old_send_window_size , 0 ) ; int32_t delta_window_size = std :: numeric_limits < int32_t > :: max ( ) - old_send_window_size + 1 ; stream -> IncreaseSendWindowSize ( delta_window_size ) ; EXPECT_FALSE ( stream ) ; data . Resume ( ) ; base :: RunLoop ( ) . RunUntilIdle ( ) ; EXPECT_THAT ( delegate . WaitForClose ( ) , IsError ( ERR_HTTP2_FLOW_CONTROL_ERROR ) ) ; }
Call IncreaseSendWindowSize on a stream with a large enough delta to overflow
an int32_t.
Call IncreaseSendWindowSize on a stream with a large enough delta to overflow an int32_t .
// Triggered by the overflowing call to IncreaseSendWindowSize // below.