Commit d548ffaf authored by Greg Thompson's avatar Greg Thompson Committed by Commit Bot

Do not show fatal errors in a dialog when CHROME_HEADLESS is set.

This makes handling of Chrome's own fatal messages consistent with
handling of system errors.

BUG=764415
R=siggi@chromium.org,sky@chromium.org

Change-Id: If60f3366d38d719741918982ce02265a766a3c08
Reviewed-on: https://chromium-review.googlesource.com/741232Reviewed-by: default avatarSigurður Ásgeirsson <siggi@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Greg Thompson <grt@chromium.org>
Cr-Commit-Position: refs/heads/master@{#512778}
parent 56ddcb18
...@@ -193,9 +193,15 @@ void InitChromeWatcherLogging(const base::CommandLine& command_line, ...@@ -193,9 +193,15 @@ void InitChromeWatcherLogging(const base::CommandLine& command_line,
return; return;
} }
// Default to showing error dialogs. // We call running in unattended mode "headless", and allow headless mode to
if (!base::CommandLine::ForCurrentProcess()->HasSwitch( // be configured either by the Environment Variable or by the Command Line
switches::kNoErrorDialogs)) // Switch. This is for automated test purposes.
std::unique_ptr<base::Environment> env(base::Environment::Create());
const bool is_headless = env->HasVar(env_vars::kHeadless) ||
command_line.HasSwitch(switches::kNoErrorDialogs);
// Show fatal log messages in a dialog in debug builds when not headless.
if (!is_headless)
SetShowErrorDialogs(true); SetShowErrorDialogs(true);
// we want process and thread IDs because we have a lot of things running // we want process and thread IDs because we have a lot of things running
...@@ -204,13 +210,8 @@ void InitChromeWatcherLogging(const base::CommandLine& command_line, ...@@ -204,13 +210,8 @@ void InitChromeWatcherLogging(const base::CommandLine& command_line,
true, // enable_timestamp true, // enable_timestamp
false); // enable_tickcount false); // enable_tickcount
// We call running in unattended mode "headless", and allow // Suppress system error dialogs when headless.
// headless mode to be configured either by the Environment if (is_headless)
// Variable or by the Command Line Switch. This is for
// automated test purposes.
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar(env_vars::kHeadless) ||
command_line.HasSwitch(switches::kNoErrorDialogs))
SuppressDialogs(); SuppressDialogs();
// Use a minimum log level if the command line asks for one. Ignore this // Use a minimum log level if the command line asks for one. Ignore this
......
...@@ -319,9 +319,15 @@ void InitChromeLogging(const base::CommandLine& command_line, ...@@ -319,9 +319,15 @@ void InitChromeLogging(const base::CommandLine& command_line,
} }
#endif #endif
// Default to showing error dialogs. // We call running in unattended mode "headless", and allow headless mode to
if (!base::CommandLine::ForCurrentProcess()->HasSwitch( // be configured either by the Environment Variable or by the Command Line
switches::kNoErrorDialogs)) // Switch. This is for automated test purposes.
std::unique_ptr<base::Environment> env(base::Environment::Create());
const bool is_headless = env->HasVar(env_vars::kHeadless) ||
command_line.HasSwitch(switches::kNoErrorDialogs);
// Show fatal log messages in a dialog in debug builds when not headless.
if (!is_headless)
SetShowErrorDialogs(true); SetShowErrorDialogs(true);
// we want process and thread IDs because we have a lot of things running // we want process and thread IDs because we have a lot of things running
...@@ -330,13 +336,8 @@ void InitChromeLogging(const base::CommandLine& command_line, ...@@ -330,13 +336,8 @@ void InitChromeLogging(const base::CommandLine& command_line,
true, // enable_timestamp true, // enable_timestamp
false); // enable_tickcount false); // enable_tickcount
// We call running in unattended mode "headless", and allow // Suppress system error dialogs when headless.
// headless mode to be configured either by the Environment if (is_headless)
// Variable or by the Command Line Switch. This is for
// automated test purposes.
std::unique_ptr<base::Environment> env(base::Environment::Create());
if (env->HasVar(env_vars::kHeadless) ||
command_line.HasSwitch(switches::kNoErrorDialogs))
SuppressDialogs(); SuppressDialogs();
// Use a minimum log level if the command line asks for one. Ignore this // Use a minimum log level if the command line asks for one. Ignore this
......
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