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

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

Issue 1008373003: Integrate throttling logic into AffiliationBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comment. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/affiliation_fetch_throttler_unittest.cc
diff --git a/components/password_manager/core/browser/affiliation_fetch_throttler_unittest.cc b/components/password_manager/core/browser/affiliation_fetch_throttler_unittest.cc
index 2e066099ba277d8de0aa16043af2da8298ac3c75..e081e848d33b1785426b2464d97774d56f67e83b 100644
--- a/components/password_manager/core/browser/affiliation_fetch_throttler_unittest.cc
+++ b/components/password_manager/core/browser/affiliation_fetch_throttler_unittest.cc
@@ -27,9 +27,9 @@ namespace {
class MockAffiliationFetchThrottlerDelegate
: public AffiliationFetchThrottlerDelegate {
public:
- explicit MockAffiliationFetchThrottlerDelegate(
- scoped_ptr<base::TickClock> tick_clock)
- : tick_clock_(tick_clock.Pass()),
+ // The |tick_clock| should outlive this instance.
+ explicit MockAffiliationFetchThrottlerDelegate(base::TickClock* tick_clock)
+ : tick_clock_(tick_clock),
emulated_return_value_(true),
can_send_count_(0u) {}
~MockAffiliationFetchThrottlerDelegate() override {
@@ -49,7 +49,7 @@ class MockAffiliationFetchThrottlerDelegate
}
private:
- scoped_ptr<base::TickClock> tick_clock_;
+ base::TickClock* tick_clock_;
bool emulated_return_value_;
size_t can_send_count_;
base::TimeTicks last_can_send_time_;
@@ -64,12 +64,13 @@ class AffiliationFetchThrottlerTest : public testing::Test {
AffiliationFetchThrottlerTest()
: network_change_notifier_(net::NetworkChangeNotifier::CreateMock()),
task_runner_(new base::TestMockTimeTaskRunner),
- mock_delegate_(task_runner_->GetMockTickClock()) {}
+ mock_tick_clock_(task_runner_->GetMockTickClock()),
+ mock_delegate_(mock_tick_clock_.get()) {}
~AffiliationFetchThrottlerTest() override {}
scoped_ptr<AffiliationFetchThrottler> CreateThrottler() {
return make_scoped_ptr(new AffiliationFetchThrottler(
- &mock_delegate_, task_runner_, task_runner_->GetMockTickClock()));
+ &mock_delegate_, task_runner_, mock_tick_clock_.get()));
}
void SimulateHasNetworkConnectivity(bool has_connectivity) {
@@ -125,6 +126,7 @@ class AffiliationFetchThrottlerTest : public testing::Test {
base::MessageLoop message_loop_;
scoped_ptr<net::NetworkChangeNotifier> network_change_notifier_;
scoped_refptr<base::TestMockTimeTaskRunner> task_runner_;
+ scoped_ptr<base::TickClock> mock_tick_clock_;
MockAffiliationFetchThrottlerDelegate mock_delegate_;
DISALLOW_COPY_AND_ASSIGN(AffiliationFetchThrottlerTest);

Powered by Google App Engine
This is Rietveld 408576698