Use host state object to check if host is on
The code was using pgood to determine if host is on or off. Now we have
host state object, which is a more appropriate way to check host on/off.
So change pgood related code to use host state object.
Change-Id: I553c1a40922ca2e8bc6904688c55e85971bd4720
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/test/TestManager.cpp b/test/TestManager.cpp
index d8c51ca..decc21d 100644
--- a/test/TestManager.cpp
+++ b/test/TestManager.cpp
@@ -56,9 +56,9 @@
{
manager.onPropertyChanged(key, value);
}
- void notifyPgoodChanged(bool pgood)
+ void notifyOnHostState(bool hostOn)
{
- manager.onPgoodChanged(pgood);
+ manager.onHostState(hostOn);
}
};
@@ -74,11 +74,11 @@
}
-TEST_F(TestManager, DISABLED_pgoodChange)
+TEST_F(TestManager, DISABLED_hostStateChange)
{
- notifyPgoodChanged(true);
+ notifyOnHostState(true);
EXPECT_TRUE(hostOn());
- notifyPgoodChanged(false);
+ notifyOnHostState(false);
EXPECT_FALSE(hostOn());
}
@@ -104,7 +104,7 @@
EXPECT_EQ("", getRequestedOwner());
// When host is on, property changes are saved as requested ones
- notifyPgoodChanged(true);
+ notifyOnHostState(true);
// Check mocked listeners shall not receive notifications
EXPECT_CALL(listener1, onModeChanged(Mode::Manual)).Times(0);
@@ -132,14 +132,14 @@
EXPECT_CALL(listener2, onModeChanged(Mode::NTP)).Times(1);
EXPECT_CALL(listener2, onOwnerChanged(Owner::Split)).Times(1);
- notifyPgoodChanged(false);
+ notifyOnHostState(false);
EXPECT_EQ("", getRequestedMode());
EXPECT_EQ("", getRequestedOwner());
// When host is on, and invalid property is changed,
// verify the code asserts because it shall never occur
- notifyPgoodChanged(true);
+ notifyOnHostState(true);
ASSERT_DEATH(notifyPropertyChanged("invalid property", "whatever"), "");
}
@@ -154,7 +154,7 @@
"xyz.openbmc_project.Time.Owner.Owners.Host");
// Set host on
- notifyPgoodChanged(true);
+ notifyOnHostState(true);
// Check mocked listeners shall not receive notifications
EXPECT_CALL(listener1, onModeChanged(_)).Times(0);
@@ -197,7 +197,7 @@
EXPECT_CALL(listener2, onModeChanged(_)).Times(0);
EXPECT_CALL(listener2, onOwnerChanged(_)).Times(0);
- notifyPgoodChanged(false);
+ notifyOnHostState(false);
EXPECT_EQ("", getRequestedMode());
EXPECT_EQ("", getRequestedOwner());