firmware: add expiration handle

Expiring the session aborts the process.

Tested: Only tested with unit-tests, not run on a real system.
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I3a7ae54cfa04e162a2a1e591c0ddd4eca3d6d3db
diff --git a/bmc/test/firmware_state_verificationpending_unittest.cpp b/bmc/test/firmware_state_verificationpending_unittest.cpp
index 3b958c1..dc6f3d3 100644
--- a/bmc/test/firmware_state_verificationpending_unittest.cpp
+++ b/bmc/test/firmware_state_verificationpending_unittest.cpp
@@ -129,6 +129,24 @@
 }
 
 /*
+ * expire(session)
+ */
+TEST_F(FirmwareHandlerVerificationPendingTest,
+       ExpireVerificationPendingAbortsProcess)
+{
+    getToVerificationPending(staticLayoutBlobId);
+
+    EXPECT_CALL(*verifyMockPtr, abort()).Times(0);
+
+    EXPECT_TRUE(handler->expire(session));
+
+    std::vector<std::string> expectedBlobs = {staticLayoutBlobId, hashBlobId};
+    EXPECT_THAT(handler->getBlobIds(),
+                UnorderedElementsAreArray(expectedBlobs));
+    expectedState(FirmwareBlobHandler::UpdateState::notYetStarted);
+}
+
+/*
  * stat(blob)
  */
 TEST_F(FirmwareHandlerVerificationPendingTest, StatOnActiveImageReturnsFailure)