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

Side by Side Diff: net/base/backoff_entry_unittest.cc

Issue 667923003: Standardize usage of virtual/override/final in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « no previous file | net/base/capturing_net_log.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "net/base/backoff_entry.h" 5 #include "net/base/backoff_entry.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace { 8 namespace {
9 9
10 using base::TimeDelta; 10 using base::TimeDelta;
11 using base::TimeTicks; 11 using base::TimeTicks;
12 using net::BackoffEntry; 12 using net::BackoffEntry;
13 13
14 BackoffEntry::Policy base_policy = { 0, 1000, 2.0, 0.0, 20000, 2000, false }; 14 BackoffEntry::Policy base_policy = { 0, 1000, 2.0, 0.0, 20000, 2000, false };
15 15
16 class TestBackoffEntry : public BackoffEntry { 16 class TestBackoffEntry : public BackoffEntry {
17 public: 17 public:
18 explicit TestBackoffEntry(const Policy* const policy) 18 explicit TestBackoffEntry(const Policy* const policy)
19 : BackoffEntry(policy), 19 : BackoffEntry(policy),
20 now_(TimeTicks()) { 20 now_(TimeTicks()) {
21 // Work around initialization in constructor not picking up 21 // Work around initialization in constructor not picking up
22 // fake time. 22 // fake time.
23 SetCustomReleaseTime(TimeTicks()); 23 SetCustomReleaseTime(TimeTicks());
24 } 24 }
25 25
26 virtual ~TestBackoffEntry() {} 26 ~TestBackoffEntry() override {}
27 27
28 virtual TimeTicks ImplGetTimeNow() const override { 28 TimeTicks ImplGetTimeNow() const override { return now_; }
29 return now_;
30 }
31 29
32 void set_now(const TimeTicks& now) { 30 void set_now(const TimeTicks& now) {
33 now_ = now; 31 now_ = now;
34 } 32 }
35 33
36 private: 34 private:
37 TimeTicks now_; 35 TimeTicks now_;
38 36
39 DISALLOW_COPY_AND_ASSIGN(TestBackoffEntry); 37 DISALLOW_COPY_AND_ASSIGN(TestBackoffEntry);
40 }; 38 };
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 custom.set_now(custom.ImplGetTimeNow() + custom.GetTimeUntilRelease()); 303 custom.set_now(custom.ImplGetTimeNow() + custom.GetTimeUntilRelease());
306 custom.InformOfRequest(false); 304 custom.InformOfRequest(false);
307 ASSERT_TRUE(custom.ShouldRejectRequest()); 305 ASSERT_TRUE(custom.ShouldRejectRequest());
308 } 306 }
309 307
310 // Max delay should still be respected. 308 // Max delay should still be respected.
311 EXPECT_EQ(20000, custom.GetTimeUntilRelease().InMilliseconds()); 309 EXPECT_EQ(20000, custom.GetTimeUntilRelease().InMilliseconds());
312 } 310 }
313 311
314 } // namespace 312 } // namespace
OLDNEW
« no previous file with comments | « no previous file | net/base/capturing_net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698