chromium/net/url_request/url_request_context_builder_unittest.cc

// Copyright 2012 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/url_request/url_request_context_builder.h"

#include "base/functional/callback_helpers.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "net/base/cronet_buildflags.h"
#include "net/base/mock_network_change_notifier.h"
#include "net/base/network_anonymization_key.h"
#include "net/base/request_priority.h"
#include "net/base/test_completion_callback.h"
#include "net/dns/host_resolver.h"
#include "net/dns/host_resolver_manager.h"
#include "net/dns/mock_host_resolver.h"
#include "net/http/http_auth_challenge_tokenizer.h"
#include "net/http/http_auth_handler.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/log/net_log_with_source.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/socket/client_socket_factory.h"
#include "net/ssl/ssl_info.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "net/test/gtest_util.h"
#include "net/test/test_with_task_environment.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
#include "url/gurl.h"
#include "url/scheme_host_port.h"

#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_ANDROID)
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service_fixed.h"
#endif  // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) ||
        // BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(IS_ANDROID)
#include "base/android/build_info.h"
#endif  // BUILDFLAG(IS_ANDROID)

#if BUILDFLAG(ENABLE_REPORTING)
#include "base/files/scoped_temp_dir.h"

#if !BUILDFLAG(CRONET_BUILD)
// gn check does not account for BUILDFLAG(). So, for Cronet builds, it will
// complain about a missing dependency on the target exposing this header. Add a
// nogncheck to stop it from yelling.
#include "net/extras/sqlite/sqlite_persistent_reporting_and_nel_store.h"  // nogncheck
#endif  // !BUILDFLAG(CRONET_BUILD)

#include "net/reporting/reporting_context.h"
#include "net/reporting/reporting_policy.h"
#include "net/reporting/reporting_service.h"
#include "net/reporting/reporting_uploader.h"
#endif  // BUILDFLAG(ENABLE_REPORTING)

namespace net {

namespace {

class MockHttpAuthHandlerFactory : public HttpAuthHandlerFactory {};

class URLRequestContextBuilderTest : public PlatformTest,
                                     public WithTaskEnvironment {};

TEST_F(URLRequestContextBuilderTest, DefaultSettings) {}

TEST_F(URLRequestContextBuilderTest, UserAgent) {}

TEST_F(URLRequestContextBuilderTest, DefaultHttpAuthHandlerFactory) {}

TEST_F(URLRequestContextBuilderTest, CustomHttpAuthHandlerFactory) {}

#if BUILDFLAG(ENABLE_REPORTING)
// See crbug.com/935209. This test ensures that shutdown occurs correctly and
// does not crash while destoying the NEL and Reporting services in the process
// of destroying the URLRequestContext whilst Reporting has a pending upload.
TEST_F(URLRequestContextBuilderTest, ShutDownNELAndReportingWithPendingUpload) {}

#if !BUILDFLAG(CRONET_BUILD)
// See crbug.com/935209. This test ensures that shutdown occurs correctly and
// does not crash while destoying the NEL and Reporting services in the process
// of destroying the URLRequestContext whilst Reporting has a pending upload.
TEST_F(URLRequestContextBuilderTest,
       ShutDownNELAndReportingWithPendingUploadAndPersistentStorage) {}
#endif  // !BUILDFLAG(CRONET_BUILD)

TEST_F(URLRequestContextBuilderTest,
       BuilderSetEnterpriseReportingEndpointsWithFeatureEnabled) {}

TEST_F(URLRequestContextBuilderTest,
       BuilderSetEnterpriseReportingEndpointsWithFeatureDisabled) {}
#endif  // BUILDFLAG(ENABLE_REPORTING)

TEST_F(URLRequestContextBuilderTest, ShutdownHostResolverWithPendingRequest) {}

TEST_F(URLRequestContextBuilderTest, DefaultHostResolver) {}

TEST_F(URLRequestContextBuilderTest, CustomHostResolver) {}

TEST_F(URLRequestContextBuilderTest, BindToNetworkFinalConfiguration) {}

TEST_F(URLRequestContextBuilderTest, BindToNetworkCustomManagerOptions) {}

TEST_F(URLRequestContextBuilderTest, MigrateSessionsOnNetworkChangeV2Default) {}

TEST_F(URLRequestContextBuilderTest, MigrateSessionsOnNetworkChangeV2Override) {}

}  // namespace

}  // namespace net