#include "net/websockets/websocket_deflate_stream.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <iterator>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/containers/circular_deque.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/test/mock_callback.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/log/net_log_with_source.h"
#include "net/test/gtest_util.h"
#include "net/websockets/websocket_deflate_parameters.h"
#include "net/websockets/websocket_deflate_predictor.h"
#include "net/websockets/websocket_deflater.h"
#include "net/websockets/websocket_frame.h"
#include "net/websockets/websocket_stream.h"
#include "net/websockets/websocket_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
IsError;
IsOk;
namespace net {
namespace {
_;
InSequence;
Invoke;
Return;
FrameFlag;
constexpr FrameFlag kNoFlag = …;
constexpr FrameFlag kFinal = …;
constexpr FrameFlag kReserved1 = …;
constexpr size_t kChunkSize = …;
constexpr int kWindowBits = …;
std::string ToString(IOBufferWithSize* buffer) { … }
std::string ToString(const scoped_refptr<IOBufferWithSize>& buffer) { … }
std::string ToString(const WebSocketFrame* frame) { … }
std::string ToString(const std::unique_ptr<WebSocketFrame>& frame) { … }
class MockWebSocketStream : public WebSocketStream { … };
class WebSocketDeflatePredictorMock : public WebSocketDeflatePredictor { … };
class WebSocketDeflateStreamTest : public ::testing::Test { … };
class WebSocketDeflateStreamWithDoNotTakeOverContextTest
: public WebSocketDeflateStreamTest { … };
class WebSocketDeflateStreamWithClientWindowBitsTest
: public WebSocketDeflateStreamTest { … };
class ReadFramesStub { … };
class WriteFramesStub { … };
TEST_F(WebSocketDeflateStreamTest, ReadFailedImmediately) { … }
TEST_F(WebSocketDeflateStreamTest, ReadUncompressedFrameImmediately) { … }
TEST_F(WebSocketDeflateStreamTest, ReadUncompressedFrameAsync) { … }
TEST_F(WebSocketDeflateStreamTest, ReadFailedAsync) { … }
TEST_F(WebSocketDeflateStreamTest, ReadCompressedFrameImmediately) { … }
TEST_F(WebSocketDeflateStreamTest, ReadCompressedFrameAsync) { … }
TEST_F(WebSocketDeflateStreamTest,
ReadCompressedFrameFragmentImmediatelyButInflaterReturnsPending) { … }
TEST_F(WebSocketDeflateStreamTest, ReadInvalidCompressedPayload) { … }
TEST_F(WebSocketDeflateStreamTest, MergeMultipleFramesInReadFrames) { … }
TEST_F(WebSocketDeflateStreamTest, ReadUncompressedEmptyFrames) { … }
TEST_F(WebSocketDeflateStreamTest, ReadCompressedEmptyFrames) { … }
TEST_F(WebSocketDeflateStreamTest,
ReadCompressedFrameFollowedByEmptyFrame) { … }
TEST_F(WebSocketDeflateStreamTest, ReadControlFrameBetweenDataFrames) { … }
TEST_F(WebSocketDeflateStreamTest, SplitToMultipleFramesInReadFrames) { … }
TEST_F(WebSocketDeflateStreamTest, InflaterInternalDataCanBeEmpty) { … }
TEST_F(WebSocketDeflateStreamTest,
Reserved1TurnsOnDuringReadingCompressedContinuationFrame) { … }
TEST_F(WebSocketDeflateStreamTest,
Reserved1TurnsOnDuringReadingUncompressedContinuationFrame) { … }
TEST_F(WebSocketDeflateStreamTest, ReadCompressedMessages) { … }
TEST_F(WebSocketDeflateStreamTest, ReadUncompressedMessages) { … }
TEST_F(WebSocketDeflateStreamTest,
ReadCompressedMessageThenUncompressedMessage) { … }
TEST_F(WebSocketDeflateStreamTest,
ReadUncompressedMessageThenCompressedMessage) { … }
TEST_F(WebSocketDeflateStreamTest, ReadEmptyAsyncFrame) { … }
TEST_F(WebSocketDeflateStreamTest, WriteEmpty) { … }
TEST_F(WebSocketDeflateStreamTest, WriteFailedImmediately) { … }
TEST_F(WebSocketDeflateStreamTest, WriteFrameImmediately) { … }
TEST_F(WebSocketDeflateStreamTest, WriteFrameAsync) { … }
TEST_F(WebSocketDeflateStreamTest, WriteControlFrameBetweenDataFrames) { … }
TEST_F(WebSocketDeflateStreamTest, WriteEmptyMessage) { … }
TEST_F(WebSocketDeflateStreamTest, WriteUncompressedMessage) { … }
TEST_F(WebSocketDeflateStreamTest, LargeDeflatedFramesShouldBeSplit) { … }
TEST_F(WebSocketDeflateStreamTest, WriteMultipleMessages) { … }
TEST_F(WebSocketDeflateStreamWithDoNotTakeOverContextTest,
WriteMultipleMessages) { … }
TEST_F(WebSocketDeflateStreamWithDoNotTakeOverContextTest,
WritePossiblyCompressMessages) { … }
TEST_F(WebSocketDeflateStreamWithClientWindowBitsTest, WindowBits8) { … }
TEST_F(WebSocketDeflateStreamWithClientWindowBitsTest, WindowBits10) { … }
}
}