test: cleanup: firmware::sessionstat() tests
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I608a84c206ed3fc1619dd0ee20c924ba03465c1f
diff --git a/test/firmware_sessionstat_unittest.cpp b/test/firmware_sessionstat_unittest.cpp
index 7882141..f8cc727 100644
--- a/test/firmware_sessionstat_unittest.cpp
+++ b/test/firmware_sessionstat_unittest.cpp
@@ -13,17 +13,26 @@
using ::testing::Eq;
using ::testing::Return;
-TEST(FirmwareSessionStateTest, DataTypeIpmiNoMetadata)
+class FirmwareSessionStateTest : public ::testing::Test
+{
+ protected:
+ ImageHandlerMock imageMock1, imageMock2;
+ std::vector<HandlerPack> blobs;
+
+ void SetUp() override
+ {
+ blobs = {
+ {hashBlobId, &imageMock1},
+ {"asdf", &imageMock2},
+ };
+ }
+};
+
+TEST_F(FirmwareSessionStateTest, DataTypeIpmiNoMetadata)
{
/* Verifying running stat if the type of data session is IPMI returns no
* metadata.
*/
- ImageHandlerMock imageMock1, imageMock2;
- std::vector<HandlerPack> blobs = {
- {hashBlobId, &imageMock1},
- {"asdf", &imageMock2},
- };
-
std::vector<DataHandlerPack> data = {
{FirmwareBlobHandler::UpdateFlags::ipmi, nullptr},
};
@@ -47,18 +56,12 @@
EXPECT_EQ(meta.metadata.size(), 0);
}
-TEST(FirmwareSessionStateTest, DataTypeP2AReturnsMetadata)
+TEST_F(FirmwareSessionStateTest, DataTypeP2AReturnsMetadata)
{
/* Really any type that isn't IPMI can return metadata, but we only expect
* P2A to for now. Later, LPC may have reason to provide data, and can by
* simply implementing read().
*/
- ImageHandlerMock imageMock1, imageMock2;
- std::vector<HandlerPack> blobs = {
- {hashBlobId, &imageMock1},
- {"asdf", &imageMock2},
- };
-
DataHandlerMock dataMock;
std::vector<DataHandlerPack> data = {