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

Side by Side Diff: chrome/browser/captive_portal/captive_portal_service_unittest.cc

Issue 1178423008: Provision to start base::SimpleTestTickClock at initial ticks Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/captive_portal/captive_portal_service.h" 5 #include "chrome/browser/captive_portal/captive_portal_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 old_captive_portal_testing_state_); 95 old_captive_portal_testing_state_);
96 } 96 }
97 97
98 // |enable_service| is whether or not the captive portal service itself 98 // |enable_service| is whether or not the captive portal service itself
99 // should be disabled. This is different from enabling the captive portal 99 // should be disabled. This is different from enabling the captive portal
100 // detection preference. 100 // detection preference.
101 void Initialize(CaptivePortalService::TestingState testing_state) { 101 void Initialize(CaptivePortalService::TestingState testing_state) {
102 CaptivePortalService::set_state_for_testing(testing_state); 102 CaptivePortalService::set_state_for_testing(testing_state);
103 103
104 profile_.reset(new TestingProfile()); 104 profile_.reset(new TestingProfile());
105 tick_clock_.reset(new base::SimpleTestTickClock()); 105 tick_clock_.reset(new base::SimpleTestTickClock(base::TimeTicks::Now()));
106 tick_clock_->Advance(base::TimeTicks::Now() - tick_clock_->NowTicks());
107 service_.reset(new CaptivePortalService(profile_.get(), tick_clock_.get())); 106 service_.reset(new CaptivePortalService(profile_.get(), tick_clock_.get()));
108 107
109 // Use no delays for most tests. 108 // Use no delays for most tests.
110 set_initial_backoff_no_portal(base::TimeDelta()); 109 set_initial_backoff_no_portal(base::TimeDelta());
111 set_initial_backoff_portal(base::TimeDelta()); 110 set_initial_backoff_portal(base::TimeDelta());
112 111
113 set_detector(&service_->captive_portal_detector_); 112 set_detector(&service_->captive_portal_detector_);
114 SetTime(base::Time::Now()); 113 SetTime(base::Time::Now());
115 114
116 // Disable jitter, so can check exact values. 115 // Disable jitter, so can check exact values.
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 base::Time::FromString("Tue, 17 Apr 2012 18:02:00 GMT", &start_time)); 517 base::Time::FromString("Tue, 17 Apr 2012 18:02:00 GMT", &start_time));
519 SetTime(start_time); 518 SetTime(start_time);
520 519
521 RunTest(captive_portal::RESULT_NO_RESPONSE, 520 RunTest(captive_portal::RESULT_NO_RESPONSE,
522 net::OK, 521 net::OK,
523 503, 522 503,
524 0, 523 0,
525 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n"); 524 "HTTP/1.1 503 OK\nRetry-After: Tue, 17 Apr 2012 18:02:51 GMT\n\n");
526 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest()); 525 EXPECT_EQ(base::TimeDelta::FromSeconds(51), GetTimeUntilNextRequest());
527 } 526 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698