bmc: firmware updatePending: commit(session)

Commit(updateBlobId) will trigger the update.
Now you can only trigger if you're in the correct state, therefore
delete obsolete unit-tests that didn't set up the correct starting
condition.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: If97d1db21269027dc61c9cd295f022499e949106
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 15dbee8..f648d42 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -572,14 +572,21 @@
         return false;
     }
 
-    /* You can only commit on the verifyBlodId */
-    if (item->second->activePath != verifyBlobId)
+    /* You can only commit on the verifyBlodId or updateBlobId */
+    if (item->second->activePath != verifyBlobId &&
+        item->second->activePath != updateBlobId)
     {
+        std::fprintf(stderr, "path: '%s' not expected for commit\n",
+                     item->second->activePath.c_str());
         return false;
     }
 
     switch (state)
     {
+        case UpdateState::verificationPending:
+            /* Set state to committing. */
+            item->second->flags |= blobs::StateFlags::committing;
+            return triggerVerification();
         case UpdateState::verificationStarted:
             /* Calling repeatedly has no effect within an update process. */
             return true;
@@ -587,10 +594,11 @@
             /* Calling after the verification process has completed returns
              * failure. */
             return false;
-        default:
-            /* Set state to committing. */
+        case UpdateState::updatePending:
             item->second->flags |= blobs::StateFlags::committing;
-            return triggerVerification();
+            return triggerUpdate();
+        default:
+            return false;
     }
 }
 
@@ -698,4 +706,15 @@
     return result;
 }
 
+bool FirmwareBlobHandler::triggerUpdate()
+{
+    bool result = update->triggerUpdate();
+    if (result)
+    {
+        state = UpdateState::updateStarted;
+    }
+
+    return result;
+}
+
 } // namespace ipmi_flash