chromium/url/url_util_unittest.cc

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

#include "url/url_util.h"

#include <stddef.h>

#include <optional>
#include <string_view>

#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest-message.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/third_party/mozilla/url_parse.h"
#include "url/url_canon.h"
#include "url/url_canon_stdstring.h"
#include "url/url_features.h"
#include "url/url_test_utils.h"

namespace url {

class URLUtilTest : public testing::Test {};

TEST_F(URLUtilTest, FindAndCompareScheme) {}

TEST_F(URLUtilTest, IsStandard) {}

TEST_F(URLUtilTest, IsReferrerScheme) {}

TEST_F(URLUtilTest, AddReferrerScheme) {}

TEST_F(URLUtilTest, ShutdownCleansUpSchemes) {}

TEST_F(URLUtilTest, GetStandardSchemeType) {}

TEST_F(URLUtilTest, GetStandardSchemes) {}

TEST_F(URLUtilTest, ReplaceComponents) {}

static std::string CheckReplaceScheme(const char* base_url,
                                      const char* scheme) {}

TEST_F(URLUtilTest, ReplaceScheme) {}

TEST_F(URLUtilTest, DecodeURLEscapeSequences) {}

TEST_F(URLUtilTest, TestEncodeURIComponent) {}

TEST_F(URLUtilTest, PotentiallyDanglingMarkup) {}

TEST_F(URLUtilTest, PotentiallyDanglingMarkupAfterReplacement) {}

TEST_F(URLUtilTest, PotentiallyDanglingMarkupAfterSchemeOnlyReplacement) {}

TEST_F(URLUtilTest, TestDomainIs) {}

namespace {
std::optional<std::string> CanonicalizeSpec(std::string_view spec,
                                            bool trim_path_end) {}
}  // namespace

#if BUILDFLAG(IS_WIN)
// Regression test for https://crbug.com/1252658.
TEST_F(URLUtilTest, TestCanonicalizeWindowsPathWithLeadingNUL) {
  auto PrefixWithNUL = [](std::string&& s) -> std::string { return '\0' + s; };
  EXPECT_EQ(CanonicalizeSpec(PrefixWithNUL("w:"), /*trim_path_end=*/false),
            std::make_optional("file:///W:"));
  EXPECT_EQ(CanonicalizeSpec(PrefixWithNUL("\\\\server\\share"),
                             /*trim_path_end=*/false),
            std::make_optional("file://server/share"));
}
#endif

TEST_F(URLUtilTest, TestCanonicalizeIdempotencyWithLeadingControlCharacters) {}

TEST_F(URLUtilTest, TestHasInvalidURLEscapeSequences) {}

class URLUtilTypedTest : public ::testing::TestWithParam<bool> {};

TEST_P(URLUtilTypedTest, TestResolveRelativeWithNonStandardBase) {}

TEST_P(URLUtilTypedTest, TestNoRefComponent) {}

TEST_P(URLUtilTypedTest, Cannolicalize) {}

TEST_P(URLUtilTypedTest, TestResolveRelativeWithNonSpecialBase) {}

TEST_P(URLUtilTypedTest, OpaqueNonSpecialScheme) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace url