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

Side by Side Diff: base/threading/watchdog_unittest.cc

Issue 804533005: Standardize usage of virtual/override/final specifiers in base/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplify Created 6 years 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 "base/threading/watchdog.h" 5 #include "base/threading/watchdog.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/synchronization/spin_wait.h" 8 #include "base/synchronization/spin_wait.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 25 matching lines...) Expand all
36 int alarm_counter() { return alarm_counter_; } 36 int alarm_counter() { return alarm_counter_; }
37 37
38 private: 38 private:
39 int alarm_counter_; 39 int alarm_counter_;
40 40
41 DISALLOW_COPY_AND_ASSIGN(WatchdogCounter); 41 DISALLOW_COPY_AND_ASSIGN(WatchdogCounter);
42 }; 42 };
43 43
44 class WatchdogTest : public testing::Test { 44 class WatchdogTest : public testing::Test {
45 public: 45 public:
46 virtual void SetUp() override { 46 void SetUp() override { Watchdog::ResetStaticData(); }
47 Watchdog::ResetStaticData();
48 }
49 }; 47 };
50 48
51 } // namespace 49 } // namespace
52 50
53 //------------------------------------------------------------------------------ 51 //------------------------------------------------------------------------------
54 // Actual tests 52 // Actual tests
55 53
56 // Minimal constructor/destructor test. 54 // Minimal constructor/destructor test.
57 TEST_F(WatchdogTest, StartupShutdownTest) { 55 TEST_F(WatchdogTest, StartupShutdownTest) {
58 Watchdog watchdog1(TimeDelta::FromMilliseconds(300), "Disabled", false); 56 Watchdog watchdog1(TimeDelta::FromMilliseconds(300), "Disabled", false);
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Set a time greater than the timeout into the past. 131 // Set a time greater than the timeout into the past.
134 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10)); 132 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10));
135 // It should almost instantly go off, but certainly in less than 5 minutes. 133 // It should almost instantly go off, but certainly in less than 5 minutes.
136 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), 134 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
137 watchdog.alarm_counter() > 0); 135 watchdog.alarm_counter() > 0);
138 136
139 EXPECT_EQ(1, watchdog.alarm_counter()); 137 EXPECT_EQ(1, watchdog.alarm_counter());
140 } 138 }
141 139
142 } // namespace base 140 } // namespace base
OLDNEW
« no previous file with comments | « base/threading/sequenced_worker_pool_unittest.cc ('k') | base/threading/worker_pool_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698