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

Side by Side Diff: components/password_manager/core/browser/form_fetcher_impl_unittest.cc

Issue 2760653002: Add FormFetcher::RemoveConsumer (Closed)
Patch Set: Rebased Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/core/browser/form_fetcher_impl.h" 5 #include "components/password_manager/core/browser/form_fetcher_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 // Pass empty results to make the state NOT_WAITING. 610 // Pass empty results to make the state NOT_WAITING.
611 form_fetcher_->OnGetPasswordStoreResults( 611 form_fetcher_->OnGetPasswordStoreResults(
612 std::vector<std::unique_ptr<PasswordForm>>()); 612 std::vector<std::unique_ptr<PasswordForm>>());
613 std::vector<InteractionsStats> stats(1); 613 std::vector<InteractionsStats> stats(1);
614 form_fetcher_->OnGetSiteStatistics(std::move(stats)); 614 form_fetcher_->OnGetSiteStatistics(std::move(stats));
615 615
616 auto clone = form_fetcher_->Clone(); 616 auto clone = form_fetcher_->Clone();
617 EXPECT_EQ(1u, clone->GetInteractionsStats().size()); 617 EXPECT_EQ(1u, clone->GetInteractionsStats().size());
618 } 618 }
619 619
620 // Check that removing consumers stops them from receiving store updates.
621 TEST_F(FormFetcherImplTest, RemoveConsumer) {
622 Fetch();
623 form_fetcher_->AddConsumer(&consumer_);
624 form_fetcher_->RemoveConsumer(&consumer_);
625 EXPECT_CALL(consumer_, ProcessMatches(_, _)).Times(0);
626 form_fetcher_->OnGetPasswordStoreResults(
627 std::vector<std::unique_ptr<PasswordForm>>());
628 }
629
620 } // namespace password_manager 630 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698