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

Unified Diff: chrome/browser/captive_portal/captive_portal_service_unittest.cc

Issue 1076853003: Refactor net::BackoffEntry to not require subclassing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address pneubeck's review comments Created 5 years, 8 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: chrome/browser/captive_portal/captive_portal_service_unittest.cc
diff --git a/chrome/browser/captive_portal/captive_portal_service_unittest.cc b/chrome/browser/captive_portal/captive_portal_service_unittest.cc
index c835721baf66093672082d1357bcf8a606eef231..0d335486ac6e9f1a8cb07cb7f94faaefa2fe1aca 100644
--- a/chrome/browser/captive_portal/captive_portal_service_unittest.cc
+++ b/chrome/browser/captive_portal/captive_portal_service_unittest.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/prefs/pref_service.h"
#include "base/run_loop.h"
+#include "base/test/simple_test_tick_clock.h"
#include "base/test/test_timeouts.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/chrome_switches.h"
@@ -101,8 +102,9 @@ class CaptivePortalServiceTest : public testing::Test,
CaptivePortalService::set_state_for_testing(testing_state);
profile_.reset(new TestingProfile());
- service_.reset(new CaptivePortalService(profile_.get()));
- service_->set_time_ticks_for_testing(base::TimeTicks::Now());
+ tick_clock_.reset(new base::SimpleTestTickClock());
+ tick_clock_->Advance(base::TimeTicks::Now() - tick_clock_->NowTicks());
+ service_.reset(new CaptivePortalService(profile_.get(), tick_clock_.get()));
// Use no delays for most tests.
set_initial_backoff_no_portal(base::TimeDelta());
@@ -226,7 +228,7 @@ class CaptivePortalServiceTest : public testing::Test,
// Changes test time for the service and service's captive portal
// detector.
void AdvanceTime(const base::TimeDelta& delta) {
- service()->advance_time_ticks_for_testing(delta);
+ tick_clock_->Advance(delta);
CaptivePortalDetectorTestBase::AdvanceTime(delta);
}
@@ -281,6 +283,7 @@ class CaptivePortalServiceTest : public testing::Test,
// Note that the construction order of these matters.
scoped_ptr<TestingProfile> profile_;
+ scoped_ptr<base::SimpleTestTickClock> tick_clock_;
scoped_ptr<CaptivePortalService> service_;
};
« no previous file with comments | « chrome/browser/captive_portal/captive_portal_service.cc ('k') | chrome/browser/chromeos/net/network_portal_detector_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698