#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/loader/resource/multipart_image_resource_parser.h"
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "base/numerics/safe_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_response.h"
#include "third_party/blink/renderer/platform/network/http_names.h"
namespace blink {
namespace multipart_image_resource_parser_test {
String ToString(const Vector<char>& data) { … }
class MockClient final : public GarbageCollected<MockClient>,
public MultipartImageResourceParser::Client { … };
TEST(MultipartResponseTest, SkippableLength) { … }
TEST(MultipartResponseTest, FindBoundary) { … }
TEST(MultipartResponseTest, NoStartBoundary) { … }
TEST(MultipartResponseTest, NoEndBoundary) { … }
TEST(MultipartResponseTest, NoStartAndEndBoundary) { … }
TEST(MultipartResponseTest, MalformedBoundary) { … }
struct TestChunk { … };
void VariousChunkSizesTest(const TestChunk chunks[],
int chunks_size,
size_t responses,
int received_data,
const char* completed_data) { … }
template <size_t N>
void VariousChunkSizesTest(const TestChunk (&chunks)[N],
size_t responses,
int received_data,
const char* completed_data) { … }
TEST(MultipartResponseTest, BreakInBoundary) { … }
TEST(MultipartResponseTest, BreakInHeaders) { … }
TEST(MultipartResponseTest, BreakInData) { … }
TEST(MultipartResponseTest, SmallChunk) { … }
TEST(MultipartResponseTest, MultipleBoundaries) { … }
TEST(MultipartResponseTest, EatLeadingLF) { … }
TEST(MultipartResponseTest, EatLeadingCRLF) { … }
}
}