summaryrefslogtreecommitdiffstats
path: root/test/watchdog_test.cpp
diff options
context:
space:
mode:
authorWilliam A. Kennington III <wak@google.com>2018-09-13 00:35:47 -0700
committerWilliam A. Kennington III <wak@google.com>2018-09-17 10:36:47 -0700
commit3bb2f4006f3c62a415e7610926b06fed7a045906 (patch)
treed0468cfeae67cc1e7087b61065e0c933c6bc9274 /test/watchdog_test.cpp
parent73c2cfb97b1070c75db2c9cbf0b46de914883495 (diff)
downloadphosphor-watchdog-3bb2f4006f3c62a415e7610926b06fed7a045906.tar.gz
phosphor-watchdog-3bb2f4006f3c62a415e7610926b06fed7a045906.zip
Standardize Action -> Target Map Type
This change refactors the watchdog header to export the type of watchdog action to systemd target map, so it can be directly used by other files. This makes enumerating the map type more trivial. Also convert to an unordered_map instead of map since we don't need the ordering guarantees. Tested: Builds and tests still pass Change-Id: I77d315210ec27fde295589479c50d46dc5d1b32a Signed-off-by: William A. Kennington III <wak@google.com>
Diffstat (limited to 'test/watchdog_test.cpp')
-rw-r--r--test/watchdog_test.cpp9
1 files changed, 3 insertions, 6 deletions
diff --git a/test/watchdog_test.cpp b/test/watchdog_test.cpp
index f24d45e..49890da 100644
--- a/test/watchdog_test.cpp
+++ b/test/watchdog_test.cpp
@@ -191,9 +191,8 @@ TEST_F(WdogTest, enableWdogWithFallbackTillEnd)
.action = Watchdog::Action::PowerOff,
.interval = static_cast<uint64_t>(fallbackIntervalMs),
};
- std::map<Watchdog::Action, Watchdog::TargetName> emptyActionTargets;
wdog = std::make_unique<Watchdog>(bus, TEST_PATH, eventP,
- std::move(emptyActionTargets),
+ Watchdog::ActionTargetMap(),
std::move(fallback));
EXPECT_EQ(primaryInterval, milliseconds(wdog->interval(primaryIntervalMs)));
EXPECT_FALSE(wdog->enabled());
@@ -275,9 +274,8 @@ TEST_F(WdogTest, enableWdogWithFallbackReEnable)
.interval = static_cast<uint64_t>(fallbackIntervalMs),
.always = false,
};
- std::map<Watchdog::Action, Watchdog::TargetName> emptyActionTargets;
wdog = std::make_unique<Watchdog>(bus, TEST_PATH, eventP,
- std::move(emptyActionTargets),
+ Watchdog::ActionTargetMap(),
std::move(fallback));
EXPECT_EQ(primaryInterval, milliseconds(wdog->interval(primaryIntervalMs)));
EXPECT_FALSE(wdog->enabled());
@@ -330,9 +328,8 @@ TEST_F(WdogTest, enableWdogWithFallbackAlways)
.interval = static_cast<uint64_t>(fallbackIntervalMs),
.always = true,
};
- std::map<Watchdog::Action, Watchdog::TargetName> emptyActionTargets;
wdog = std::make_unique<Watchdog>(bus, TEST_PATH, eventP,
- std::move(emptyActionTargets),
+ Watchdog::ActionTargetMap(),
std::move(fallback));
EXPECT_EQ(primaryInterval, milliseconds(wdog->interval(primaryIntervalMs)));
EXPECT_FALSE(wdog->enabled());
OpenPOWER on IntegriCloud