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

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

Issue 252613002: Domain Reliability: More security review. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 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 unified diff | Download patch
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/dispatcher.h" 5 #include "components/domain_reliability/dispatcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "components/domain_reliability/test_util.h" 8 #include "components/domain_reliability/test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 using base::TimeDelta; 11 using base::TimeDelta;
12 using base::TimeTicks; 12 using base::TimeTicks;
13 13
14 namespace domain_reliability { 14 namespace domain_reliability {
15 15
16 class DomainReliabilityDispatcherTest : public testing::Test { 16 class DomainReliabilityDispatcherTest : public testing::Test {
17 public: 17 public:
18 DomainReliabilityDispatcherTest() : dispatcher_(&time_) {} 18 DomainReliabilityDispatcherTest() : dispatcher_(&time_) {}
19 19
20 protected: 20 protected:
21 MockTime time_; 21 MockTime time_;
22 DomainReliabilityDispatcher dispatcher_; 22 DomainReliabilityDispatcher dispatcher_;
23 }; 23 };
24 24
25 TEST_F(DomainReliabilityDispatcherTest, Create) { 25 TEST_F(DomainReliabilityDispatcherTest, Create) {}
26 }
27 26
28 TEST_F(DomainReliabilityDispatcherTest, TaskDoesntRunEarly) { 27 TEST_F(DomainReliabilityDispatcherTest, TaskDoesntRunEarly) {
29 TimeDelta delay = TimeDelta::FromSeconds(1); 28 TimeDelta delay = TimeDelta::FromSeconds(1);
30 TestCallback callback; 29 TestCallback callback;
31 30
32 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay); 31 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay);
33 time_.Advance(delay); 32 time_.Advance(delay);
34 dispatcher_.RunEligibleTasks(); 33 dispatcher_.RunEligibleTasks();
35 EXPECT_FALSE(callback.called()); 34 EXPECT_FALSE(callback.called());
36 } 35 }
(...skipping 15 matching lines...) Expand all
52 TestCallback callback; 51 TestCallback callback;
53 52
54 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay); 53 dispatcher_.ScheduleTask(callback.callback(), 2 * delay, 3 * delay);
55 time_.Advance(2 * delay); 54 time_.Advance(2 * delay);
56 EXPECT_FALSE(callback.called()); 55 EXPECT_FALSE(callback.called());
57 time_.Advance(delay); 56 time_.Advance(delay);
58 EXPECT_TRUE(callback.called()); 57 EXPECT_TRUE(callback.called());
59 } 58 }
60 59
61 } // namespace domain_reliability 60 } // namespace domain_reliability
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698