chromium/services/network/cors/cors_url_loader_tao_unittest.cc

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

#include <optional>
#include <string>
#include <vector>

#include "base/functional/callback_helpers.h"
#include "base/test/metrics/histogram_tester.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/system/functions.h"
#include "net/base/load_flags.h"
#include "net/http/http_request_headers.h"
#include "net/log/test_net_log_util.h"
#include "net/test/gtest_util.h"
#include "net/url_request/referrer_policy.h"
#include "services/network/cors/cors_url_loader.h"
#include "services/network/cors/cors_url_loader_test_util.h"
#include "services/network/public/mojom/cors.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_request.mojom-forward.h"
#include "services/network/test/mock_devtools_observer.h"
#include "services/network/test/test_url_loader_client.h"
#include "services/network/url_loader.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

// Test that Timing-Allow-Origin check passes when a same-origin redirect
// occurs. The redirect is as follows: [Origin] A -> A -> A.
namespace network::cors {
namespace {

class CorsURLLoaderTAOTest : public CorsURLLoaderTestBase {};

TEST_F(CorsURLLoaderTAOTest, TAOCheckPassOnSameOriginRedirect) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckFailOnCrossOriginResource1) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckFailOnCrossOriginNav1) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckFailOnCrossOriginResource2) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckFailOnCrossOriginNav2) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckPassOnCrossOriginResource) {}

TEST_F(CorsURLLoaderTAOTest, TAOCheckPassOnCrossOriginNav) {}

// [Origin] A -> B -> A where final redirect does not pass the check.
TEST_F(CorsURLLoaderTAOTest, TAOCheckFailRedirect1) {}

// [Origin] A -> B -> A where final redirect does not pass the check.
TEST_F(CorsURLLoaderTAOTest, TAOCheckFailRedirectNav1) {}

// [Origin] A -> B -> A where B does not pass the check.
TEST_F(CorsURLLoaderTAOTest, TAOCheckFailRedirect2) {}

// [Origin] A -> B -> A where B does not pass the check.
TEST_F(CorsURLLoaderTAOTest, TAOCheckFailRedirectNav2) {}

// [Origin] A -> B -> A
TEST_F(CorsURLLoaderTAOTest, TAOCheckPassRedirect1) {}

// [Origin] A -> B -> A
TEST_F(CorsURLLoaderTAOTest, TAOCheckPassRedirectNav1) {}

// [Origin] A -> B -> C
TEST_F(CorsURLLoaderTAOTest, TAOCheckPassRedirect2) {}

// [Origin] A -> B -> C
TEST_F(CorsURLLoaderTAOTest, TAOCheckPassRedirectNav2) {}

}  // namespace

}  // namespace network::cors