Use time mode owner enums in dbus interface
Dbus interface defines time mode owners in xyz::openbmc_project::Time.
Use the enums from the interface instead of repo defined enums and use
the generated code to do convertions between strings and enums.
Update unit tests accordingly.
Change-Id: Ic304aa3b4137375d208bb1702e0f64df512fc5a0
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/test/TestHostEpoch.cpp b/test/TestHostEpoch.cpp
index 0e59745..a492b9a 100644
--- a/test/TestHostEpoch.cpp
+++ b/test/TestHostEpoch.cpp
@@ -138,8 +138,8 @@
TEST_F(TestHostEpoch, empty)
{
// Default mode/owner is MANUAL/BOTH
- EXPECT_EQ(Mode::MANUAL, getTimeMode());
- EXPECT_EQ(Owner::BOTH, getTimeOwner());
+ EXPECT_EQ(Mode::Manual, getTimeMode());
+ EXPECT_EQ(Owner::Both, getTimeOwner());
}
TEST_F(TestHostEpoch, readDataFileNotExist)
@@ -176,7 +176,7 @@
{
// Set time in NTP/HOST is not allowed
setTimeMode(Mode::NTP);
- setTimeOwner(Owner::HOST);
+ setTimeOwner(Owner::Host);
checkSettingTimeNotAllowed();
}
@@ -184,7 +184,7 @@
{
// Set time in NTP/SPLIT, offset will be set
setTimeMode(Mode::NTP);
- setTimeOwner(Owner::SPLIT);
+ setTimeOwner(Owner::Split);
checkSetSplitTimeInFuture();
@@ -197,14 +197,14 @@
{
// Set time in NTP/BOTH is not allowed
setTimeMode(Mode::NTP);
- setTimeOwner(Owner::BOTH);
+ setTimeOwner(Owner::Both);
checkSettingTimeNotAllowed();
}
TEST_F(TestHostEpoch, setElapsedInManualBmc)
{
// Set time in MANUAL/BMC is not allowed
- setTimeMode(Mode::MANUAL);
+ setTimeMode(Mode::Manual);
setTimeOwner(Owner::BMC);
checkSettingTimeNotAllowed();
}
@@ -214,15 +214,15 @@
// Set time in MANUAL/HOST, time will be set to BMC
// However it requies gmock to test this case
// TODO: when gmock is ready, test this case.
- setTimeMode(Mode::MANUAL);
- setTimeOwner(Owner::HOST);
+ setTimeMode(Mode::Manual);
+ setTimeOwner(Owner::Host);
}
TEST_F(TestHostEpoch, setElapsedInManualSplit)
{
// Set to SPLIT owner so that offset will be set
- setTimeMode(Mode::MANUAL);
- setTimeOwner(Owner::SPLIT);
+ setTimeMode(Mode::Manual);
+ setTimeOwner(Owner::Split);
checkSetSplitTimeInFuture();
@@ -236,14 +236,14 @@
// Set time in MANUAL/BOTH, time will be set to BMC
// However it requies gmock to test this case
// TODO: when gmock is ready, test this case.
- setTimeMode(Mode::MANUAL);
- setTimeOwner(Owner::BOTH);
+ setTimeMode(Mode::Manual);
+ setTimeOwner(Owner::Both);
}
TEST_F(TestHostEpoch, setElapsedInSplitAndBmcTimeIsChanged)
{
// Set to SPLIT owner so that offset will be set
- setTimeOwner(Owner::SPLIT);
+ setTimeOwner(Owner::Split);
// Get current time, and set future +1min time
auto t1 = hostEpoch.elapsed();
@@ -277,13 +277,13 @@
{
EXPECT_EQ(USEC_ZERO, getOffset());
- setTimeOwner(Owner::SPLIT);
+ setTimeOwner(Owner::Split);
hostEpoch.onBmcTimeChanged(microseconds(hostEpoch.elapsed()) + 1min);
// Now offset shall be non zero
EXPECT_NE(USEC_ZERO, getOffset());
- setTimeOwner(Owner::BOTH);
+ setTimeOwner(Owner::Both);
// Now owner is BOTH, the offset shall be cleared
EXPECT_EQ(USEC_ZERO, getOffset());