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); |