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

Side by Side Diff: base/watchdog_unittest.cc

Issue 5791001: [Linux] Fix base_unittests for GCC 4.5.1... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // Tests for Watchdog class. 5 // Tests for Watchdog class.
6 6
7 #include "base/watchdog.h" 7 #include "base/watchdog.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/platform_thread.h" 10 #include "base/platform_thread.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 TEST_F(WatchdogTest, AlarmTest) { 79 TEST_F(WatchdogTest, AlarmTest) {
80 WatchdogCounter watchdog(TimeDelta::FromMilliseconds(10), "Enabled", true); 80 WatchdogCounter watchdog(TimeDelta::FromMilliseconds(10), "Enabled", true);
81 watchdog.Arm(); 81 watchdog.Arm();
82 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), 82 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
83 watchdog.alarm_counter() > 0); 83 watchdog.alarm_counter() > 0);
84 EXPECT_EQ(1, watchdog.alarm_counter()); 84 EXPECT_EQ(1, watchdog.alarm_counter());
85 } 85 }
86 86
87 // Make sure a basic alarm fires when the time has expired. 87 // Make sure a basic alarm fires when the time has expired.
88 TEST_F(WatchdogTest, AlarmPriorTimeTest) { 88 TEST_F(WatchdogTest, AlarmPriorTimeTest) {
89 WatchdogCounter watchdog(TimeDelta::TimeDelta(), "Enabled2", true); 89 WatchdogCounter watchdog(TimeDelta(), "Enabled2", true);
90 // Set a time in the past. 90 // Set a time in the past.
91 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(2)); 91 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(2));
92 // It should instantly go off, but certainly in less than 5 minutes. 92 // It should instantly go off, but certainly in less than 5 minutes.
93 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), 93 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
94 watchdog.alarm_counter() > 0); 94 watchdog.alarm_counter() > 0);
95 95
96 EXPECT_EQ(1, watchdog.alarm_counter()); 96 EXPECT_EQ(1, watchdog.alarm_counter());
97 } 97 }
98 98
99 // Make sure a disable alarm does nothing, even if we arm it. 99 // Make sure a disable alarm does nothing, even if we arm it.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Set a time greater than the timeout into the past. 133 // Set a time greater than the timeout into the past.
134 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10)); 134 watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(10));
135 // It should almost instantly go off, but certainly in less than 5 minutes. 135 // It should almost instantly go off, but certainly in less than 5 minutes.
136 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5), 136 SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
137 watchdog.alarm_counter() > 0); 137 watchdog.alarm_counter() > 0);
138 138
139 EXPECT_EQ(1, watchdog.alarm_counter()); 139 EXPECT_EQ(1, watchdog.alarm_counter());
140 } 140 }
141 141
142 } // namespace 142 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698