Make checkpointing atomic

Update Engine currently has a bug where if it the process is interrupted
during checkpointing, we are unable to resume progress from where we
were previously. This is because prefs are reset at the beginning of
checkpointing and then slowly updated during checkpointing, if
update_engine is interrupted during this stage, it loses its state. This
change allows us to update the prefs non-destructively and then
atomically replace the old prefs with the new ones.

Test: m update_engine. update_device.py tested resume ota
Change-Id: I3a7edf7498be9cde5c6f34e3cb259a7853f4f443
diff --git a/common/mock_prefs.h b/common/mock_prefs.h
index f308074..028650d 100644
--- a/common/mock_prefs.h
+++ b/common/mock_prefs.h
@@ -47,6 +47,9 @@
 
   MOCK_METHOD2(AddObserver, void(std::string_view key, ObserverInterface*));
   MOCK_METHOD2(RemoveObserver, void(std::string_view key, ObserverInterface*));
+  MOCK_METHOD(bool, StartTransaction, (), (override));
+  MOCK_METHOD(bool, CancelTransaction, (), (override));
+  MOCK_METHOD(bool, SubmitTransaction, (), (override));
 };
 
 }  // namespace chromeos_update_engine