Index: delta_performer_unittest.cc |
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc |
index 5a484418cfc8a2818e663c1d70fdccbc656f5a3f..e9d44fa31746ed8ba3f53630d81487dc2cf5bda9 100755 |
--- a/delta_performer_unittest.cc |
+++ b/delta_performer_unittest.cc |
@@ -258,9 +258,12 @@ void DoSmallImageTest(bool full_kernel) { |
EXPECT_EQ(expected_sig_data_length, manifest.signatures_size()); |
EXPECT_FALSE(signature.data().empty()); |
- // TODO(petkov): Add a test once the generator start sending old kernel |
- // info. |
- EXPECT_FALSE(manifest.has_old_kernel_info()); |
+ if (full_kernel) { |
+ EXPECT_FALSE(manifest.has_old_kernel_info()); |
+ } else { |
+ EXPECT_EQ(old_kernel_data.size(), manifest.old_kernel_info().size()); |
+ EXPECT_FALSE(manifest.old_kernel_info().hash().empty()); |
+ } |
EXPECT_EQ(new_kernel_data.size(), manifest.new_kernel_info().size()); |
EXPECT_EQ(image_size, manifest.old_rootfs_info().size()); |
@@ -288,13 +291,19 @@ void DoSmallImageTest(bool full_kernel) { |
// Update the A image in place. |
DeltaPerformer performer(&prefs); |
- EXPECT_EQ(0, performer.Open(a_img.c_str(), 0, 0)); |
- EXPECT_TRUE(performer.OpenKernel(old_kernel.c_str())); |
- |
vector<char> rootfs_hash; |
- CHECK_EQ(image_size, |
- OmahaHashCalculator::RawHashOfFile(a_img, image_size, &rootfs_hash)); |
+ EXPECT_EQ(image_size, |
+ OmahaHashCalculator::RawHashOfFile(a_img, |
+ image_size, |
+ &rootfs_hash)); |
performer.set_current_rootfs_hash(&rootfs_hash); |
+ vector<char> kernel_hash; |
+ EXPECT_TRUE(OmahaHashCalculator::RawHashOfData(old_kernel_data, |
+ &kernel_hash)); |
+ performer.set_current_kernel_hash(&kernel_hash); |
+ |
+ EXPECT_EQ(0, performer.Open(a_img.c_str(), 0, 0)); |
+ EXPECT_TRUE(performer.OpenKernel(old_kernel.c_str())); |
// Write at some number of bytes per operation. Arbitrarily chose 5. |
const size_t kBytesPerWrite = 5; |