chromium/net/base/mime_sniffer_unittest.cc

// Copyright 2011 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/base/mime_sniffer.h"

#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
#include "url/url_constants.h"

namespace net {
namespace {

Range;
Values;
SniffMimeType;  // It is shadowed by SniffMimeType(), below.

// Turn |str|, a constant string with one or more embedded NULs, along with
// a NUL terminator, into an std::string() containing just that data.
// Turn |str|, a string with one or more embedded NULs, into an std::string()
template <size_t N>
std::string MakeConstantString(const char (&str)[N]) {}

static std::string SniffMimeType(std::string_view content,
                                 const std::string& url,
                                 const std::string& mime_type_hint) {}

TEST(MimeSnifferTest, SniffableSchemes) {}

TEST(MimeSnifferTest, BoundaryConditionsTest) {}

TEST(MimeSnifferTest, BasicSniffingTest) {}

TEST(MimeSnifferTest, ChromeExtensionsTest) {}

TEST(MimeSnifferTest, MozillaCompatibleTest) {}

TEST(MimeSnifferTest, DontAllowPrivilegeEscalationTest) {}

TEST(MimeSnifferTest, SniffFilesAsHtml) {}

TEST(MimeSnifferTest, UnicodeTest) {}

TEST(MimeSnifferTest, FlashTest) {}

TEST(MimeSnifferTest, XMLTest) {}

// Test content which is >= 1024 bytes, and includes no open angle bracket.
// http://code.google.com/p/chromium/issues/detail?id=3521
TEST(MimeSnifferTest, XMLTestLargeNoAngledBracket) {}

// Test content which is >= 1024 bytes, and includes a binary looking byte.
// http://code.google.com/p/chromium/issues/detail?id=15314
TEST(MimeSnifferTest, LooksBinary) {}

TEST(MimeSnifferTest, OfficeTest) {}

TEST(MimeSnifferTest, AudioVideoTest) {}

TEST(MimeSnifferTest, ImageTest) {}

// The tests need char parameters, but the ranges to test include 0xFF, and some
// platforms have signed chars and are noisy about it. Using an int parameter
// and casting it to char inside the test case solves both these problems.
class MimeSnifferBinaryTest : public ::testing::TestWithParam<int> {};

// From https://mimesniff.spec.whatwg.org/#binary-data-byte :
// A binary data byte is a byte in the range 0x00 to 0x08 (NUL to BS), the byte
// 0x0B (VT), a byte in the range 0x0E to 0x1A (SO to SUB), or a byte in the
// range 0x1C to 0x1F (FS to US).
TEST_P(MimeSnifferBinaryTest, IsBinaryControlCode) {}

// ::testing::Range(a, b) tests an open-ended range, ie. "b" is not included.
INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

class MimeSnifferPlainTextTest : public ::testing::TestWithParam<int> {};

TEST_P(MimeSnifferPlainTextTest, NotBinaryControlCode) {}

INSTANTIATE_TEST_SUITE_P();

INSTANTIATE_TEST_SUITE_P();

class MimeSnifferControlCodesEdgeCaseTest
    : public ::testing::TestWithParam<const char*> {};

TEST_P(MimeSnifferControlCodesEdgeCaseTest, EdgeCase) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace
}  // namespace net