#include "content/public/test/test_launcher.h"
#include <stddef.h>
#include <map>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/base_paths.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/containers/contains.h"
#include "base/containers/span.h"
#include "base/debug/debugger.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/functional/callback_helpers.h"
#include "base/i18n/icu_util.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/message_loop/message_pump_type.h"
#include "base/sequence_checker.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_executor.h"
#include "base/test/allow_check_is_test_for_testing.h"
#include "base/test/gtest_xml_util.h"
#include "base/test/launcher/test_launcher.h"
#include "base/test/scoped_block_tests_writing_to_special_dirs.h"
#include "base/test/test_suite.h"
#include "base/test/test_support_ios.h"
#include "base/test/test_switches.h"
#include "base/test/test_timeouts.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "components/tracing/common/tracing_switches.h"
#include "content/common/url_schemes.h"
#include "content/public/app/content_main.h"
#include "content/public/app/content_main_delegate.h"
#include "content/public/common/content_client.h"
#include "content/public/common/content_switches.h"
#include "gpu/config/gpu_switches.h"
#include "services/tracing/public/cpp/perfetto/perfetto_traced_process.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/buildflags.h"
#include "ui/base/ui_base_features.h"
#if BUILDFLAG(IS_ANDROID)
#include "content/app/android/content_main_android.h"
#endif
#if BUILDFLAG(IS_POSIX)
#include "base/files/file_descriptor_watcher_posix.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/base_switches.h"
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/policy/win/sandbox_win.h"
#include "sandbox/win/src/sandbox_factory.h"
#include "sandbox/win/src/sandbox_types.h"
#undef GetCommandLine
#elif BUILDFLAG(IS_MAC)
#include "base/apple/scoped_nsautorelease_pool.h"
#include "sandbox/mac/seatbelt_exec.h"
#endif
namespace content {
namespace {
const char kPreTestPrefix[] = …;
const char kManualTestPrefix[] = …;
TestLauncherDelegate* g_launcher_delegate = …;
const ContentMainParams* g_params = …;
void PrintUsage() { … }
class WrapperTestLauncherDelegate : public base::TestLauncherDelegate { … };
bool WrapperTestLauncherDelegate::GetTests(
std::vector<base::TestIdentifier>* output) { … }
bool IsPreTestName(const std::string& test_name) { … }
size_t WrapperTestLauncherDelegate::GetBatchSize() { … }
base::CommandLine WrapperTestLauncherDelegate::GetCommandLine(
const std::vector<std::string>& test_names,
const base::FilePath& temp_dir,
base::FilePath* output_file) { … }
std::string WrapperTestLauncherDelegate::GetWrapper() { … }
int WrapperTestLauncherDelegate::GetLaunchOptions() { … }
base::TimeDelta WrapperTestLauncherDelegate::GetTimeout() { … }
void WrapperTestLauncherDelegate::OnTestTimedOut(
const base::CommandLine& command_line) { … }
void WrapperTestLauncherDelegate::ProcessTestResults(
std::vector<base::TestResult>& test_results,
base::TimeDelta elapsed_time) { … }
bool WrapperTestLauncherDelegate::ShouldRunTest(
const base::TestIdentifier& test) { … }
void AppendCommandLineSwitches() { … }
}
class ContentClientCreator { … };
std::string TestLauncherDelegate::GetUserDataDirectoryCommandLineSwitch() { … }
int LaunchTestsInternal(TestLauncherDelegate* launcher_delegate,
size_t parallel_jobs,
int argc,
char** argv) { … }
int LaunchTests(TestLauncherDelegate* launcher_delegate,
size_t parallel_jobs,
int argc,
char** argv) { … }
TestLauncherDelegate* GetCurrentTestLauncherDelegate() { … }
ContentMainParams CopyContentMainParams() { … }
bool IsPreTest() { … }
}