chromium/components/url_rewrite/common/url_loader_throttle_unittest.cc

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

#include "components/url_rewrite/common/url_loader_throttle.h"

#include <string>
#include <string_view>
#include <utility>

#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "services/network/public/cpp/resource_request.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/loader/url_loader_throttle.h"

namespace url_rewrite {
namespace {

constexpr char kMixedCaseCorsExemptHeader[] =;
constexpr char kUpperCaseCorsExemptHeader[] =;
constexpr char kMixedCaseCorsExemptHeader2[] =;
constexpr char kUpperCaseCorsExemptHeader2[] =;
constexpr char kRequiresCorsHeader[] =;

}  // namespace

class URLLoaderThrottleTest : public testing::Test {};

// Tests rules are properly applied when wildcard-filtering is used on hosts.
TEST_F(URLLoaderThrottleTest, WildcardHosts) {}

// Verifies that injected headers are correctly exempted from CORS checks if
// their names are registered as CORS exempt.
TEST_F(URLLoaderThrottleTest, CorsAwareHeaders) {}

// Tests URL replacement rules that replace to a data URL do not append query or
// ref from the original URL.
TEST_F(URLLoaderThrottleTest, DataReplacementUrl) {}

// Tests URL replacement rules do not apply more than once in a redirect chain
// on the same host.
TEST_F(URLLoaderThrottleTest, RedirectsToSameHost) {}

// Tests URL replacement rules do not apply when redirecting.
TEST_F(URLLoaderThrottleTest, RedirectsFromDifferentHost) {}

// Tests URL replacement rules do not apply more than once when redirecting to a
// different host that the rule applies to.
TEST_F(URLLoaderThrottleTest, RedirectsToDifferentHost) {}

class TestThrottleDelegate : public blink::URLLoaderThrottle::Delegate {};

// Tests that resource loads can be allowed or blocked based on the
// UrlRequestAction policy.
TEST_F(URLLoaderThrottleTest, AllowAndDeny) {}

}  // namespace url_rewrite