test: firmware uploadInProgress: minor cleanup
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I28755e9df65ef164fdbef443b33f08f9c5e0fb4b
diff --git a/test/firmware_state_uploadinprogress_unittest.cpp b/test/firmware_state_uploadinprogress_unittest.cpp
index 085f542..f33e547 100644
--- a/test/firmware_state_uploadinprogress_unittest.cpp
+++ b/test/firmware_state_uploadinprogress_unittest.cpp
@@ -150,7 +150,14 @@
/*
* open(blob) - While any blob is open, all other fail.
+ *
+ * The fullBlobsList is all the blob_ids present if both /flash/image and
+ * /flash/hash are opened, and one is left open (so there's no verify blob). if
+ * left closed, we'd be in verificationPending, not uploadInProgress.
*/
+const std::vector<std::string> fullBlobsList = {
+ activeHashBlobId, activeImageBlobId, hashBlobId, staticLayoutBlobId};
+
TEST_F(FirmwareHandlerUploadInProgressTest, OpeningHashFileWhileImageOpenFails)
{
/* To be in this state, something must be open (and specifically either an
@@ -159,9 +166,7 @@
*/
openToInProgress(staticLayoutBlobId);
- std::vector<std::string> blobsToTry = {
- hashBlobId, activeImageBlobId, activeHashBlobId, staticLayoutBlobId};
- for (const auto& blob : blobsToTry)
+ for (const auto& blob : fullBlobsList)
{
EXPECT_FALSE(handler->open(2, flags, blob));
}
@@ -171,9 +176,7 @@
{
openToInProgress(hashBlobId);
- std::vector<std::string> blobsToTry = {
- hashBlobId, activeImageBlobId, activeHashBlobId, staticLayoutBlobId};
- for (const auto& blob : blobsToTry)
+ for (const auto& blob : fullBlobsList)
{
EXPECT_FALSE(handler->open(2, flags, blob));
}