OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium 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 <windows.h> | 5 #include <windows.h> |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 | 555 |
556 // verify that the source, destination have not changed and backup path | 556 // verify that the source, destination have not changed and backup path |
557 // does not exist after rollback also | 557 // does not exist after rollback also |
558 EXPECT_TRUE(file_util::PathExists(file_name_from)); | 558 EXPECT_TRUE(file_util::PathExists(file_name_from)); |
559 EXPECT_TRUE(file_util::PathExists(file_name_to)); | 559 EXPECT_TRUE(file_util::PathExists(file_name_to)); |
560 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); | 560 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); |
561 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); | 561 EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); |
562 EXPECT_FALSE(file_util::PathExists(backup_file)); | 562 EXPECT_FALSE(file_util::PathExists(backup_file)); |
563 | 563 |
564 // Now delete the destination and try copying the file again. | 564 // Now delete the destination and try copying the file again. |
565 file_util::Delete(file_name_to, true); | 565 base::Delete(file_name_to, true); |
566 work_item.reset(WorkItem::CreateCopyTreeWorkItem( | 566 work_item.reset(WorkItem::CreateCopyTreeWorkItem( |
567 file_name_from, file_name_to, | 567 file_name_from, file_name_to, |
568 temp_dir_.path(), WorkItem::IF_NOT_PRESENT, | 568 temp_dir_.path(), WorkItem::IF_NOT_PRESENT, |
569 base::FilePath())); | 569 base::FilePath())); |
570 EXPECT_TRUE(work_item->Do()); | 570 EXPECT_TRUE(work_item->Do()); |
571 | 571 |
572 // verify that the source, destination are the same and backup path | 572 // verify that the source, destination are the same and backup path |
573 // does not exist | 573 // does not exist |
574 EXPECT_TRUE(file_util::PathExists(file_name_from)); | 574 EXPECT_TRUE(file_util::PathExists(file_name_from)); |
575 EXPECT_TRUE(file_util::PathExists(file_name_to)); | 575 EXPECT_TRUE(file_util::PathExists(file_name_to)); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); | 714 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); |
715 | 715 |
716 base::FilePath file_name_to_2(dir_name_to); | 716 base::FilePath file_name_to_2(dir_name_to); |
717 file_name_to_2 = file_name_to_2.AppendASCII("2"); | 717 file_name_to_2 = file_name_to_2.AppendASCII("2"); |
718 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); | 718 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); |
719 EXPECT_TRUE(file_util::PathExists(file_name_to_2)); | 719 EXPECT_TRUE(file_util::PathExists(file_name_to_2)); |
720 VLOG(1) << "compare " << file_name_from_2.value() | 720 VLOG(1) << "compare " << file_name_from_2.value() |
721 << " and " << file_name_to_2.value(); | 721 << " and " << file_name_to_2.value(); |
722 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); | 722 EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); |
723 } | 723 } |
OLD | NEW |