tests/watchdog: Make sure the watchdog can be configured while disabled
Change-Id: If25a533fd23ede502df402d021742aa19f64d2f6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/test/watchdog_test.cpp b/test/watchdog_test.cpp
index 72347aa..8a62cf2 100644
--- a/test/watchdog_test.cpp
+++ b/test/watchdog_test.cpp
@@ -32,6 +32,26 @@
EXPECT_EQ(0, wdog->timeRemaining());
EXPECT_FALSE(wdog->timerExpired());
EXPECT_FALSE(wdog->timerEnabled());
+
+ // We should be able to configure persistent properties
+ // while disabled
+ auto newAction = Watchdog::Action::PowerOff;
+ EXPECT_EQ(newAction, wdog->expireAction(newAction));
+ auto newIntervalMs = milliseconds(defaultInterval * 2).count();
+ EXPECT_EQ(newIntervalMs, wdog->interval(newIntervalMs));
+
+ EXPECT_EQ(newAction, wdog->expireAction());
+ EXPECT_EQ(newIntervalMs, wdog->interval());
+
+ // We won't be able to configure timeRemaining
+ EXPECT_EQ(0, wdog->timeRemaining(1000));
+ EXPECT_EQ(0, wdog->timeRemaining());
+
+ // Timer should not have become enabled
+ EXPECT_FALSE(wdog->enabled());
+ EXPECT_EQ(0, wdog->timeRemaining());
+ EXPECT_FALSE(wdog->timerExpired());
+ EXPECT_FALSE(wdog->timerEnabled());
}
/** @brief Make sure that watchdog is started and enabled */