summaryrefslogtreecommitdiff
path: root/payload_generator/extent_utils_unittest.cc
diff options
context:
space:
mode:
authorAlex Deymo <deymo@chromium.org>2015-06-13 03:37:08 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-01 09:35:37 +0000
commit14158570d3995008dc93a628004118b87a6bca01 (patch)
tree575271d90c0bdfc105dafa43413d80d66975d723 /payload_generator/extent_utils_unittest.cc
parent6c396a9b3020df9b0b58886fd6f36523bec29d3a (diff)
update_engine: Split delta_diff_generator file.
The DeltaDiffGenerator class includes both an OperationsGenerator using the A-to-B operations and a set of common methods used also by the inplace generator. The delta_diff_generator.{h,cc} files also include a single function to generate the payload (GenerateUpdatePayloadFile) that centralizes the logic of generating the operations and writing the payload. This patch splits these three parts in different files. The common delta diff function are moved to the delta_diff_utils.{h,cc} files. The operations generator class that uses A-to-B operations is now in a new ab_generator.{h,cc} pair of files that implement the ABGenerator() class. Finally, the payload file writing methods are now in a single PayloadFile class. This allow us to create payload files without the need to generate images and their deltas. This will be used in a follow up CL to remove the image generation logic from the unittests. BUG=chromium:351589 TEST=Ran unittests. Regenerate a payload with and without this patch; got the same results. Change-Id: I6816d2c805ba8c0c5c9423c720131a100a15ebaa Reviewed-on: https://chromium-review.googlesource.com/280838 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Trybot-Ready: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
Diffstat (limited to 'payload_generator/extent_utils_unittest.cc')
-rw-r--r--payload_generator/extent_utils_unittest.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/payload_generator/extent_utils_unittest.cc b/payload_generator/extent_utils_unittest.cc
index b9f9ef2d..188164d0 100644
--- a/payload_generator/extent_utils_unittest.cc
+++ b/payload_generator/extent_utils_unittest.cc
@@ -62,6 +62,24 @@ TEST(ExtentUtilsTest, BlocksInExtentsTest) {
}
}
+TEST(ExtentUtilsTest, ExtendExtentsTest) {
+ DeltaArchiveManifest_InstallOperation first_op;
+ *(first_op.add_src_extents()) = ExtentForRange(1, 1);
+ *(first_op.add_src_extents()) = ExtentForRange(3, 1);
+
+ DeltaArchiveManifest_InstallOperation second_op;
+ *(second_op.add_src_extents()) = ExtentForRange(4, 2);
+ *(second_op.add_src_extents()) = ExtentForRange(8, 2);
+
+ ExtendExtents(first_op.mutable_src_extents(), second_op.src_extents());
+ vector<Extent> first_op_vec;
+ ExtentsToVector(first_op.src_extents(), &first_op_vec);
+ EXPECT_EQ((vector<Extent>{
+ ExtentForRange(1, 1),
+ ExtentForRange(3, 3),
+ ExtentForRange(8, 2)}), first_op_vec);
+}
+
TEST(ExtentUtilsTest, NormalizeExtentsSimpleList) {
// Make sure it works when there's just one extent.
vector<Extent> extents;