| Index: net/websockets/websocket_channel_test.cc
|
| diff --git a/net/websockets/websocket_channel_test.cc b/net/websockets/websocket_channel_test.cc
|
| index 7a50c41cbe4b4f21ebd7021492000c940353d50d..d5ceae8e478f282f7646ddb5eedff6c0392cdb73 100644
|
| --- a/net/websockets/websocket_channel_test.cc
|
| +++ b/net/websockets/websocket_channel_test.cc
|
| @@ -2542,6 +2542,39 @@ TEST_F(WebSocketChannelFlowControlTest, CloseFrameShouldNotOvertakeDataFrames) {
|
| checkpoint.Call(4);
|
| }
|
|
|
| +// SendFlowControl calls should not trigger multiple close respond frames.
|
| +TEST_F(WebSocketChannelFlowControlTest, DoNotSendMultipleCloseRespondFrames) {
|
| + std::unique_ptr<ReadableFakeWebSocketStream> stream(
|
| + new ReadableFakeWebSocketStream);
|
| + static constexpr InitFrame frames[] = {
|
| + {FINAL_FRAME, WebSocketFrameHeader::kOpCodeText, NOT_MASKED,
|
| + "FIRST SECOND"},
|
| + {FINAL_FRAME, WebSocketFrameHeader::kOpCodeClose, NOT_MASKED,
|
| + CLOSE_DATA(NORMAL_CLOSURE, "GOOD BYE")},
|
| + };
|
| + stream->PrepareReadFrames(ReadableFakeWebSocketStream::SYNC, OK, frames);
|
| + set_stream(std::move(stream));
|
| + Checkpoint checkpoint;
|
| + InSequence s;
|
| + EXPECT_CALL(*event_interface_, OnAddChannelResponse(_, _));
|
| + EXPECT_CALL(*event_interface_, OnFlowControl(_));
|
| + EXPECT_CALL(*event_interface_,
|
| + OnDataFrameVector(false, WebSocketFrameHeader::kOpCodeText,
|
| + AsVector("FIRST ")));
|
| + EXPECT_CALL(checkpoint, Call(1));
|
| + EXPECT_CALL(*event_interface_,
|
| + OnDataFrameVector(true, WebSocketFrameHeader::kOpCodeContinuation,
|
| + AsVector("SECOND")));
|
| + EXPECT_CALL(*event_interface_, OnClosingHandshake());
|
| + EXPECT_CALL(checkpoint, Call(2));
|
| +
|
| + CreateChannelAndConnectWithQuota(6);
|
| + checkpoint.Call(1);
|
| + ASSERT_EQ(CHANNEL_ALIVE, channel_->SendFlowControl(6));
|
| + checkpoint.Call(2);
|
| + ASSERT_EQ(CHANNEL_ALIVE, channel_->SendFlowControl(6));
|
| +}
|
| +
|
| // RFC6455 5.1 "a client MUST mask all frames that it sends to the server".
|
| // WebSocketChannel actually only sets the mask bit in the header, it doesn't
|
| // perform masking itself (not all transports actually use masking).
|
|
|