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

Unified Diff: delta_performer_unittest.cc

Issue 3712003: AU: Verify source rootfs/kernel hashes before applying delta. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: verify source partitions only for new updates 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_performer.cc ('k') | download_action.cc » ('j') | 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 e0db6e7733454287e8c3a07bc2de272e935959a9..4f6661e4803d6bb3ff46bbeedba6b56cabf3daa1 100755
--- a/delta_performer_unittest.cc
+++ b/delta_performer_unittest.cc
@@ -258,12 +258,14 @@ TEST(DeltaPerformerTest, RunAsRootSmallImageTest) {
EXPECT_EQ(expected_sig_data_length, manifest.signatures_size());
EXPECT_FALSE(signature.data().empty());
- EXPECT_EQ(old_kernel_data.size(), manifest.old_kernel_info().size());
+ // TODO(petkov): Add a test once the generator start sending old kernel
+ // info.
+ EXPECT_FALSE(manifest.has_old_kernel_info());
+
EXPECT_EQ(new_kernel_data.size(), manifest.new_kernel_info().size());
EXPECT_EQ(image_size, manifest.old_rootfs_info().size());
EXPECT_EQ(image_size, manifest.new_rootfs_info().size());
- EXPECT_FALSE(manifest.old_kernel_info().hash().empty());
EXPECT_FALSE(manifest.new_kernel_info().hash().empty());
EXPECT_FALSE(manifest.old_rootfs_info().hash().empty());
EXPECT_FALSE(manifest.new_rootfs_info().hash().empty());
@@ -289,6 +291,11 @@ TEST(DeltaPerformerTest, RunAsRootSmallImageTest) {
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));
+ performer.set_current_rootfs_hash(&rootfs_hash);
+
// Write at some number of bytes per operation. Arbitrarily chose 5.
const size_t kBytesPerWrite = 5;
for (size_t i = 0; i < delta.size(); i += kBytesPerWrite) {
« no previous file with comments | « delta_performer.cc ('k') | download_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698