bmc: firmware updatePending: close(session)

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I27e7fc8176275f1c1ca4828b661ac89d6f4ddeed
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 2213aef..f6344d1 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -633,6 +633,10 @@
          * trigger verification.
          */
     }
+    else if (item->second->activePath == updateBlobId)
+    {
+        /* nothing interesting. */
+    }
     else
     {
         /* They are closing a data pathway (image, tarball, hash). */
diff --git a/test/firmware_state_updatepending_unittest.cpp b/test/firmware_state_updatepending_unittest.cpp
index 999c92c..0dcd2be 100644
--- a/test/firmware_state_updatepending_unittest.cpp
+++ b/test/firmware_state_updatepending_unittest.cpp
@@ -105,6 +105,7 @@
      * commit() which triggers the update process.
      */
     EXPECT_TRUE(handler->open(session, flags, updateBlobId));
+    expectedState(FirmwareBlobHandler::UpdateState::updatePending);
 }
 
 TEST_F(FirmwareHandlerUpdatePendingTest, OpenAnyBlobOtherThanUpdateFails)
@@ -123,6 +124,23 @@
 }
 
 /*
+ * close(session) - close from this state is uninteresting.
+ */
+TEST_F(FirmwareHandlerUpdatePendingTest, CloseUpdateBlobDoesNotChangeState)
+{
+    /* Verify nothing changes when one just opens, then closes the updateBlobId.
+     */
+    getToUpdatePending();
+
+    EXPECT_TRUE(handler->open(session, flags, updateBlobId));
+
+    handler->close(session);
+
+    expectedState(FirmwareBlobHandler::UpdateState::updatePending);
+    EXPECT_TRUE(handler->canHandleBlob(updateBlobId));
+}
+
+/*
  * TODO: deleteBlob(blob)
  */
 
@@ -135,10 +153,6 @@
  */
 
 /*
- * close(session)
- */
-
-/*
  * writemeta(session)
  */