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

Side by Side Diff: components/domain_reliability/test_util.cc

Issue 252613002: Domain Reliability: More security review. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: ;_; Created 6 years, 7 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 | « components/domain_reliability/test_util.h ('k') | components/domain_reliability/uploader.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/domain_reliability/test_util.h" 5 #include "components/domain_reliability/test_util.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/url_request/url_request_status.h" 8 #include "net/url_request/url_request_status.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace domain_reliability { 11 namespace domain_reliability {
12 12
13 namespace { 13 namespace {
14 14
15 class MockTimer : public MockableTime::Timer { 15 class MockTimer : public MockableTime::Timer {
16 public: 16 public:
17 MockTimer(MockTime* time) 17 MockTimer(MockTime* time)
18 : time_(time), 18 : time_(time),
19 running_(false), 19 running_(false),
20 callback_sequence_number_(0), 20 callback_sequence_number_(0),
21 weak_factory_(this) { 21 weak_factory_(this) {
22 DCHECK(time); 22 DCHECK(time);
23 } 23 }
24
24 virtual ~MockTimer() {} 25 virtual ~MockTimer() {}
25 26
26 // MockableTime::Timer implementation: 27 // MockableTime::Timer implementation:
27 virtual void Start(const tracked_objects::Location& posted_from, 28 virtual void Start(const tracked_objects::Location& posted_from,
28 base::TimeDelta delay, 29 base::TimeDelta delay,
29 const base::Closure& user_task) OVERRIDE { 30 const base::Closure& user_task) OVERRIDE {
30 DCHECK(!user_task.is_null()); 31 DCHECK(!user_task.is_null());
31 32
32 if (running_) 33 if (running_)
33 ++callback_sequence_number_; 34 ++callback_sequence_number_;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 tasks_[TaskKey(now_ticks_ + delay, task_sequence_number_++)] = task; 137 tasks_[TaskKey(now_ticks_ + delay, task_sequence_number_++)] = task;
137 } 138 }
138 139
139 void MockTime::AdvanceToInternal(base::TimeTicks target_ticks) { 140 void MockTime::AdvanceToInternal(base::TimeTicks target_ticks) {
140 base::TimeDelta delta = target_ticks - now_ticks_; 141 base::TimeDelta delta = target_ticks - now_ticks_;
141 now_ += delta; 142 now_ += delta;
142 now_ticks_ += delta; 143 now_ticks_ += delta;
143 } 144 }
144 145
145 } // namespace domain_reliability 146 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/domain_reliability/test_util.h ('k') | components/domain_reliability/uploader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698