AU: Start checkpointing update progress.

Checkpoint the manifest metadata size and the update
check response hash in the preference store. Also checkpoint
the next operation and data offset.
Add methods for getting/setting hash context.

BUG=7390,7394
TEST=unit tests

Change-Id: I25291bf598ac9b0f1033e11cfe59df45b1f6eeab

Review URL: http://codereview.chromium.org/3521016
diff --git a/download_action_unittest.cc b/download_action_unittest.cc
index 9ae9522..3e8aabd 100644
--- a/download_action_unittest.cc
+++ b/download_action_unittest.cc
@@ -4,13 +4,16 @@
 
 #include <string>
 #include <vector>
+
 #include <glib.h>
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
+
 #include "update_engine/action_pipe.h"
 #include "update_engine/download_action.h"
 #include "update_engine/mock_http_fetcher.h"
 #include "update_engine/omaha_hash_calculator.h"
+#include "update_engine/prefs_mock.h"
 #include "update_engine/test_utils.h"
 #include "update_engine/utils.h"
 
@@ -106,8 +109,9 @@
                            "");
   ObjectFeederAction<InstallPlan> feeder_action;
   feeder_action.set_obj(install_plan);
-  DownloadAction download_action(new MockHttpFetcher(&data[0],
-                                                     data.size()));
+  PrefsMock prefs;
+  DownloadAction download_action(&prefs, new MockHttpFetcher(&data[0],
+                                                             data.size()));
   download_action.SetTestFileWriter(&writer);
   BondActions(&feeder_action, &download_action);
   DownloadActionDelegateMock download_delegate;
@@ -225,7 +229,9 @@
     ObjectFeederAction<InstallPlan> feeder_action;
     InstallPlan install_plan(true, "", 0, "", temp_file.GetPath(), "");
     feeder_action.set_obj(install_plan);
-    DownloadAction download_action(new MockHttpFetcher(&data[0], data.size()));
+    PrefsMock prefs;
+    DownloadAction download_action(&prefs,
+                                   new MockHttpFetcher(&data[0], data.size()));
     download_action.SetTestFileWriter(&writer);
     DownloadActionDelegateMock download_delegate;
     if (use_download_delegate) {
@@ -327,7 +333,8 @@
                            "/dev/null");
   ObjectFeederAction<InstallPlan> feeder_action;
   feeder_action.set_obj(install_plan);
-  DownloadAction download_action(new MockHttpFetcher("x", 1));
+  PrefsMock prefs;
+  DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1));
   download_action.SetTestFileWriter(&writer);
 
   DownloadActionTestAction test_action;
@@ -360,7 +367,8 @@
   InstallPlan install_plan(true, "", 0, "", path, "");
   ObjectFeederAction<InstallPlan> feeder_action;
   feeder_action.set_obj(install_plan);
-  DownloadAction download_action(new MockHttpFetcher("x", 1));
+  PrefsMock prefs;
+  DownloadAction download_action(&prefs, new MockHttpFetcher("x", 1));
   download_action.SetTestFileWriter(&writer);
 
   BondActions(&feeder_action, &download_action);