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/omaha_hash_calculator_unittest.cc b/omaha_hash_calculator_unittest.cc
index 449cb90..597b21f 100644
--- a/omaha_hash_calculator_unittest.cc
+++ b/omaha_hash_calculator_unittest.cc
@@ -51,6 +51,18 @@
EXPECT_TRUE(raw_hash == calc.raw_hash());
}
+TEST(OmahaHashCalculatorTest, ContextTest) {
+ OmahaHashCalculator calc;
+ calc.Update("h", 1);
+ OmahaHashCalculator calc_next;
+ calc_next.SetContext(calc.GetContext());
+ calc_next.Update("i", 1);
+ calc_next.Finalize();
+ // Generated by running this on a linux shell:
+ // $ echo -n hi | openssl dgst -sha256 -binary | openssl base64
+ EXPECT_EQ("j0NDRmSPa5bfid2pAcUXaxCm2Dlh3TwayItZstwyeqQ=", calc_next.hash());
+}
+
TEST(OmahaHashCalculatorTest, BigTest) {
OmahaHashCalculator calc;