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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « delta_diff_generator.cc ('k') | delta_performer.cc » ('j') | 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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 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/types.h> 5 #include <sys/types.h>
6 #include <sys/stat.h> 6 #include <sys/stat.h>
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <unistd.h> 8 #include <unistd.h>
9 #include <set> 9 #include <set>
10 #include <sstream> 10 #include <sstream>
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 for (Graph::size_type i = 0; i < graph.size() - 1; i++) { 581 for (Graph::size_type i = 0; i < graph.size() - 1; i++) {
582 EXPECT_TRUE(graph[i].out_edges == expected_graph[i].out_edges); 582 EXPECT_TRUE(graph[i].out_edges == expected_graph[i].out_edges);
583 if (i == 8) { 583 if (i == 8) {
584 // special case 584 // special case
585 } else { 585 } else {
586 // EXPECT_TRUE(graph[i] == expected_graph[i]) << "i = " << i; 586 // EXPECT_TRUE(graph[i] == expected_graph[i]) << "i = " << i;
587 } 587 }
588 } 588 }
589 } 589 }
590 590
591 TEST_F(DeltaDiffGeneratorTest, IsNoopOperationTest) {
592 DeltaArchiveManifest_InstallOperation op;
593 op.set_type(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ);
594 EXPECT_FALSE(DeltaDiffGenerator::IsNoopOperation(op));
595 op.set_type(DeltaArchiveManifest_InstallOperation_Type_MOVE);
596 EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
597 *(op.add_src_extents()) = ExtentForRange(3, 2);
598 *(op.add_dst_extents()) = ExtentForRange(3, 2);
599 EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
600 *(op.add_src_extents()) = ExtentForRange(7, 5);
601 *(op.add_dst_extents()) = ExtentForRange(7, 5);
602 EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
603 *(op.add_src_extents()) = ExtentForRange(20, 2);
604 *(op.add_dst_extents()) = ExtentForRange(20, 1);
605 *(op.add_dst_extents()) = ExtentForRange(21, 1);
606 EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
607 *(op.add_src_extents()) = ExtentForRange(kSparseHole, 2);
608 *(op.add_src_extents()) = ExtentForRange(kSparseHole, 1);
609 *(op.add_dst_extents()) = ExtentForRange(kSparseHole, 3);
610 EXPECT_TRUE(DeltaDiffGenerator::IsNoopOperation(op));
611 *(op.add_src_extents()) = ExtentForRange(24, 1);
612 *(op.add_dst_extents()) = ExtentForRange(25, 1);
613 EXPECT_FALSE(DeltaDiffGenerator::IsNoopOperation(op));
614 }
615
591 } // namespace chromeos_update_engine 616 } // namespace chromeos_update_engine
OLDNEW
« 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