Commit 4da6f11e authored by Robert Liao's avatar Robert Liao Committed by Commit Bot

Centralize --test-launcher-interactive Options To Browser Tests Main

This ensure all invocations of --test-launcher-interactive get the
prerequisite flags even if they do not run through
BrowserUiTest.Invoke.

BUG=687387

Change-Id: Iaa72a6281c0e561f44d919c487fd8b7bcbc1689c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816646Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
Commit-Queue: Robert Liao <robliao@chromium.org>
Auto-Submit: Robert Liao <robliao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700853}
parent c22120c7
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "build/build_config.h" #include "build/build_config.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/compositor_switches.h"
namespace { namespace {
...@@ -68,22 +67,13 @@ TEST(BrowserUiTest, Invoke) { ...@@ -68,22 +67,13 @@ TEST(BrowserUiTest, Invoke) {
base::LaunchOptions options; base::LaunchOptions options;
// Generate screen output if --test-launcher-interactive was specified.
if (command.HasSwitch(switches::kTestLauncherInteractive)) {
command.AppendSwitch(switches::kEnablePixelOutputInTests);
#if defined(OS_WIN) #if defined(OS_WIN)
// Under Windows, the child process won't launch without the wait option. // Under Windows, the child process won't launch without the wait option.
// See http://crbug.com/688534. // See http://crbug.com/688534.
options.wait = true; options.wait = true;
// Under Windows, dialogs (but not the browser window) created in the #else
// spawned browser_test process are invisible for some unknown reason. options.wait = !command.HasSwitch(switches::kTestLauncherInteractive);
// Pass in --disable-gpu to resolve this for now. See
// http://crbug.com/687387.
command.AppendSwitch(switches::kDisableGpu);
#endif #endif
} else {
options.wait = true;
}
base::LaunchProcess(command, options); base::LaunchProcess(command, options);
} }
...@@ -4,12 +4,14 @@ ...@@ -4,12 +4,14 @@
#include "base/command_line.h" #include "base/command_line.h"
#include "base/test/launcher/test_launcher.h" #include "base/test/launcher/test_launcher.h"
#include "base/test/test_switches.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "chrome/test/base/chrome_test_launcher.h" #include "chrome/test/base/chrome_test_launcher.h"
#include "chrome/test/base/chrome_test_suite.h" #include "chrome/test/base/chrome_test_suite.h"
#include "content/public/common/content_switches.h"
#include "ui/compositor/compositor_switches.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "base/test/test_switches.h"
#include "base/win/win_util.h" #include "base/win/win_util.h"
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
...@@ -29,14 +31,25 @@ int main(int argc, char** argv) { ...@@ -29,14 +31,25 @@ int main(int argc, char** argv) {
// load and pin the module early on in startup before the blocking becomes an // load and pin the module early on in startup before the blocking becomes an
// issue. // issue.
base::win::PinUser32(); base::win::PinUser32();
#endif // defined(OS_WIN)
// Enable high-DPI for interactive tests where the user is expected to // Enable high-DPI for interactive tests where the user is expected to
// manually verify results. // manually verify results.
if (base::CommandLine::ForCurrentProcess()->HasSwitch( base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
switches::kTestLauncherInteractive)) { if (command_line->HasSwitch(switches::kTestLauncherInteractive)) {
// Since the test is interactive, the invoker will want to have pixel output
// to actually see the result.
command_line->AppendSwitch(switches::kEnablePixelOutputInTests);
#if defined(OS_WIN)
// Under Windows, dialogs (but not the browser window) created in the
// spawned browser_test process are invisible for some unknown reason.
// Pass in --disable-gpu to resolve this for now. See
// http://crbug.com/687387.
command_line->AppendSwitch(switches::kDisableGpu);
base::win::EnableHighDPISupport(); base::win::EnableHighDPISupport();
}
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
}
ChromeTestSuiteRunner runner; ChromeTestSuiteRunner runner;
ChromeTestLauncherDelegate delegate(&runner); ChromeTestLauncherDelegate delegate(&runner);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment