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

Unified Diff: delta_diff_generator_unittest.cc

Issue 3785008: AU: Don't send no-op operations in the delta payload. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix comment 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') | delta_performer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: delta_diff_generator_unittest.cc
diff --git a/delta_diff_generator_unittest.cc b/delta_diff_generator_unittest.cc
index d897a0a2f37cf572cf0723445e4d97e9041cd31c..ef4190f274020f9f2f90e942c303f39662bdbd58 100644
--- a/delta_diff_generator_unittest.cc
+++ b/delta_diff_generator_unittest.cc
@@ -588,4 +588,29 @@ TEST_F(DeltaDiffGeneratorTest, RunAsRootAssignTempBlocksTest) {
}
}
+TEST_F(DeltaDiffGeneratorTest, IsNoopOperationTest) {
+ DeltaArchiveManifest_InstallOperation op;
+ op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
+ EXPECT_FALSE(DeltaDiffGenerator::IsNoopOperation(op));
+ op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
+ EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
+ *(op.add_src_extents()) = ExtentForRange(3, 2);
+ *(op.add_dst_extents()) = ExtentForRange(3, 2);
+ EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
+ *(op.add_src_extents()) = ExtentForRange(7, 5);
+ *(op.add_dst_extents()) = ExtentForRange(7, 5);
+ EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
+ *(op.add_src_extents()) = ExtentForRange(20, 2);
+ *(op.add_dst_extents()) = ExtentForRange(20, 1);
+ *(op.add_dst_extents()) = ExtentForRange(21, 1);
+ EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
+ *(op.add_src_extents()) = ExtentForRange(kSparseHole, 2);
+ *(op.add_src_extents()) = ExtentForRange(kSparseHole, 1);
+ *(op.add_dst_extents()) = ExtentForRange(kSparseHole, 3);
+ EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
+ *(op.add_src_extents()) = ExtentForRange(24, 1);
+ *(op.add_dst_extents()) = ExtentForRange(25, 1);
+ EXPECT_FALSE(DeltaDiffGenerator::IsNoopOperation(op));
+}
+
} // namespace chromeos_update_engine
« no previous file with comments | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698