Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Unified Diff: delta_performer_unittest.cc

Issue 3762007: AU: Include old kernel hash for source partition verification. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « delta_diff_generator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « delta_diff_generator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698