summaryrefslogtreecommitdiffstats
path: root/base/watchdog_unittest.cc
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 20:37:55 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-28 20:37:55 +0000
commitfb48b6ef0bda9be8103fe6080837f488e219b89a (patch)
tree9d91abb9424cd1da202cc227a89e0d6b3424c062 /base/watchdog_unittest.cc
parent46564213965397d01fb87975f3bddd597985fcbf (diff)
downloadchromium_src-fb48b6ef0bda9be8103fe6080837f488e219b89a.zip
chromium_src-fb48b6ef0bda9be8103fe6080837f488e219b89a.tar.gz
chromium_src-fb48b6ef0bda9be8103fe6080837f488e219b89a.tar.bz2
Reset static data in Watchdog to better isolate the tests.
TEST=none http://crbug.com/17839 Review URL: http://codereview.chromium.org/160217 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21883 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/watchdog_unittest.cc')
-rw-r--r--base/watchdog_unittest.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/base/watchdog_unittest.cc b/base/watchdog_unittest.cc
index 698bf9a..3ecfa7d 100644
--- a/base/watchdog_unittest.cc
+++ b/base/watchdog_unittest.cc
@@ -41,6 +41,10 @@ class WatchdogCounter : public Watchdog {
};
class WatchdogTest : public testing::Test {
+ public:
+ void SetUp() {
+ Watchdog::ResetStaticData();
+ }
};
@@ -48,13 +52,13 @@ class WatchdogTest : public testing::Test {
// Actual tests
// Minimal constructor/destructor test.
-TEST(WatchdogTest, StartupShutdownTest) {
+TEST_F(WatchdogTest, StartupShutdownTest) {
Watchdog watchdog1(TimeDelta::FromMilliseconds(300), "Disabled", false);
Watchdog watchdog2(TimeDelta::FromMilliseconds(300), "Enabled", true);
}
// Test ability to call Arm and Disarm repeatedly.
-TEST(WatchdogTest, ArmDisarmTest) {
+TEST_F(WatchdogTest, ArmDisarmTest) {
Watchdog watchdog1(TimeDelta::FromMilliseconds(300), "Disabled", false);
watchdog1.Arm();
watchdog1.Disarm();
@@ -69,7 +73,7 @@ TEST(WatchdogTest, ArmDisarmTest) {
}
// Make sure a basic alarm fires when the time has expired.
-TEST(WatchdogTest, AlarmTest) {
+TEST_F(WatchdogTest, AlarmTest) {
WatchdogCounter watchdog(TimeDelta::FromMilliseconds(10), "Enabled", true);
watchdog.Arm();
SPIN_FOR_TIMEDELTA_OR_UNTIL_TRUE(TimeDelta::FromMinutes(5),
@@ -78,7 +82,7 @@ TEST(WatchdogTest, AlarmTest) {
}
// Make sure a basic alarm fires when the time has expired.
-TEST(WatchdogTest, AlarmPriorTimeTest) {
+TEST_F(WatchdogTest, AlarmPriorTimeTest) {
WatchdogCounter watchdog(TimeDelta::TimeDelta(), "Enabled2", true);
// Set a time in the past.
watchdog.ArmSomeTimeDeltaAgo(TimeDelta::FromSeconds(2));
@@ -90,7 +94,7 @@ TEST(WatchdogTest, AlarmPriorTimeTest) {
}
// Make sure a disable alarm does nothing, even if we arm it.
-TEST(WatchdogTest, ConstructorDisabledTest) {
+TEST_F(WatchdogTest, ConstructorDisabledTest) {
WatchdogCounter watchdog(TimeDelta::FromMilliseconds(10), "Disabled", false);
watchdog.Arm();
// Alarm should not fire, as it was disabled.
@@ -99,7 +103,7 @@ TEST(WatchdogTest, ConstructorDisabledTest) {
}
// Make sure Disarming will prevent firing, even after Arming.
-TEST(WatchdogTest, DisarmTest) {
+TEST_F(WatchdogTest, DisarmTest) {
WatchdogCounter watchdog(TimeDelta::FromSeconds(5), "Enabled3", true);
watchdog.Arm();
PlatformThread::Sleep(100); // Don't sleep too long