Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: components/password_manager/core/browser/affiliation_fetcher.cc

Issue 866733002: Add FakeAffiliationFetcher and factory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Missing file. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_);

Powered by Google App Engine
This is Rietveld 408576698