OLD | NEW |
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 Loading... |
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 |
OLD | NEW |