Commit ff94f947 authored by Peter Kvitek's avatar Peter Kvitek Committed by Commit Bot

[headless] Added 'no-system-proxy-config-service' command line switch.

Adding this switch to headless browser tests ensures that proxy related
tests are not affected by a platform specific system proxy configuration
service.

This fixes HeadlessProtocolCompositorBrowserTest.BrowserSetInitialProxyConfig
issues when running on Windows.

Bug: 1134929
Change-Id: Ib245a4fe660eacaab944521a56ed9f2d1f525b73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2489779Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Peter Kvitek <kvitekp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819454}
parent 9ca4b613
...@@ -75,6 +75,9 @@ const char kProxyBypassList[] = "proxy-bypass-list"; ...@@ -75,6 +75,9 @@ const char kProxyBypassList[] = "proxy-bypass-list";
// affects HTTP and HTTPS requests. // affects HTTP and HTTPS requests.
const char kProxyServer[] = "proxy-server"; const char kProxyServer[] = "proxy-server";
// Do not use system proxy configuration service.
const char kNoSystemProxyConfigService[] = "no-system-proxy-config-service";
// Use the given address instead of the default loopback for accepting remote // Use the given address instead of the default loopback for accepting remote
// debugging connections. Should be used together with --remote-debugging-port. // debugging connections. Should be used together with --remote-debugging-port.
// Note that the remote debugging protocol does not perform any authentication, // Note that the remote debugging protocol does not perform any authentication,
......
...@@ -27,6 +27,7 @@ HEADLESS_EXPORT extern const char kPrintToPDF[]; ...@@ -27,6 +27,7 @@ HEADLESS_EXPORT extern const char kPrintToPDF[];
HEADLESS_EXPORT extern const char kPrintToPDFNoHeader[]; HEADLESS_EXPORT extern const char kPrintToPDFNoHeader[];
HEADLESS_EXPORT extern const char kProxyBypassList[]; HEADLESS_EXPORT extern const char kProxyBypassList[];
HEADLESS_EXPORT extern const char kProxyServer[]; HEADLESS_EXPORT extern const char kProxyServer[];
HEADLESS_EXPORT extern const char kNoSystemProxyConfigService[];
HEADLESS_EXPORT extern const char kRemoteDebuggingAddress[]; HEADLESS_EXPORT extern const char kRemoteDebuggingAddress[];
HEADLESS_EXPORT extern const char kRepl[]; HEADLESS_EXPORT extern const char kRepl[];
HEADLESS_EXPORT extern const char kScreenshot[]; HEADLESS_EXPORT extern const char kScreenshot[];
......
...@@ -210,8 +210,13 @@ HeadlessRequestContextManager::HeadlessRequestContextManager( ...@@ -210,8 +210,13 @@ HeadlessRequestContextManager::HeadlessRequestContextManager(
: nullptr), : nullptr),
resource_context_(std::make_unique<content::ResourceContext>()) { resource_context_(std::make_unique<content::ResourceContext>()) {
if (!proxy_config_) { if (!proxy_config_) {
proxy_config_monitor_ = std::make_unique<HeadlessProxyConfigMonitor>( base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
base::ThreadTaskRunnerHandle::Get()); if (command_line->HasSwitch(switches::kNoSystemProxyConfigService)) {
proxy_config_ = std::make_unique<net::ProxyConfig>();
} else {
proxy_config_monitor_ = std::make_unique<HeadlessProxyConfigMonitor>(
base::ThreadTaskRunnerHandle::Get());
}
} }
#if defined(OS_LINUX) && !defined(OS_CHROMEOS) #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
auto crypt_config = BuildCryptConfigOnce(user_data_path_); auto crypt_config = BuildCryptConfigOnce(user_data_path_);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/viz/common/switches.h" #include "components/viz/common/switches.h"
#include "content/public/common/content_switches.h" #include "content/public/common/content_switches.h"
#include "content/public/test/browser_test.h" #include "content/public/test/browser_test.h"
#include "headless/app/headless_shell_switches.h"
#include "headless/public/devtools/domains/runtime.h" #include "headless/public/devtools/domains/runtime.h"
#include "headless/public/headless_browser.h" #include "headless/public/headless_browser.h"
#include "headless/public/headless_browser_context.h" #include "headless/public/headless_browser_context.h"
...@@ -56,6 +57,10 @@ class HeadlessProtocolBrowserTest ...@@ -56,6 +57,10 @@ class HeadlessProtocolBrowserTest
// Make sure the navigations spawn new processes. We run test harness // Make sure the navigations spawn new processes. We run test harness
// in one process (harness.test) and tests in another. // in one process (harness.test) and tests in another.
command_line->AppendSwitch(::switches::kSitePerProcess); command_line->AppendSwitch(::switches::kSitePerProcess);
// Make sure proxy related tests are not affected by a platform specific
// system proxy configuration service.
command_line->AppendSwitch(switches::kNoSystemProxyConfigService);
} }
private: private:
...@@ -286,8 +291,8 @@ class HeadlessProtocolCompositorBrowserTest ...@@ -286,8 +291,8 @@ class HeadlessProtocolCompositorBrowserTest
static const char* const compositor_switches[] = { static const char* const compositor_switches[] = {
// We control BeginFrames ourselves and need all compositing stages to // We control BeginFrames ourselves and need all compositing stages to
// run. // run.
switches::kRunAllCompositorStagesBeforeDraw, ::switches::kRunAllCompositorStagesBeforeDraw,
switches::kDisableNewContentRenderingTimeout, ::switches::kDisableNewContentRenderingTimeout,
// Animtion-only BeginFrames are only supported when updates from the // Animtion-only BeginFrames are only supported when updates from the
// impl-thread are disabled, see go/headless-rendering. // impl-thread are disabled, see go/headless-rendering.
...@@ -433,13 +438,7 @@ HEADLESS_PROTOCOL_COMPOSITOR_TEST(RendererCanvas, "sanity/renderer-canvas.js") ...@@ -433,13 +438,7 @@ HEADLESS_PROTOCOL_COMPOSITOR_TEST(RendererCanvas, "sanity/renderer-canvas.js")
HEADLESS_PROTOCOL_COMPOSITOR_TEST(RendererOpacityAnimation, HEADLESS_PROTOCOL_COMPOSITOR_TEST(RendererOpacityAnimation,
"sanity/renderer-opacity-animation.js") "sanity/renderer-opacity-animation.js")
// Flaky on Windows (crbug.com/1134929). HEADLESS_PROTOCOL_COMPOSITOR_TEST(BrowserSetInitialProxyConfig,
#if defined(OS_WIN)
#define MAYBE_BrowserSetInitialProxyConfig DISABLED_BrowserSetInitialProxyConfig
#else
#define MAYBE_BrowserSetInitialProxyConfig BrowserSetInitialProxyConfig
#endif
HEADLESS_PROTOCOL_COMPOSITOR_TEST(MAYBE_BrowserSetInitialProxyConfig,
"sanity/browser-set-initial-proxy-config.js") "sanity/browser-set-initial-proxy-config.js")
} // namespace headless } // namespace headless
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