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

Unified Diff: base/watchdog_unittest.cc

Issue 42266: Break up unit test to avoid internal timing interactions between parts.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/watchdog.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/watchdog_unittest.cc
===================================================================
--- base/watchdog_unittest.cc (revision 11750)
+++ base/watchdog_unittest.cc (working copy)
@@ -75,14 +75,18 @@
SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
watchdog.alarm_counter() > 0);
EXPECT_EQ(1, watchdog.alarm_counter());
+}
- // Set a time greater than the timeout into the past.
+// Make sure a basic alarm fires when the time has expired.
wtc 2009/06/04 23:14:24 This comment should show how AlarmPriorTimeTest di
+TEST(WatchdogTest, AlarmPriorTimeTest) {
+ WatchdogCounter watchdog(TimeDelta::TimeDelta(), "Enabled2", true);
wtc 2009/06/04 23:14:24 Why is the first argument TimeDelta::TimeDelta() i
+ // Set a time in the past.
watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(2));
// It should instantly go off, but certainly in less than 5 minutes.
SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
- watchdog.alarm_counter() > 1);
+ watchdog.alarm_counter() > 0);
- EXPECT_EQ(2, watchdog.alarm_counter());
+ EXPECT_EQ(1, watchdog.alarm_counter());
}
// Make sure a disable alarm does nothing, even if we arm it.
@@ -96,7 +100,7 @@
// Make sure Disarming will prevent firing, even after Arming.
TEST(WatchdogTest, DisarmTest) {
- WatchdogCounter watchdog(TimeDelta::FromSeconds(5), "Enabled", true);
+ WatchdogCounter watchdog(TimeDelta::FromSeconds(5), "Enabled3", true);
watchdog.Arm();
PlatformThread::Sleep(100); // Don't sleep too long
watchdog.Disarm();
« no previous file with comments | « base/watchdog.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698