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 "chrome/installer/util/copy_tree_work_item.h" |
| 6 |
5 #include <windows.h> | 7 #include <windows.h> |
6 | 8 |
7 #include <fstream> | 9 #include <fstream> |
| 10 #include <memory> |
8 | 11 |
9 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
10 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
11 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/strings/string_util.h" | 16 #include "base/strings/string_util.h" |
15 #include "base/threading/platform_thread.h" | 17 #include "base/threading/platform_thread.h" |
16 #include "chrome/installer/util/copy_tree_work_item.h" | |
17 #include "chrome/installer/util/work_item.h" | 18 #include "chrome/installer/util/work_item.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 class CopyTreeWorkItemTest : public testing::Test { | 23 class CopyTreeWorkItemTest : public testing::Test { |
23 protected: | 24 protected: |
24 void SetUp() override { | 25 void SetUp() override { |
25 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 26 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
26 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); | 27 ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Create destination path | 84 // Create destination path |
84 base::FilePath dir_name_to(test_dir_.path()); | 85 base::FilePath dir_name_to(test_dir_.path()); |
85 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); | 86 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); |
86 base::CreateDirectory(dir_name_to); | 87 base::CreateDirectory(dir_name_to); |
87 ASSERT_TRUE(base::PathExists(dir_name_to)); | 88 ASSERT_TRUE(base::PathExists(dir_name_to)); |
88 | 89 |
89 base::FilePath file_name_to(dir_name_to); | 90 base::FilePath file_name_to(dir_name_to); |
90 file_name_to = file_name_to.AppendASCII("File_To.txt"); | 91 file_name_to = file_name_to.AppendASCII("File_To.txt"); |
91 | 92 |
92 // test Do() | 93 // test Do() |
93 scoped_ptr<CopyTreeWorkItem> work_item( | 94 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
94 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 95 file_name_from, file_name_to, temp_dir_.path(), WorkItem::ALWAYS, |
95 file_name_to, | 96 base::FilePath())); |
96 temp_dir_.path(), | |
97 WorkItem::ALWAYS, | |
98 base::FilePath())); | |
99 | 97 |
100 EXPECT_TRUE(work_item->Do()); | 98 EXPECT_TRUE(work_item->Do()); |
101 | 99 |
102 EXPECT_TRUE(base::PathExists(file_name_from)); | 100 EXPECT_TRUE(base::PathExists(file_name_from)); |
103 EXPECT_TRUE(base::PathExists(file_name_to)); | 101 EXPECT_TRUE(base::PathExists(file_name_to)); |
104 EXPECT_TRUE(base::ContentsEqual(file_name_from, file_name_to)); | 102 EXPECT_TRUE(base::ContentsEqual(file_name_from, file_name_to)); |
105 | 103 |
106 // test rollback() | 104 // test rollback() |
107 work_item->Rollback(); | 105 work_item->Rollback(); |
108 | 106 |
(...skipping 16 matching lines...) Expand all Loading... |
125 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); | 123 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); |
126 base::CreateDirectory(dir_name_to); | 124 base::CreateDirectory(dir_name_to); |
127 ASSERT_TRUE(base::PathExists(dir_name_to)); | 125 ASSERT_TRUE(base::PathExists(dir_name_to)); |
128 | 126 |
129 base::FilePath file_name_to(dir_name_to); | 127 base::FilePath file_name_to(dir_name_to); |
130 file_name_to = file_name_to.AppendASCII("File_To.txt"); | 128 file_name_to = file_name_to.AppendASCII("File_To.txt"); |
131 CreateTextFile(file_name_to.value(), text_content_2); | 129 CreateTextFile(file_name_to.value(), text_content_2); |
132 ASSERT_TRUE(base::PathExists(file_name_to)); | 130 ASSERT_TRUE(base::PathExists(file_name_to)); |
133 | 131 |
134 // test Do() with always_overwrite being true. | 132 // test Do() with always_overwrite being true. |
135 scoped_ptr<CopyTreeWorkItem> work_item( | 133 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
136 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 134 file_name_from, file_name_to, temp_dir_.path(), WorkItem::ALWAYS, |
137 file_name_to, | 135 base::FilePath())); |
138 temp_dir_.path(), | |
139 WorkItem::ALWAYS, | |
140 base::FilePath())); | |
141 | 136 |
142 EXPECT_TRUE(work_item->Do()); | 137 EXPECT_TRUE(work_item->Do()); |
143 | 138 |
144 EXPECT_TRUE(base::PathExists(file_name_from)); | 139 EXPECT_TRUE(base::PathExists(file_name_from)); |
145 EXPECT_TRUE(base::PathExists(file_name_to)); | 140 EXPECT_TRUE(base::PathExists(file_name_to)); |
146 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); | 141 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); |
147 EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); | 142 EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); |
148 | 143 |
149 // test rollback() | 144 // test rollback() |
150 work_item->Rollback(); | 145 work_item->Rollback(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); | 190 dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); |
196 base::CreateDirectory(dir_name_to); | 191 base::CreateDirectory(dir_name_to); |
197 ASSERT_TRUE(base::PathExists(dir_name_to)); | 192 ASSERT_TRUE(base::PathExists(dir_name_to)); |
198 | 193 |
199 base::FilePath file_name_to(dir_name_to); | 194 base::FilePath file_name_to(dir_name_to); |
200 file_name_to = file_name_to.AppendASCII("File_To.txt"); | 195 file_name_to = file_name_to.AppendASCII("File_To.txt"); |
201 CreateTextFile(file_name_to.value(), text_content_1); | 196 CreateTextFile(file_name_to.value(), text_content_1); |
202 ASSERT_TRUE(base::PathExists(file_name_to)); | 197 ASSERT_TRUE(base::PathExists(file_name_to)); |
203 | 198 |
204 // test Do() with always_overwrite being true. | 199 // test Do() with always_overwrite being true. |
205 scoped_ptr<CopyTreeWorkItem> work_item( | 200 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
206 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 201 file_name_from, file_name_to, temp_dir_.path(), WorkItem::ALWAYS, |
207 file_name_to, | 202 base::FilePath())); |
208 temp_dir_.path(), | |
209 WorkItem::ALWAYS, | |
210 base::FilePath())); | |
211 | 203 |
212 EXPECT_TRUE(work_item->Do()); | 204 EXPECT_TRUE(work_item->Do()); |
213 | 205 |
214 // Get the path of backup file | 206 // Get the path of backup file |
215 base::FilePath backup_file(work_item->backup_path_.path()); | 207 base::FilePath backup_file(work_item->backup_path_.path()); |
216 EXPECT_FALSE(backup_file.empty()); | 208 EXPECT_FALSE(backup_file.empty()); |
217 backup_file = backup_file.AppendASCII("File_To.txt"); | 209 backup_file = backup_file.AppendASCII("File_To.txt"); |
218 | 210 |
219 EXPECT_TRUE(base::PathExists(file_name_from)); | 211 EXPECT_TRUE(base::PathExists(file_name_from)); |
220 EXPECT_TRUE(base::PathExists(file_name_to)); | 212 EXPECT_TRUE(base::PathExists(file_name_to)); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 | 271 |
280 base::FilePath file_name_to(dir_name_to); | 272 base::FilePath file_name_to(dir_name_to); |
281 file_name_to = file_name_to.AppendASCII("File_To.txt"); | 273 file_name_to = file_name_to.AppendASCII("File_To.txt"); |
282 CreateTextFile(file_name_to.value(), text_content_2); | 274 CreateTextFile(file_name_to.value(), text_content_2); |
283 ASSERT_TRUE(base::PathExists(file_name_to)); | 275 ASSERT_TRUE(base::PathExists(file_name_to)); |
284 | 276 |
285 base::FilePath backup_file; | 277 base::FilePath backup_file; |
286 | 278 |
287 { | 279 { |
288 // test Do(). | 280 // test Do(). |
289 scoped_ptr<CopyTreeWorkItem> work_item( | 281 std::unique_ptr<CopyTreeWorkItem> work_item( |
290 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 282 WorkItem::CreateCopyTreeWorkItem( |
291 file_name_to, | 283 file_name_from, file_name_to, temp_dir_.path(), |
292 temp_dir_.path(), | 284 WorkItem::IF_DIFFERENT, base::FilePath())); |
293 WorkItem::IF_DIFFERENT, | |
294 base::FilePath())); | |
295 | 285 |
296 EXPECT_TRUE(work_item->Do()); | 286 EXPECT_TRUE(work_item->Do()); |
297 | 287 |
298 // Get the path of backup file | 288 // Get the path of backup file |
299 backup_file = work_item->backup_path_.path(); | 289 backup_file = work_item->backup_path_.path(); |
300 EXPECT_FALSE(backup_file.empty()); | 290 EXPECT_FALSE(backup_file.empty()); |
301 backup_file = backup_file.AppendASCII("File_To.txt"); | 291 backup_file = backup_file.AppendASCII("File_To.txt"); |
302 | 292 |
303 EXPECT_TRUE(base::PathExists(file_name_from)); | 293 EXPECT_TRUE(base::PathExists(file_name_from)); |
304 EXPECT_TRUE(base::PathExists(file_name_to)); | 294 EXPECT_TRUE(base::PathExists(file_name_to)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 333 |
344 // Run the executable in destination path | 334 // Run the executable in destination path |
345 STARTUPINFOW si = {sizeof(si)}; | 335 STARTUPINFOW si = {sizeof(si)}; |
346 PROCESS_INFORMATION pi = {0}; | 336 PROCESS_INFORMATION pi = {0}; |
347 ASSERT_TRUE( | 337 ASSERT_TRUE( |
348 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), | 338 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), |
349 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, | 339 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, |
350 NULL, NULL, &si, &pi)); | 340 NULL, NULL, &si, &pi)); |
351 | 341 |
352 // test Do(). | 342 // test Do(). |
353 scoped_ptr<CopyTreeWorkItem> work_item( | 343 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
354 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 344 file_name_from, file_name_to, temp_dir_.path(), WorkItem::IF_DIFFERENT, |
355 file_name_to, | 345 base::FilePath())); |
356 temp_dir_.path(), | |
357 WorkItem::IF_DIFFERENT, | |
358 base::FilePath())); | |
359 | 346 |
360 EXPECT_TRUE(work_item->Do()); | 347 EXPECT_TRUE(work_item->Do()); |
361 | 348 |
362 // Get the path of backup file | 349 // Get the path of backup file |
363 base::FilePath backup_file(work_item->backup_path_.path()); | 350 base::FilePath backup_file(work_item->backup_path_.path()); |
364 EXPECT_FALSE(backup_file.empty()); | 351 EXPECT_FALSE(backup_file.empty()); |
365 backup_file = backup_file.AppendASCII("File_To"); | 352 backup_file = backup_file.AppendASCII("File_To"); |
366 | 353 |
367 EXPECT_TRUE(base::PathExists(file_name_from)); | 354 EXPECT_TRUE(base::PathExists(file_name_from)); |
368 EXPECT_TRUE(base::PathExists(file_name_to)); | 355 EXPECT_TRUE(base::PathExists(file_name_to)); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 410 |
424 // Run the executable in destination path | 411 // Run the executable in destination path |
425 STARTUPINFOW si = {sizeof(si)}; | 412 STARTUPINFOW si = {sizeof(si)}; |
426 PROCESS_INFORMATION pi = {0}; | 413 PROCESS_INFORMATION pi = {0}; |
427 ASSERT_TRUE( | 414 ASSERT_TRUE( |
428 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), | 415 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), |
429 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, | 416 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, |
430 NULL, NULL, &si, &pi)); | 417 NULL, NULL, &si, &pi)); |
431 | 418 |
432 // test Do(). | 419 // test Do(). |
433 scoped_ptr<CopyTreeWorkItem> work_item( | 420 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
434 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 421 file_name_from, file_name_to, temp_dir_.path(), |
435 file_name_to, | 422 WorkItem::NEW_NAME_IF_IN_USE, alternate_to)); |
436 temp_dir_.path(), | |
437 WorkItem::NEW_NAME_IF_IN_USE, | |
438 alternate_to)); | |
439 | 423 |
440 EXPECT_TRUE(work_item->Do()); | 424 EXPECT_TRUE(work_item->Do()); |
441 | 425 |
442 EXPECT_TRUE(base::PathExists(file_name_from)); | 426 EXPECT_TRUE(base::PathExists(file_name_from)); |
443 EXPECT_TRUE(base::PathExists(file_name_to)); | 427 EXPECT_TRUE(base::PathExists(file_name_to)); |
444 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); | 428 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); |
445 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); | 429 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); |
446 // verify that the backup path does not exist | 430 // verify that the backup path does not exist |
447 EXPECT_TRUE(work_item->backup_path_.path().empty()); | 431 EXPECT_TRUE(work_item->backup_path_.path().empty()); |
448 EXPECT_TRUE(base::ContentsEqual(file_name_from, alternate_to)); | 432 EXPECT_TRUE(base::ContentsEqual(file_name_from, alternate_to)); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
525 base::FilePath file_name_to(dir_name_to); | 509 base::FilePath file_name_to(dir_name_to); |
526 file_name_to = file_name_to.AppendASCII("File_To"); | 510 file_name_to = file_name_to.AppendASCII("File_To"); |
527 base::CopyFile(exe_full_path, file_name_to); | 511 base::CopyFile(exe_full_path, file_name_to); |
528 ASSERT_TRUE(base::PathExists(file_name_to)); | 512 ASSERT_TRUE(base::PathExists(file_name_to)); |
529 | 513 |
530 // Get the path of backup file | 514 // Get the path of backup file |
531 base::FilePath backup_file(temp_dir_.path()); | 515 base::FilePath backup_file(temp_dir_.path()); |
532 backup_file = backup_file.AppendASCII("File_To"); | 516 backup_file = backup_file.AppendASCII("File_To"); |
533 | 517 |
534 // test Do(). | 518 // test Do(). |
535 scoped_ptr<CopyTreeWorkItem> work_item( | 519 std::unique_ptr<CopyTreeWorkItem> work_item(WorkItem::CreateCopyTreeWorkItem( |
536 WorkItem::CreateCopyTreeWorkItem( | 520 file_name_from, file_name_to, temp_dir_.path(), WorkItem::IF_NOT_PRESENT, |
537 file_name_from, | 521 base::FilePath())); |
538 file_name_to, temp_dir_.path(), | |
539 WorkItem::IF_NOT_PRESENT, | |
540 base::FilePath())); | |
541 EXPECT_TRUE(work_item->Do()); | 522 EXPECT_TRUE(work_item->Do()); |
542 | 523 |
543 // verify that the source, destination have not changed and backup path | 524 // verify that the source, destination have not changed and backup path |
544 // does not exist | 525 // does not exist |
545 EXPECT_TRUE(base::PathExists(file_name_from)); | 526 EXPECT_TRUE(base::PathExists(file_name_from)); |
546 EXPECT_TRUE(base::PathExists(file_name_to)); | 527 EXPECT_TRUE(base::PathExists(file_name_to)); |
547 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); | 528 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); |
548 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); | 529 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); |
549 EXPECT_FALSE(base::PathExists(backup_file)); | 530 EXPECT_FALSE(base::PathExists(backup_file)); |
550 | 531 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 PROCESS_INFORMATION pi = {0}; | 599 PROCESS_INFORMATION pi = {0}; |
619 ASSERT_TRUE( | 600 ASSERT_TRUE( |
620 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), | 601 ::CreateProcess(NULL, const_cast<wchar_t*>(file_name_to.value().c_str()), |
621 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, | 602 NULL, NULL, FALSE, CREATE_NO_WINDOW | CREATE_SUSPENDED, |
622 NULL, NULL, &si, &pi)); | 603 NULL, NULL, &si, &pi)); |
623 | 604 |
624 base::FilePath backup_file; | 605 base::FilePath backup_file; |
625 | 606 |
626 // test Do(). | 607 // test Do(). |
627 { | 608 { |
628 scoped_ptr<CopyTreeWorkItem> work_item( | 609 std::unique_ptr<CopyTreeWorkItem> work_item( |
629 WorkItem::CreateCopyTreeWorkItem(file_name_from, | 610 WorkItem::CreateCopyTreeWorkItem( |
630 file_name_to, | 611 file_name_from, file_name_to, temp_dir_.path(), |
631 temp_dir_.path(), | 612 WorkItem::IF_DIFFERENT, base::FilePath())); |
632 WorkItem::IF_DIFFERENT, | |
633 base::FilePath())); | |
634 | 613 |
635 EXPECT_TRUE(work_item->Do()); | 614 EXPECT_TRUE(work_item->Do()); |
636 | 615 |
637 // Get the path of backup file | 616 // Get the path of backup file |
638 backup_file = work_item->backup_path_.path(); | 617 backup_file = work_item->backup_path_.path(); |
639 EXPECT_FALSE(backup_file.empty()); | 618 EXPECT_FALSE(backup_file.empty()); |
640 backup_file = backup_file.AppendASCII("File_To"); | 619 backup_file = backup_file.AppendASCII("File_To"); |
641 | 620 |
642 EXPECT_TRUE(base::PathExists(file_name_from)); | 621 EXPECT_TRUE(base::PathExists(file_name_from)); |
643 EXPECT_TRUE(base::PathExists(file_name_to)); | 622 EXPECT_TRUE(base::PathExists(file_name_to)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
686 base::FilePath file_name_from_2(dir_name_from_2); | 665 base::FilePath file_name_from_2(dir_name_from_2); |
687 file_name_from_2 = file_name_from_2.AppendASCII("File_2.txt"); | 666 file_name_from_2 = file_name_from_2.AppendASCII("File_2.txt"); |
688 CreateTextFile(file_name_from_2.value(), text_content_1); | 667 CreateTextFile(file_name_from_2.value(), text_content_1); |
689 ASSERT_TRUE(base::PathExists(file_name_from_2)); | 668 ASSERT_TRUE(base::PathExists(file_name_from_2)); |
690 | 669 |
691 base::FilePath dir_name_to(test_dir_.path()); | 670 base::FilePath dir_name_to(test_dir_.path()); |
692 dir_name_to = dir_name_to.AppendASCII("to"); | 671 dir_name_to = dir_name_to.AppendASCII("to"); |
693 | 672 |
694 // test Do() | 673 // test Do() |
695 { | 674 { |
696 scoped_ptr<CopyTreeWorkItem> work_item( | 675 std::unique_ptr<CopyTreeWorkItem> work_item( |
697 WorkItem::CreateCopyTreeWorkItem(dir_name_from, | 676 WorkItem::CreateCopyTreeWorkItem(dir_name_from, dir_name_to, |
698 dir_name_to, | 677 temp_dir_.path(), WorkItem::ALWAYS, |
699 temp_dir_.path(), | |
700 WorkItem::ALWAYS, | |
701 base::FilePath())); | 678 base::FilePath())); |
702 | 679 |
703 EXPECT_TRUE(work_item->Do()); | 680 EXPECT_TRUE(work_item->Do()); |
704 } | 681 } |
705 | 682 |
706 base::FilePath file_name_to_1(dir_name_to); | 683 base::FilePath file_name_to_1(dir_name_to); |
707 file_name_to_1 = file_name_to_1.AppendASCII("1"); | 684 file_name_to_1 = file_name_to_1.AppendASCII("1"); |
708 file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); | 685 file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); |
709 EXPECT_TRUE(base::PathExists(file_name_to_1)); | 686 EXPECT_TRUE(base::PathExists(file_name_to_1)); |
710 VLOG(1) << "compare " << file_name_from_1.value() | 687 VLOG(1) << "compare " << file_name_from_1.value() |
711 << " and " << file_name_to_1.value(); | 688 << " and " << file_name_to_1.value(); |
712 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); | 689 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); |
713 | 690 |
714 base::FilePath file_name_to_2(dir_name_to); | 691 base::FilePath file_name_to_2(dir_name_to); |
715 file_name_to_2 = file_name_to_2.AppendASCII("2"); | 692 file_name_to_2 = file_name_to_2.AppendASCII("2"); |
716 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); | 693 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); |
717 EXPECT_TRUE(base::PathExists(file_name_to_2)); | 694 EXPECT_TRUE(base::PathExists(file_name_to_2)); |
718 VLOG(1) << "compare " << file_name_from_2.value() | 695 VLOG(1) << "compare " << file_name_from_2.value() |
719 << " and " << file_name_to_2.value(); | 696 << " and " << file_name_to_2.value(); |
720 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); | 697 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); |
721 } | 698 } |
OLD | NEW |