From 5b6656450740d687c2d3add5ef3dda1c3806e439 Mon Sep 17 00:00:00 2001 From: brave-builds Date: Thu, 27 Apr 2023 20:49:26 +0000 Subject: [PATCH] Uplift of #18153 (squashed) to beta --- .../net/brave_network_audit_browsertest.cc | 14 +++++++++++ .../affiliation_fetcher_factory_impl.cc | 23 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc diff --git a/browser/net/brave_network_audit_browsertest.cc b/browser/net/brave_network_audit_browsertest.cc index 5b7d352cad5f..0ae67e3fad10 100644 --- a/browser/net/brave_network_audit_browsertest.cc +++ b/browser/net/brave_network_audit_browsertest.cc @@ -21,6 +21,7 @@ #include "brave/browser/ui/brave_browser.h" #include "brave/components/brave_rewards/browser/rewards_service_impl.h" #include "brave/components/playlist/common/buildflags/buildflags.h" +#include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/test/base/in_process_browser_test.h" @@ -300,6 +301,19 @@ IN_PROC_BROWSER_TEST_F(BraveNetworkAuditTest, BasicTests) { ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://welcome"))); WaitForTimeout(kMaxTimeoutPerLoadedURL); + // Add a password to the password manager. + password_manager::PasswordStoreInterface* password_store = + PasswordStoreFactory::GetForProfile(browser()->profile(), + ServiceAccessType::IMPLICIT_ACCESS) + .get(); + password_manager::PasswordForm signin_form; + signin_form.signon_realm = "https://www.facebook.com/"; + signin_form.url = GURL("https://www.facebook.com/"); + signin_form.action = GURL("https://www.facebook.com/"); + signin_form.username_value = u"john"; + signin_form.password_value = u"password1"; + password_store->AddLogin(signin_form); + // Load the NTP to check requests made from the JS widgets. ASSERT_TRUE(ui_test_utils::NavigateToURL(browser(), GURL("brave://newtab"))); WaitForTimeout(kMaxTimeoutPerLoadedURL); diff --git a/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc b/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc new file mode 100644 index 000000000000..a39ae07a3e4f --- /dev/null +++ b/chromium_src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc @@ -0,0 +1,23 @@ +/* Copyright (c) 2023 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 "components/password_manager/core/browser/affiliation/hash_affiliation_fetcher.h" + +namespace { + +class BraveHashAffiliationFetcher + : public password_manager::HashAffiliationFetcher { + public: + using HashAffiliationFetcher::HashAffiliationFetcher; + + void StartRequest(const std::vector& facet_uris, + RequestInfo request_info) override {} +}; + +} // namespace + +#define HashAffiliationFetcher BraveHashAffiliationFetcher +#include "src/components/password_manager/core/browser/affiliation/affiliation_fetcher_factory_impl.cc" +#undef HashAffiliationFetcher