Index: omaha_hash_calculator_unittest.cc |
diff --git a/omaha_hash_calculator_unittest.cc b/omaha_hash_calculator_unittest.cc |
index 5ba3ac1805c9f82b32c19547a674a932acc0a801..28dc0303113dc7c67092026306a6a7e12f81e1c8 100644 |
--- a/omaha_hash_calculator_unittest.cc |
+++ b/omaha_hash_calculator_unittest.cc |
@@ -115,6 +115,25 @@ TEST(OmahaHashCalculatorTest, UpdateFileSimpleTest) { |
EXPECT_EQ("qqlAJmTxpB9A67xSyZk+tmrrNmYClY/fqig7ceZNsSM=", calc.hash()); |
} |
+TEST(OmahaHashCalculatorTest, RawHashOfFileSimpleTest) { |
+ string data_path; |
+ ASSERT_TRUE( |
+ utils::MakeTempFile("/tmp/data.XXXXXX", &data_path, NULL)); |
+ ScopedPathUnlinker data_path_unlinker(data_path); |
+ ASSERT_TRUE(utils::WriteFile(data_path.c_str(), "hi", 2)); |
+ |
+ static const int kLengths[] = { -1, 2, 10 }; |
+ for (size_t i = 0; i < arraysize(kLengths); i++) { |
+ vector<char> exp_raw_hash(kExpectedRawHash, |
+ kExpectedRawHash + arraysize(kExpectedRawHash)); |
+ vector<char> raw_hash; |
+ EXPECT_EQ(2, OmahaHashCalculator::RawHashOfFile(data_path, |
+ kLengths[i], |
+ &raw_hash)); |
+ EXPECT_TRUE(exp_raw_hash == raw_hash); |
+ } |
+} |
+ |
TEST(OmahaHashCalculatorTest, UpdateFileNonexistentTest) { |
OmahaHashCalculator calc; |
EXPECT_EQ(-1, calc.UpdateFile("/some/non-existent/file", -1)); |