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..a7643fa8d7be28149545f87557715c489bd47bee 100644 |
--- a/components/password_manager/core/browser/affiliation_fetcher.cc |
+++ b/components/password_manager/core/browser/affiliation_fetcher.cc |
@@ -5,6 +5,7 @@ |
#include "components/password_manager/core/browser/affiliation_fetcher.h" |
#include "components/password_manager/core/browser/affiliation_api.pb.h" |
+#include "components/password_manager/core/browser/affiliation_fetcher_factory.h" |
#include "components/password_manager/core/browser/affiliation_utils.h" |
#include "google_apis/google_api_keys.h" |
#include "net/base/load_flags.h" |
@@ -16,6 +17,8 @@ |
namespace password_manager { |
+static AffiliationFetcherFactory* g_factory = nullptr; |
vabr (Chromium)
2015/01/22 14:27:04
I suggest renaming to g_testing_factory, to emphas
engedy
2015/01/22 14:41:14
Done.
|
+ |
AffiliationFetcher::AffiliationFetcher( |
net::URLRequestContextGetter* request_context_getter, |
const std::vector<FacetURI>& facet_uris, |
@@ -36,9 +39,17 @@ AffiliationFetcher* AffiliationFetcher::Create( |
net::URLRequestContextGetter* context_getter, |
const std::vector<FacetURI>& facet_uris, |
AffiliationFetcherDelegate* delegate) { |
+ if (g_factory) |
+ return g_factory->CreateInstance(context_getter, facet_uris, delegate); |
return new AffiliationFetcher(context_getter, facet_uris, delegate); |
} |
+// static |
+void AffiliationFetcher::SetFactoryForTesting( |
+ AffiliationFetcherFactory* factory) { |
+ g_factory = factory; |
+} |
+ |
void AffiliationFetcher::StartRequest() { |
DCHECK(!fetcher_); |