0

Revert "[headless] Remove duplicate command line switch declarations"

This reverts commit 93fbdc4cc9.

Reason for revert: This CL is a suspect for https://crbug.com/1512227

Original change's description:
> [headless] Remove duplicate command line switch declarations
>
> Old headless declared kEnableCrashReporter and kProxyServer
> which are also declared in //base and //content respectively,
> and can be included from there, so no duplicate declaration
> is necessary. This CL removes the duplicate declarations.
>
> This is in anticipation of a larger CL that would move
> headless specific command line switches declaration from
> headless::switches to global ::switches namespace.
>
> Change-Id: I100b7f93add6c479fd49785ffa1266f5fb93c57a
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5089708
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
> Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1234610}

Change-Id: I6e0fa27c1ecbc1007d75cc26b250d300ac22e90a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5133137
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Tommy Nyquist <nyquist@chromium.org>
Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1238810}
This commit is contained in:
Peter Kvitek
2023-12-18 22:29:35 +00:00
committed by Chromium LUCI CQ
parent a705c54e53
commit 4793d45759
6 changed files with 15 additions and 11 deletions

@ -24,10 +24,6 @@
#include "headless/public/headless_shell.h"
#include "headless/public/switches.h"
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
#include "base/base_switches.h"
#endif
#if BUILDFLAG(IS_MAC)
#include "chrome/app/chrome_main_mac.h"
#include "chrome/app/notification_metrics.h"
@ -178,7 +174,7 @@ int ChromeMain(int argc, const char** argv) {
BUILDFLAG(IS_WIN)
if (headless::IsOldHeadlessMode()) {
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
command_line->AppendSwitch(::switches::kEnableCrashReporter);
command_line->AppendSwitch(::headless::switches::kEnableCrashReporter);
#endif
return headless::HeadlessShellMain(std::move(params));
}

@ -75,10 +75,10 @@ bool HandleRemoteDebuggingPort(base::CommandLine& command_line,
void HandleProxyServer(base::CommandLine& command_line,
HeadlessBrowser::Options::Builder& builder) {
DCHECK(command_line.HasSwitch(::switches::kProxyServer));
DCHECK(command_line.HasSwitch(switches::kProxyServer));
std::string proxy_server =
command_line.GetSwitchValueASCII(::switches::kProxyServer);
command_line.GetSwitchValueASCII(switches::kProxyServer);
auto proxy_config = std::make_unique<net::ProxyConfig>();
proxy_config->proxy_rules().ParseFromString(proxy_server);
if (command_line.HasSwitch(switches::kProxyBypassList)) {
@ -173,7 +173,7 @@ bool HandleCommandLineSwitches(base::CommandLine& command_line,
builder.EnableDevToolsPipe();
}
if (command_line.HasSwitch(::switches::kProxyServer)) {
if (command_line.HasSwitch(switches::kProxyServer)) {
HandleProxyServer(command_line, builder);
}

@ -339,7 +339,7 @@ void HeadlessContentMainDelegate::InitCrashReporter(
command_line.GetSwitchValueASCII(::switches::kProcessType);
bool enable_crash_reporter =
process_type.empty() &&
command_line.HasSwitch(::switches::kEnableCrashReporter) &&
command_line.HasSwitch(switches::kEnableCrashReporter) &&
!command_line.HasSwitch(switches::kDisableCrashReporter);
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)

@ -44,6 +44,9 @@ const char kDiskCacheDir[] = "disk-cache-dir";
// (experimental).
const char kEnableBeginFrameControl[] = "enable-begin-frame-control";
// Enable crash reporter for headless.
const char kEnableCrashReporter[] = "enable-crash-reporter";
// Enable hardware GPU support.
// Headless uses swiftshader by default for consistency across headless
// environments. This flag just turns forcing of swiftshader off and lets
@ -84,6 +87,10 @@ const char kPasswordStore[] = "password-store";
// "net/proxy_resolution/proxy_bypass_rules.h" for the format of these rules.
const char kProxyBypassList[] = "proxy-bypass-list";
// Uses a specified proxy server, overrides system settings. This switch only
// affects HTTP and HTTPS requests.
const char kProxyServer[] = "proxy-server";
// Use the given address instead of the default loopback for accepting remote
// debugging connections. Should be used together with --remote-debugging-port.
// Note that the remote debugging protocol does not perform any authentication,

@ -23,6 +23,7 @@ HEADLESS_EXPORT extern const char kDisableCrashReporter[];
HEADLESS_EXPORT extern const char kDisableLazyLoading[];
HEADLESS_EXPORT extern const char kDiskCacheDir[];
HEADLESS_EXPORT extern const char kEnableBeginFrameControl[];
HEADLESS_EXPORT extern const char kEnableCrashReporter[];
HEADLESS_EXPORT extern const char kEnableGPU[];
HEADLESS_EXPORT extern const char kExplicitlyAllowedPorts[];
HEADLESS_EXPORT extern const char kFontRenderHinting[];
@ -30,6 +31,7 @@ HEADLESS_EXPORT extern const char kIncognito[];
HEADLESS_EXPORT extern const char kNoSystemProxyConfigService[];
HEADLESS_EXPORT extern const char kPasswordStore[];
HEADLESS_EXPORT extern const char kProxyBypassList[];
HEADLESS_EXPORT extern const char kProxyServer[];
HEADLESS_EXPORT extern const char kRemoteDebuggingAddress[];
HEADLESS_EXPORT extern const char kUserAgent[];
HEADLESS_EXPORT extern const char kUserDataDir[];

@ -7,7 +7,6 @@
#include <tuple>
#include <vector>
#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/files/file_enumerator.h"
#include "base/files/file_util.h"
@ -430,7 +429,7 @@ class CrashReporterTest : public HeadlessBrowserTest,
void SetUpCommandLine(base::CommandLine* command_line) override {
base::CreateNewTempDirectory(FILE_PATH_LITERAL("CrashReporterTest"),
&crash_dumps_dir_);
command_line->AppendSwitch(::switches::kEnableCrashReporter);
command_line->AppendSwitch(switches::kEnableCrashReporter);
command_line->AppendSwitchPath(switches::kCrashDumpsDir, crash_dumps_dir_);
HeadlessBrowserTest::SetUpCommandLine(command_line);
}