summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/net/proxy_test_utils.cc
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-02-13 10:55:42 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-03-05 13:33:38 +0000
commit248b70b82a40964d5594eb04feca0fa36716185d (patch)
tree44e31d9dd0ac2cb79f48633eefbc5496e013c347 /chromium/chrome/browser/net/proxy_test_utils.cc
parentcabfcdd1db482729ded525feae56911a99792773 (diff)
downloadqtwebengine-chromium-248b70b82a40964d5594eb04feca0fa36716185d.tar.gz
BASELINE: Update Chromium to 79.0.3945.147
And new simplified snapshot filter Change-Id: I7c692bedd5b3833f05565bd6f6939115350b233a Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/chrome/browser/net/proxy_test_utils.cc')
-rw-r--r--chromium/chrome/browser/net/proxy_test_utils.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/chromium/chrome/browser/net/proxy_test_utils.cc b/chromium/chrome/browser/net/proxy_test_utils.cc
new file mode 100644
index 00000000000..e26cec4d40f
--- /dev/null
+++ b/chromium/chrome/browser/net/proxy_test_utils.cc
@@ -0,0 +1,49 @@
+// Copyright 2019 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 "chrome/browser/net/proxy_test_utils.h"
+
+#include "base/test/bind_test_util.h"
+#include "chrome/common/chrome_switches.h"
+#include "content/public/common/content_switches.h"
+#include "content/public/test/url_loader_interceptor.h"
+#include "google_apis/gaia/gaia_urls.h"
+
+ProxyBrowserTest::ProxyBrowserTest()
+ : proxy_server_(net::SpawnedTestServer::TYPE_BASIC_AUTH_PROXY,
+ base::FilePath()) {}
+
+ProxyBrowserTest::~ProxyBrowserTest() {}
+
+void ProxyBrowserTest::SetUp() {
+ ASSERT_TRUE(proxy_server_.Start());
+ // Block the GaiaAuthFetcher related requests, they somehow interfere with
+ // the test when the network service is running.
+ url_loader_interceptor_ = std::make_unique<content::URLLoaderInterceptor>(
+ base::BindLambdaForTesting(
+ [&](content::URLLoaderInterceptor::RequestParams* params) -> bool {
+ if (params->url_request.url.host() ==
+ GaiaUrls::GetInstance()->gaia_url().host()) {
+ return true;
+ }
+ return false;
+ }));
+ InProcessBrowserTest::SetUp();
+}
+
+void ProxyBrowserTest::PostRunTestOnMainThread() {
+ url_loader_interceptor_.reset();
+ InProcessBrowserTest::PostRunTestOnMainThread();
+}
+
+void ProxyBrowserTest::SetUpCommandLine(base::CommandLine* command_line) {
+ command_line->AppendSwitchASCII(switches::kProxyServer,
+ proxy_server_.host_port_pair().ToString());
+
+ // TODO(https://crbug.com/901896): Don't rely on proxying localhost (Relied
+ // on by BasicAuthWSConnect)
+ command_line->AppendSwitchASCII(
+ switches::kProxyBypassList,
+ net::ProxyBypassRules::GetRulesToSubtractImplicit());
+}