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

Side by Side Diff: delta_performer_unittest.cc

Issue 3591019: AU: Delta Performer: properly detect idempotent operations (Closed) Base URL: ssh://git@chromiumos-git/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 unified diff | Download patch
« no previous file with comments | « delta_performer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <sys/mount.h> 5 #include <sys/mount.h>
6 #include <inttypes.h> 6 #include <inttypes.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
11 11
12 #include <base/scoped_ptr.h> 12 #include <base/scoped_ptr.h>
13 #include <base/string_util.h> 13 #include <base/string_util.h>
14 #include <google/protobuf/repeated_field.h> 14 #include <google/protobuf/repeated_field.h>
15 #include <gtest/gtest.h> 15 #include <gtest/gtest.h>
16 16
17 #include "update_engine/delta_diff_generator.h" 17 #include "update_engine/delta_diff_generator.h"
18 #include "update_engine/delta_performer.h" 18 #include "update_engine/delta_performer.h"
19 #include "update_engine/extent_ranges.h"
19 #include "update_engine/graph_types.h" 20 #include "update_engine/graph_types.h"
20 #include "update_engine/payload_signer.h" 21 #include "update_engine/payload_signer.h"
21 #include "update_engine/prefs_mock.h" 22 #include "update_engine/prefs_mock.h"
22 #include "update_engine/test_utils.h" 23 #include "update_engine/test_utils.h"
23 #include "update_engine/update_metadata.pb.h" 24 #include "update_engine/update_metadata.pb.h"
24 #include "update_engine/utils.h" 25 #include "update_engine/utils.h"
25 26
26 namespace chromeos_update_engine { 27 namespace chromeos_update_engine {
27 28
28 using std::min; 29 using std::min;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 EXPECT_EQ(kChunkSize / kBlockSize, 341 EXPECT_EQ(kChunkSize / kBlockSize,
341 graph[i].op.dst_extents(0).num_blocks()); 342 graph[i].op.dst_extents(0).num_blocks());
342 if (graph[i].op.type() != 343 if (graph[i].op.type() !=
343 DeltaArchiveManifest_InstallOperation_Type_REPLACE) { 344 DeltaArchiveManifest_InstallOperation_Type_REPLACE) {
344 EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, 345 EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ,
345 graph[i].op.type()); 346 graph[i].op.type());
346 } 347 }
347 } 348 }
348 } 349 }
349 350
351 TEST(DeltaPerformerTest, IsIdempotentOperationTest) {
352 DeltaArchiveManifest_InstallOperation op;
353 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op));
354 *(op.add_dst_extents()) = ExtentForRange(0, 5);
355 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op));
356 *(op.add_src_extents()) = ExtentForRange(4, 1);
357 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op));
358 op.clear_src_extents();
359 *(op.add_src_extents()) = ExtentForRange(5, 3);
360 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op));
361 *(op.add_dst_extents()) = ExtentForRange(20, 6);
362 EXPECT_TRUE(DeltaPerformer::IsIdempotentOperation(op));
363 *(op.add_src_extents()) = ExtentForRange(19, 2);
364 EXPECT_FALSE(DeltaPerformer::IsIdempotentOperation(op));
365 }
366
350 } // namespace chromeos_update_engine 367 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « delta_performer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698