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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 NULL, | 518 NULL, |
519 &fd)); | 519 &fd)); |
520 ScopedFdCloser fd_closer(&fd); | 520 ScopedFdCloser fd_closer(&fd); |
521 off_t data_file_size = 0; | 521 off_t data_file_size = 0; |
522 | 522 |
523 | 523 |
524 EXPECT_TRUE(DeltaDiffGenerator::ConvertGraphToDag(&graph, | 524 EXPECT_TRUE(DeltaDiffGenerator::ConvertGraphToDag(&graph, |
525 temp_dir, | 525 temp_dir, |
526 fd, | 526 fd, |
527 &data_file_size, | 527 &data_file_size, |
528 &final_order)); | 528 &final_order, |
| 529 Vertex::kInvalidIndex)); |
529 | 530 |
530 | 531 |
531 Graph expected_graph(12); | 532 Graph expected_graph(12); |
532 GenVertex(&expected_graph[0], empt, VectOfExt(200, 1), "", OP_REPLACE); | 533 GenVertex(&expected_graph[0], empt, VectOfExt(200, 1), "", OP_REPLACE); |
533 GenVertex(&expected_graph[1], empt, VectOfExt(210, 10), "", OP_REPLACE); | 534 GenVertex(&expected_graph[1], empt, VectOfExt(210, 10), "", OP_REPLACE); |
534 GenVertex(&expected_graph[2], empt, VectOfExt(220, 1), "", OP_REPLACE); | 535 GenVertex(&expected_graph[2], empt, VectOfExt(220, 1), "", OP_REPLACE); |
535 GenVertex(&expected_graph[3], | 536 GenVertex(&expected_graph[3], |
536 VectOfExt(10, 11), | 537 VectOfExt(10, 11), |
537 VectOfExt(0, 9), | 538 VectOfExt(0, 9), |
538 "", | 539 "", |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
721 &reverse_op_indexes, | 722 &reverse_op_indexes, |
722 cuts)); | 723 cuts)); |
723 EXPECT_FALSE(graph[6].valid); | 724 EXPECT_FALSE(graph[6].valid); |
724 EXPECT_FALSE(graph[7].valid); | 725 EXPECT_FALSE(graph[7].valid); |
725 EXPECT_EQ(1, graph[1].op.src_extents_size()); | 726 EXPECT_EQ(1, graph[1].op.src_extents_size()); |
726 EXPECT_EQ(2, graph[1].op.src_extents(0).start_block()); | 727 EXPECT_EQ(2, graph[1].op.src_extents(0).start_block()); |
727 EXPECT_EQ(1, graph[1].op.src_extents(0).num_blocks()); | 728 EXPECT_EQ(1, graph[1].op.src_extents(0).num_blocks()); |
728 EXPECT_EQ(OP_REPLACE_BZ, graph[5].op.type()); | 729 EXPECT_EQ(OP_REPLACE_BZ, graph[5].op.type()); |
729 } | 730 } |
730 | 731 |
| 732 TEST_F(DeltaDiffGeneratorTest, CreateScratchNodeTest) { |
| 733 Vertex vertex; |
| 734 DeltaDiffGenerator::CreateScratchNode(12, 34, &vertex); |
| 735 EXPECT_EQ(DeltaArchiveManifest_InstallOperation_Type_REPLACE_BZ, |
| 736 vertex.op.type()); |
| 737 EXPECT_EQ(0, vertex.op.data_offset()); |
| 738 EXPECT_EQ(0, vertex.op.data_length()); |
| 739 EXPECT_EQ(1, vertex.op.dst_extents_size()); |
| 740 EXPECT_EQ(12, vertex.op.dst_extents(0).start_block()); |
| 741 EXPECT_EQ(34, vertex.op.dst_extents(0).num_blocks()); |
| 742 } |
| 743 |
731 } // namespace chromeos_update_engine | 744 } // namespace chromeos_update_engine |
OLD | NEW |