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

Unified Diff: components/password_manager/core/browser/fake_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/fake_affiliation_fetcher.cc
diff --git a/components/password_manager/core/browser/fake_affiliation_fetcher.cc b/components/password_manager/core/browser/fake_affiliation_fetcher.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0f78e1f1abcc23817ec9f579c4f4a51fd07c0957
--- /dev/null
+++ b/components/password_manager/core/browser/fake_affiliation_fetcher.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/password_manager/core/browser/fake_affiliation_fetcher.h"
+
+namespace password_manager {
+
+password_manager::FakeAffiliationFetcher::FakeAffiliationFetcher(
+ net::URLRequestContextGetter* request_context_getter,
+ const std::vector<FacetURI>& facet_ids,
+ AffiliationFetcherDelegate* delegate)
+ : AffiliationFetcher(request_context_getter, facet_ids, delegate) {
+}
+
+password_manager::FakeAffiliationFetcher::~FakeAffiliationFetcher() {
+}
+
+void password_manager::FakeAffiliationFetcher::SimulateSuccess(
+ scoped_ptr<AffiliationFetcherDelegate::Result> fake_result) {
+ delegate()->OnFetchSucceeded(fake_result.Pass());
+}
+
+void password_manager::FakeAffiliationFetcher::SimulateFailure() {
+ delegate()->OnFetchFailed();
+}
+
+void password_manager::FakeAffiliationFetcher::StartRequest() {
+ // Fake. Does nothing.
+}
+
+password_manager::ScopedFakeAffiliationFetcherFactory::
+ ScopedFakeAffiliationFetcherFactory() {
+ AffiliationFetcher::SetFactoryForTesting(this);
+}
+
+password_manager::ScopedFakeAffiliationFetcherFactory::
+ ~ScopedFakeAffiliationFetcherFactory() {
+ AffiliationFetcher::SetFactoryForTesting(nullptr);
+}
+
+FakeAffiliationFetcher* ScopedFakeAffiliationFetcherFactory::GetNextFetcher() {
+ DCHECK(!pending_fetchers_.empty());
+ FakeAffiliationFetcher* first = pending_fetchers_.front();
+ pending_fetchers_.pop();
+ return first;
+}
+
+AffiliationFetcher* ScopedFakeAffiliationFetcherFactory::CreateInstance(
+ net::URLRequestContextGetter* request_context_getter,
+ const std::vector<FacetURI>& facet_ids,
+ AffiliationFetcherDelegate* delegate) {
+ FakeAffiliationFetcher* fetcher =
+ new FakeAffiliationFetcher(request_context_getter, facet_ids, delegate);
+ pending_fetchers_.push(fetcher);
+ return fetcher;
+}
+
+} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698