#include "services/network/cors/preflight_controller.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/run_loop.h"
#include "base/test/scoped_feature_list.h"
#include "base/test/task_environment.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
#include "net/cookies/site_for_cookies.h"
#include "net/http/http_request_headers.h"
#include "net/log/net_log.h"
#include "net/log/net_log_source_type.h"
#include "net/log/net_log_with_source.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/embedded_test_server/http_request.h"
#include "net/test/embedded_test_server/http_response.h"
#include "net/test/embedded_test_server/request_handler_util.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/cors/cors_url_loader_factory.h"
#include "services/network/network_service.h"
#include "services/network/public/cpp/cors/cors.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/mojom/devtools_observer.mojom.h"
#include "services/network/public/mojom/http_raw_headers.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/network_service.mojom.h"
#include "services/network/public/mojom/shared_dictionary_error.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "services/network/test/client_security_state_builder.h"
#include "services/network/test/fake_test_cert_verifier_params_factory.h"
#include "services/network/test/test_url_loader_factory.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/origin.h"
namespace network::cors {
namespace {
Optional;
WithTrustedHeaderClient;
PreflightMode;
PreflightType;
TEST(PreflightControllerCreatePreflightRequestTest, LexicographicalOrder) { … }
TEST(PreflightControllerCreatePreflightRequestTest, ExcludeSimpleHeaders) { … }
TEST(PreflightControllerCreatePreflightRequestTest, Credentials) { … }
TEST(PreflightControllerCreatePreflightRequestTest,
ExcludeSimpleContentTypeHeader) { … }
TEST(PreflightControllerCreatePreflightRequestTest, IncludeSecFetchModeHeader) { … }
TEST(PreflightControllerCreatePreflightRequestTest, IncludeNonSimpleHeader) { … }
TEST(PreflightControllerCreatePreflightRequestTest,
IncludeNonSimpleContentTypeHeader) { … }
TEST(PreflightControllerCreatePreflightRequestTest, ExcludeForbiddenHeaders) { … }
TEST(PreflightControllerCreatePreflightRequestTest, Tainted) { … }
TEST(PreflightControllerCreatePreflightRequestTest, FetchWindowId) { … }
TEST(PreflightControllerCreatePreflightRequestTest, SubframeNavigation) { … }
TEST(PreflightControllerCreatePreflightRequestTest, EmptyIsolationInfo) { … }
TEST(PreflightControllerOptionsTest, CheckOptions) { … }
class MockDevToolsObserver : public mojom::DevToolsObserver { … };
class PreflightControllerTest : public testing::Test { … };
TEST_F(PreflightControllerTest, CheckInvalidRequest) { … }
TEST_F(PreflightControllerTest, CheckValidRequest) { … }
TEST_F(PreflightControllerTest, CheckRequestNetworkIsolationKey) { … }
TEST_F(PreflightControllerTest, CheckFactoryNetworkIsolationKey) { … }
TEST_F(PreflightControllerTest, CheckTaintedRequest) { … }
TEST_F(PreflightControllerTest, CheckResponseWithNullHeaders) { … }
TEST_F(PreflightControllerTest, CheckPrivateNetworkAccessRequest) { … }
TEST_F(PreflightControllerTest, CheckPrivateNetworkAccessRequestWarningOnly) { … }
std::unique_ptr<net::test_server::HttpResponse> AllowPrivateNetworkAccess(
const net::test_server::HttpRequest& request) { … }
TEST_F(PreflightControllerTest,
CheckPrivateNetworkAccessRequestTimeoutBehaviorEnforce) { … }
TEST_F(PreflightControllerTest,
CheckPrivateNetworkAccessRequestTimeoutBehaviorWarnWithTimeout) { … }
TEST_F(PreflightControllerTest,
CheckPrivateNetworkAccessRequestPreflightTimeoutBehaviorWarn) { … }
class PreflightControllerNoPNAPreflightShortTimeoutTest
: public PreflightControllerTest { … };
TEST_F(PreflightControllerNoPNAPreflightShortTimeoutTest,
CheckPrivateNetworkAccessRequestTimeoutBehaviorWarnWithTimeout) { … }
TEST_F(PreflightControllerTest, DevToolsEvents) { … }
TEST_F(PreflightControllerTest, AuthorizationIsCoveredByWildcard) { … }
TEST_F(PreflightControllerTest, AuthorizationIsNotCoveredByWildcard) { … }
TEST_F(PreflightControllerTest, CheckPreflightAccessDetectsErrorStatus) { … }
}
}