Index: components/password_manager/core/browser/affiliation_fetcher.cc |
diff --git a/components/password_manager/core/browser/affiliation_fetcher.cc b/components/password_manager/core/browser/affiliation_fetcher.cc |
index 89139e54f18812295c626c52fb11a50f98f3a23c..92af8c41dd99d7a7aeb3117ee3944dd8edc25523 100644 |
--- a/components/password_manager/core/browser/affiliation_fetcher.cc |
+++ b/components/password_manager/core/browser/affiliation_fetcher.cc |
@@ -6,6 +6,7 @@ |
#include "components/password_manager/core/browser/affiliation_api.pb.h" |
#include "components/password_manager/core/browser/affiliation_utils.h" |
+#include "components/password_manager/core/browser/test_affiliation_fetcher_factory.h" |
#include "google_apis/google_api_keys.h" |
#include "net/base/load_flags.h" |
#include "net/base/url_util.h" |
@@ -16,6 +17,8 @@ |
namespace password_manager { |
+static TestAffiliationFetcherFactory* g_testing_factory = nullptr; |
+ |
AffiliationFetcher::AffiliationFetcher( |
net::URLRequestContextGetter* request_context_getter, |
const std::vector<FacetURI>& facet_uris, |
@@ -36,9 +39,19 @@ AffiliationFetcher* AffiliationFetcher::Create( |
net::URLRequestContextGetter* context_getter, |
const std::vector<FacetURI>& facet_uris, |
AffiliationFetcherDelegate* delegate) { |
+ if (g_testing_factory) { |
+ return g_testing_factory->CreateInstance(context_getter, facet_uris, |
+ delegate); |
+ } |
return new AffiliationFetcher(context_getter, facet_uris, delegate); |
} |
+// static |
+void AffiliationFetcher::SetFactoryForTesting( |
+ TestAffiliationFetcherFactory* factory) { |
+ g_testing_factory = factory; |
+} |
+ |
void AffiliationFetcher::StartRequest() { |
DCHECK(!fetcher_); |