blob: c271eef8b86eb60ce7839fc718811b40b630f01c [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/command_line.h"
#include "base/test/launcher/test_launcher.h"
#include "build/build_config.h"
#include "chrome/test/base/chrome_test_launcher.h"
#include "chrome/test/base/chrome_test_suite.h"
#if defined(OS_WIN)
#include "base/test/test_switches.h"
#include "base/win/win_util.h"
#endif // defined(OS_WIN)
int main(int argc, char** argv) {
base::CommandLine::Init(argc, argv);
size_t parallel_jobs = base::NumParallelJobs();
if (parallel_jobs == 0U) {
return 1;
} else if (parallel_jobs > 1U) {
parallel_jobs /= 2U;
#if defined(OS_WIN)
// Many tests validate code that requires user32.dll to be loaded. Loading it,
// however, cannot be done on the main thread loop because it is a blocking
// call, and all the test code runs on the main thread loop. Instead, just
// load and pin the module early on in startup before the blocking becomes an
// issue.
// Enable high-DPI for interactive tests where the user is expected to
// manually verify results.
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kTestLauncherInteractive)) {
#endif // defined(OS_WIN)
ChromeTestSuiteRunner runner;
ChromeTestLauncherDelegate delegate(&runner);
return LaunchChromeTests(parallel_jobs, &delegate, argc, argv);