From ec4ccbbdb527e2f9f7693318bd35998077a4332b Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Wed, 30 Sep 2020 19:11:39 -0400 Subject: [PATCH 1/3] implement Sec-GPC header and globalPrivacyControl JS API --- browser/net/BUILD.gn | 2 + browser/net/brave_request_handler.cc | 5 +++ ...privacy_control_network_delegate_helper.cc | 24 +++++++++++ ..._privacy_control_network_delegate_helper.h | 22 ++++++++++ common/network_constants.cc | 2 + common/network_constants.h | 2 + third_party/blink/renderer/includes.gni | 8 +++- .../modules/global_privacy_control/BUILD.gn | 13 ++++++ .../modules/global_privacy_control/idls.gni | 6 +++ .../navigator_global_privacy_control.cc | 40 +++++++++++++++++++ .../navigator_global_privacy_control.h | 39 ++++++++++++++++++ .../navigator_global_privacy_control.idl | 9 +++++ 12 files changed, 170 insertions(+), 2 deletions(-) create mode 100644 browser/net/global_privacy_control_network_delegate_helper.cc create mode 100644 browser/net/global_privacy_control_network_delegate_helper.h create mode 100644 third_party/blink/renderer/modules/global_privacy_control/BUILD.gn create mode 100644 third_party/blink/renderer/modules/global_privacy_control/idls.gni create mode 100644 third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.cc create mode 100644 third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.h create mode 100644 third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.idl diff --git a/browser/net/BUILD.gn b/browser/net/BUILD.gn index 63322bef3b8e..1d0e64a8ed51 100644 --- a/browser/net/BUILD.gn +++ b/browser/net/BUILD.gn @@ -34,6 +34,8 @@ source_set("net") { "brave_stp_util.h", "brave_system_request_handler.cc", "brave_system_request_handler.h", + "global_privacy_control_network_delegate_helper.cc", + "global_privacy_control_network_delegate_helper.h", "resource_context_data.cc", "resource_context_data.h", "url_context.cc", diff --git a/browser/net/brave_request_handler.cc b/browser/net/brave_request_handler.cc index 353ee1c2033c..57f17fa97d16 100644 --- a/browser/net/brave_request_handler.cc +++ b/browser/net/brave_request_handler.cc @@ -15,6 +15,7 @@ #include "brave/browser/net/brave_httpse_network_delegate_helper.h" #include "brave/browser/net/brave_site_hacks_network_delegate_helper.h" #include "brave/browser/net/brave_stp_util.h" +#include "brave/browser/net/global_privacy_control_network_delegate_helper.h" #include "brave/browser/translate/buildflags/buildflags.h" #include "brave/common/pref_names.h" #include "brave/components/brave_referrals/buildflags/buildflags.h" @@ -100,6 +101,10 @@ void BraveRequestHandler::SetupCallbacks() { base::Bind(brave::OnBeforeStartTransaction_SiteHacksWork); before_start_transaction_callbacks_.push_back(start_transaction_callback); + start_transaction_callback = + base::Bind(brave::OnBeforeStartTransaction_GlobalPrivacyControlWork); + before_start_transaction_callbacks_.push_back(start_transaction_callback); + #if BUILDFLAG(ENABLE_BRAVE_REFERRALS) start_transaction_callback = base::Bind(brave::OnBeforeStartTransaction_ReferralsWork); diff --git a/browser/net/global_privacy_control_network_delegate_helper.cc b/browser/net/global_privacy_control_network_delegate_helper.cc new file mode 100644 index 000000000000..5616cc6fbcfb --- /dev/null +++ b/browser/net/global_privacy_control_network_delegate_helper.cc @@ -0,0 +1,24 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/browser/net/global_privacy_control_network_delegate_helper.h" + +#include + +#include "brave/common/network_constants.h" +#include "net/base/net_errors.h" +#include "net/http/http_request_headers.h" + +namespace brave { + +int OnBeforeStartTransaction_GlobalPrivacyControlWork( + net::HttpRequestHeaders* headers, + const ResponseCallback& next_callback, + std::shared_ptr ctx) { + headers->SetHeader(kSecGpcHeader, "1"); + return net::OK; +} + +} // namespace brave diff --git a/browser/net/global_privacy_control_network_delegate_helper.h b/browser/net/global_privacy_control_network_delegate_helper.h new file mode 100644 index 000000000000..628077f319b6 --- /dev/null +++ b/browser/net/global_privacy_control_network_delegate_helper.h @@ -0,0 +1,22 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef BRAVE_BROWSER_NET_GLOBAL_PRIVACY_CONTROL_NETWORK_DELEGATE_HELPER_H_ +#define BRAVE_BROWSER_NET_GLOBAL_PRIVACY_CONTROL_NETWORK_DELEGATE_HELPER_H_ + +#include + +#include "brave/browser/net/url_context.h" + +namespace brave { + +int OnBeforeStartTransaction_GlobalPrivacyControlWork( + net::HttpRequestHeaders* headers, + const ResponseCallback& next_callback, + std::shared_ptr ctx); + +} // namespace brave + +#endif // BRAVE_BROWSER_NET_GLOBAL_PRIVACY_CONTROL_NETWORK_DELEGATE_HELPER_H_ diff --git a/common/network_constants.cc b/common/network_constants.cc index f3e4596fde94..25a25d7aca4e 100644 --- a/common/network_constants.cc +++ b/common/network_constants.cc @@ -54,3 +54,5 @@ const char kBraveServicesKeyHeader[] = "BraveServiceKey"; const char kBittorrentMimeType[] = "application/x-bittorrent"; const char kOctetStreamMimeType[] = "application/octet-stream"; + +const char kSecGpcHeader[] = "Sec-GPC"; diff --git a/common/network_constants.h b/common/network_constants.h index 8c6955551dd5..5056244f3e7a 100644 --- a/common/network_constants.h +++ b/common/network_constants.h @@ -41,4 +41,6 @@ extern const char kBraveServicesKeyHeader[]; extern const char kBittorrentMimeType[]; extern const char kOctetStreamMimeType[]; + +extern const char kSecGpcHeader[]; #endif // BRAVE_COMMON_NETWORK_CONSTANTS_H_ diff --git a/third_party/blink/renderer/includes.gni b/third_party/blink/renderer/includes.gni index dd50633d7db9..1be86945c8e2 100644 --- a/third_party/blink/renderer/includes.gni +++ b/third_party/blink/renderer/includes.gni @@ -15,9 +15,13 @@ brave_blink_renderer_modules_visibility = [ ] brave_blink_sub_modules = [ - "//brave/third_party/blink/renderer/modules/brave" + "//brave/third_party/blink/renderer/modules/brave", + "//brave/third_party/blink/renderer/modules/global_privacy_control" ] # common includes which can help minimize patches for # src/third_party/blink/renderer/modules/modules_idl_files.gni -brave_idl_imports = [ "//brave/third_party/blink/renderer/modules/brave/idls.gni" ] +brave_idl_imports = [ + "//brave/third_party/blink/renderer/modules/brave/idls.gni", + "//brave/third_party/blink/renderer/modules/global_privacy_control/idls.gni" +] diff --git a/third_party/blink/renderer/modules/global_privacy_control/BUILD.gn b/third_party/blink/renderer/modules/global_privacy_control/BUILD.gn new file mode 100644 index 000000000000..d1f1cfc20a06 --- /dev/null +++ b/third_party/blink/renderer/modules/global_privacy_control/BUILD.gn @@ -0,0 +1,13 @@ +# Copyright (c) 2020 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +import("//third_party/blink/renderer/modules/modules.gni") + +blink_modules_sources("global_privacy_control") { + sources = [ + "navigator_global_privacy_control.cc", + "navigator_global_privacy_control.h", + ] +} diff --git a/third_party/blink/renderer/modules/global_privacy_control/idls.gni b/third_party/blink/renderer/modules/global_privacy_control/idls.gni new file mode 100644 index 000000000000..259c13d0bda2 --- /dev/null +++ b/third_party/blink/renderer/modules/global_privacy_control/idls.gni @@ -0,0 +1,6 @@ +# Copyright (c) 2020 The Brave Authors. All rights reserved. +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +modules_dependency_idl_files = [ "navigator_global_privacy_control.idl" ] diff --git a/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.cc b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.cc new file mode 100644 index 000000000000..087b9fd055ac --- /dev/null +++ b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.cc @@ -0,0 +1,40 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "brave/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.h" + +#include "third_party/blink/renderer/core/frame/navigator.h" + +namespace blink { + +NavigatorGlobalPrivacyControl:: + NavigatorGlobalPrivacyControl(Navigator& navigator) // NOLINT + : Supplement(navigator) {} + +// static +const char NavigatorGlobalPrivacyControl::kSupplementName[] = + "NavigatorGlobalPrivacyControl"; + +NavigatorGlobalPrivacyControl& + NavigatorGlobalPrivacyControl::From(Navigator& navigator) { + NavigatorGlobalPrivacyControl* supplement = + Supplement::From(navigator); + if (!supplement) { + supplement = MakeGarbageCollected(navigator); + ProvideTo(navigator, supplement); + } + return *supplement; +} + +bool NavigatorGlobalPrivacyControl:: + globalPrivacyControl(blink::Navigator& navigator) { // NOLINT + return true; +} + +void NavigatorGlobalPrivacyControl::Trace(blink::Visitor* visitor) const { + Supplement::Trace(visitor); +} + +} // namespace blink diff --git a/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.h b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.h new file mode 100644 index 000000000000..160d758b2c80 --- /dev/null +++ b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.h @@ -0,0 +1,39 @@ +// Copyright (c) 2020 The Brave Authors. All rights reserved. +// This Source Code Form is subject to the terms of the Mozilla Public +// License, v. 2.0. If a copy of the MPL was not distributed with this file, +// you can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef BRAVE_THIRD_PARTY_BLINK_RENDERER_MODULES_GLOBAL_PRIVACY_CONTROL_NAVIGATOR_GLOBAL_PRIVACY_CONTROL_H_ +#define BRAVE_THIRD_PARTY_BLINK_RENDERER_MODULES_GLOBAL_PRIVACY_CONTROL_NAVIGATOR_GLOBAL_PRIVACY_CONTROL_H_ + +#include "third_party/blink/renderer/core/frame/navigator.h" +#include "third_party/blink/renderer/platform/bindings/name_client.h" +#include "third_party/blink/renderer/platform/heap/handle.h" +#include "third_party/blink/renderer/platform/supplementable.h" + +namespace blink { + +class Navigator; + +class NavigatorGlobalPrivacyControl final + : public GarbageCollected, + public Supplement, + public NameClient { + + public: + static const char kSupplementName[]; + + static NavigatorGlobalPrivacyControl& From(Navigator&); + static bool globalPrivacyControl(blink::Navigator&); + + explicit NavigatorGlobalPrivacyControl(Navigator&); + + void Trace(blink::Visitor*) const override; + const char* NameInHeapSnapshot() const override { + return "NavigatorGlobalPrivacyControl"; + } +}; + +} // namespace blink + +#endif // BRAVE_THIRD_PARTY_BLINK_RENDERER_MODULES_GLOBAL_PRIVACY_CONTROL_NAVIGATOR_GLOBAL_PRIVACY_CONTROL_H_ diff --git a/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.idl b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.idl new file mode 100644 index 000000000000..0b58d9a59997 --- /dev/null +++ b/third_party/blink/renderer/modules/global_privacy_control/navigator_global_privacy_control.idl @@ -0,0 +1,9 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ +[ + ImplementedAs=NavigatorGlobalPrivacyControl +] partial interface Navigator { + readonly attribute boolean globalPrivacyControl; +}; From 4a655e050afae8c39f2d95fa1aeb35b2471c4d76 Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Thu, 1 Oct 2020 13:26:57 -0400 Subject: [PATCH 2/3] add feature flag controlling Sec-GPC header --- app/brave_main_delegate.cc | 7 +++++++ .../net/global_privacy_control_network_delegate_helper.cc | 6 +++++- chromium_src/chrome/browser/flag_descriptions.h | 2 ++ common/brave_features.cc | 6 ++++++ common/brave_features.h | 2 ++ 5 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/brave_main_delegate.cc b/app/brave_main_delegate.cc index 62531270ce3f..c48493bfe314 100644 --- a/app/brave_main_delegate.cc +++ b/app/brave_main_delegate.cc @@ -17,12 +17,14 @@ #include "brave/app/brave_command_line_helper.h" #include "brave/browser/brave_content_browser_client.h" #include "brave/common/brave_switches.h" +#include "brave/common/brave_features.h" #include "brave/common/resource_bundle_helper.h" #include "brave/components/brave_ads/browser/buildflags/buildflags.h" #include "brave/renderer/brave_content_renderer_client.h" #include "brave/utility/brave_content_utility_client.h" #include "build/build_config.h" #include "chrome/browser/ui/ui_features.h" +#include "chrome/common/channel_info.h" #include "chrome/common/chrome_features.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_paths_internal.h" @@ -39,6 +41,7 @@ #include "components/security_state/core/features.h" #include "components/sync/base/sync_base_switches.h" #include "components/translate/core/browser/translate_prefs.h" +#include "components/version_info/channel.h" #include "content/public/common/content_features.h" #include "content/public/common/content_switches.h" #include "google_apis/gaia/gaia_switches.h" @@ -225,6 +228,10 @@ bool BraveMainDelegate::BasicStartupComplete(int* exit_code) { enabled_features.insert(features::kDnsOverHttps.name); } + if (chrome::GetChannel() == version_info::Channel::CANARY) { + enabled_features.insert(features::kGlobalPrivacyControl.name); + } + // Disabled features. const std::unordered_set disabled_features = { autofill::features::kAutofillEnableAccountWalletStorage.name, diff --git a/browser/net/global_privacy_control_network_delegate_helper.cc b/browser/net/global_privacy_control_network_delegate_helper.cc index 5616cc6fbcfb..f7d59223d1dc 100644 --- a/browser/net/global_privacy_control_network_delegate_helper.cc +++ b/browser/net/global_privacy_control_network_delegate_helper.cc @@ -7,6 +7,8 @@ #include +#include "base/feature_list.h" +#include "brave/common/brave_features.h" #include "brave/common/network_constants.h" #include "net/base/net_errors.h" #include "net/http/http_request_headers.h" @@ -17,7 +19,9 @@ int OnBeforeStartTransaction_GlobalPrivacyControlWork( net::HttpRequestHeaders* headers, const ResponseCallback& next_callback, std::shared_ptr ctx) { - headers->SetHeader(kSecGpcHeader, "1"); + if (base::FeatureList::IsEnabled(features::kGlobalPrivacyControl)) { + headers->SetHeader(kSecGpcHeader, "1"); + } return net::OK; } diff --git a/chromium_src/chrome/browser/flag_descriptions.h b/chromium_src/chrome/browser/flag_descriptions.h index 389c8b806dd8..51258c20b6ce 100644 --- a/chromium_src/chrome/browser/flag_descriptions.h +++ b/chromium_src/chrome/browser/flag_descriptions.h @@ -17,6 +17,8 @@ extern const char kBraveNTPBrandedWallpaperDemoName[]; extern const char kBraveNTPBrandedWallpaperDemoDescription[]; extern const char kBraveAdblockCosmeticFilteringName[]; extern const char kBraveAdblockCosmeticFilteringDescription[]; +extern const char kGlobalPrivacyControlName[]; +extern const char kGlobalPrivacyControlDescription[]; extern const char kBraveSpeedreaderName[]; extern const char kBraveSpeedreaderDescription[]; extern const char kBraveSyncName[]; diff --git a/common/brave_features.cc b/common/brave_features.cc index 3eb1ce3d8220..fa4d05716623 100644 --- a/common/brave_features.cc +++ b/common/brave_features.cc @@ -19,4 +19,10 @@ const base::Feature kBraveRewards{"BraveRewards", #endif #endif // defined(OS_ANDROID) +// Toggles Global Privacy Control, which conveys a user's request to websites +// and services to not sell or share their personal information with third +// parties. +const base::Feature kGlobalPrivacyControl{"GlobalPrivacyControl", + base::FEATURE_DISABLED_BY_DEFAULT}; + } // namespace features diff --git a/common/brave_features.h b/common/brave_features.h index 79ff9bb76a1f..82ee983c5838 100644 --- a/common/brave_features.h +++ b/common/brave_features.h @@ -17,6 +17,8 @@ COMPONENT_EXPORT(CHROME_FEATURES) extern const base::Feature kBraveRewards; #endif // defined(OS_ANDROID) +extern const base::Feature kGlobalPrivacyControl; + } // namespace features #endif // BRAVE_COMMON_BRAVE_FEATURES_H_ From 798d7f44178adca47c808f472abca74dbcf6f32e Mon Sep 17 00:00:00 2001 From: Anton Lazarev Date: Thu, 1 Oct 2020 20:12:00 -0400 Subject: [PATCH 3/3] add tests --- ...rol_network_delegate_helper_browsertest.cc | 126 ++++++++++++++++++ test/BUILD.gn | 1 + 2 files changed, 127 insertions(+) create mode 100644 browser/net/global_privacy_control_network_delegate_helper_browsertest.cc diff --git a/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc b/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc new file mode 100644 index 000000000000..fefa8f518a10 --- /dev/null +++ b/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc @@ -0,0 +1,126 @@ +/* Copyright (c) 2020 The Brave Authors. All rights reserved. + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at https://mozilla.org/MPL/2.0/. */ + +#include "brave/common/brave_features.h" +#include "brave/common/network_constants.h" +#include "chrome/browser/ui/browser.h" +#include "chrome/test/base/in_process_browser_test.h" +#include "chrome/test/base/ui_test_utils.h" +#include "components/network_session_configurator/common/network_switches.h" +#include "content/public/test/browser_test.h" +#include "content/public/test/browser_test_utils.h" +#include "content/public/test/test_utils.h" +#include "net/dns/mock_host_resolver.h" +#include "net/test/embedded_test_server/http_request.h" + +enum class GPCHeaderResult { + kOk, + kNoRequest, + kNoHeader, + kWrongValue, +}; + +class GlobalPrivacyControlNetworkDelegateBrowserTest + : public InProcessBrowserTest { + public: + GlobalPrivacyControlNetworkDelegateBrowserTest() + : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) { + feature_list_.InitAndEnableFeature(features::kGlobalPrivacyControl); + } + + void SetUpOnMainThread() override { + InProcessBrowserTest::SetUpOnMainThread(); + + header_result_ = GPCHeaderResult::kNoRequest; + + host_resolver()->AddRule("*", "127.0.0.1"); + + https_server_.RegisterRequestMonitor(base::BindRepeating( + &GlobalPrivacyControlNetworkDelegateBrowserTest::HandleRequest, + base::Unretained(this))); + + ASSERT_TRUE(https_server_.Start()); + } + + void HandleRequest(const net::test_server::HttpRequest& request) { + base::AutoLock auto_lock(header_result_lock_); + + auto it = request.headers.find(kSecGpcHeader); + if (it == request.headers.end()) { + header_result_ = GPCHeaderResult::kNoHeader; + } else if (it ->second != "1") { + header_result_ = GPCHeaderResult::kWrongValue; + } else { + header_result_ = GPCHeaderResult::kOk; + } + } + + void SetUpCommandLine(base::CommandLine* command_line) override { + InProcessBrowserTest::SetUpCommandLine(command_line); + // Allows the embedded test server to serve HTTPS + command_line->AppendSwitch(switches::kIgnoreCertificateErrors); + } + + const net::EmbeddedTestServer& https_server() { return https_server_; } + + GPCHeaderResult header_result() { + base::AutoLock auto_lock(header_result_lock_); + return header_result_; + } + + protected: + base::test::ScopedFeatureList feature_list_; + + private: + net::test_server::EmbeddedTestServer https_server_; + mutable base::Lock header_result_lock_; + GPCHeaderResult header_result_; +}; + +// When kGlobalPrivacyControl is enabled, the Sec-GPC flag should appear on +// request headers. +IN_PROC_BROWSER_TEST_F(GlobalPrivacyControlNetworkDelegateBrowserTest, + IncludesSecGPCHeader) { + const GURL target = https_server().GetURL("example.com", "/index.html"); + ui_test_utils::NavigateToURL(browser(), target); + EXPECT_EQ(header_result(), GPCHeaderResult::kOk); +} + +// The Global Privacy Control spec also defines the +// `navigator.globalPrivacyControl` JS property, which is read-only. In Brave +// it will always return `true`. +IN_PROC_BROWSER_TEST_F(GlobalPrivacyControlNetworkDelegateBrowserTest, + NavigatorGlobalPrivacyAPI) { + const GURL target = https_server().GetURL("example.com", "/index.html"); + ui_test_utils::NavigateToURL(browser(), target); + + auto* rfh = + browser()->tab_strip_model()->GetActiveWebContents()->GetMainFrame(); + + EXPECT_EQ(true, content::EvalJs(rfh, "navigator.globalPrivacyControl")); + EXPECT_EQ(true, content::EvalJs(rfh, + "(function() {" + " navigator.globalPrivacyControl = false;" + " return navigator.globalPrivacyControl;" + "})()")); +} + +class DisabledGlobalPrivacyControlNetworkDelegateBrowserTest + : public GlobalPrivacyControlNetworkDelegateBrowserTest { + public: + DisabledGlobalPrivacyControlNetworkDelegateBrowserTest() { + feature_list_.Reset(); + feature_list_.InitAndDisableFeature(features::kGlobalPrivacyControl); + } +}; + +// When kGlobalPrivacyControl is disabled, the Sec-GPC flag should not appear +// on request headers. +IN_PROC_BROWSER_TEST_F(DisabledGlobalPrivacyControlNetworkDelegateBrowserTest, + ExcludesSecGPCHeader) { + const GURL target = https_server().GetURL("example.com", "/index.html"); + ui_test_utils::NavigateToURL(browser(), target); + EXPECT_EQ(header_result(), GPCHeaderResult::kNoHeader); +} diff --git a/test/BUILD.gn b/test/BUILD.gn index 8e2e6bc0a4b3..8f41e3df358a 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -531,6 +531,7 @@ test("brave_browser_tests") { "//brave/browser/net/brave_network_delegate_hsts_fingerprinting_browsertest.cc", "//brave/browser/net/brave_site_hacks_network_delegate_helper_browsertest.cc", "//brave/browser/net/brave_system_request_handler_browsertest.cc", + "//brave/browser/net/global_privacy_control_network_delegate_helper_browsertest.cc", "//brave/browser/policy/brave_policy_browsertest.cc", "//brave/browser/profiles/brave_bookmark_model_loaded_observer_browsertest.cc", "//brave/browser/profiles/brave_profile_manager_browsertest.cc",