diff options
author | William A. Kennington III <wak@google.com> | 2018-03-01 11:00:19 -0800 |
---|---|---|
committer | Brad Bishop <bradleyb@fuzziesquirrel.com> | 2018-03-07 11:22:49 +0000 |
commit | 25c1b20f973e2c3d71cf078b36b87769a248de6e (patch) | |
tree | 85978fa74a1d684a2bd308588f187adf3d5fe48a | |
parent | 99c69de1a6682fab61cc898d54dad438134468d4 (diff) | |
download | phosphor-watchdog-25c1b20f973e2c3d71cf078b36b87769a248de6e.tar.gz phosphor-watchdog-25c1b20f973e2c3d71cf078b36b87769a248de6e.zip |
tests/watchdog: Make sure the watchdog can be configured while disabled
Change-Id: If25a533fd23ede502df402d021742aa19f64d2f6
Signed-off-by: William A. Kennington III <wak@google.com>
-rw-r--r-- | test/watchdog_test.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
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 @@ TEST_F(WdogTest, createWdogAndDontEnable) 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 */ |