Index: delta_performer_unittest.cc |
diff --git a/delta_performer_unittest.cc b/delta_performer_unittest.cc |
index 8717e07a6f2c1f9dd9feef2e937dd7bea6b84d03..904553e54b2c0fd69a7cf388a0876bbe6bb144a0 100755 |
--- a/delta_performer_unittest.cc |
+++ b/delta_performer_unittest.cc |
@@ -16,6 +16,7 @@ |
#include "update_engine/delta_diff_generator.h" |
#include "update_engine/delta_performer.h" |
+#include "update_engine/extent_ranges.h" |
#include "update_engine/graph_types.h" |
#include "update_engine/payload_signer.h" |
#include "update_engine/prefs_mock.h" |
@@ -347,4 +348,20 @@ TEST(DeltaPerformerTest, NewFullUpdateTest) { |
} |
} |
+TEST(DeltaPerformerTest, IsIdempotentOperationTest) { |
+ DeltaArchiveManifest_InstallOperation op; |
+ EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
+ *(op.add_dst_extents()) = ExtentForRange(0, 5); |
+ EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
+ *(op.add_src_extents()) = ExtentForRange(4, 1); |
+ EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); |
+ op.clear_src_extents(); |
+ *(op.add_src_extents()) = ExtentForRange(5, 3); |
+ EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
+ *(op.add_dst_extents()) = ExtentForRange(20, 6); |
+ EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op)); |
+ *(op.add_src_extents()) = ExtentForRange(19, 2); |
+ EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op)); |
+} |
+ |
} // namespace chromeos_update_engine |