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

Side by Side Diff: chrome/installer/util/copy_tree_work_item_unittest.cc

Issue 1471073008: Do not do unnecessary recursive deletes for files. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years 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
OLDNEW
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/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 // verify that the source, destination have not changed and backup path 554 // verify that the source, destination have not changed and backup path
555 // does not exist after rollback also 555 // does not exist after rollback also
556 EXPECT_TRUE(base::PathExists(file_name_from)); 556 EXPECT_TRUE(base::PathExists(file_name_from));
557 EXPECT_TRUE(base::PathExists(file_name_to)); 557 EXPECT_TRUE(base::PathExists(file_name_to));
558 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); 558 EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1));
559 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to)); 559 EXPECT_TRUE(base::ContentsEqual(exe_full_path, file_name_to));
560 EXPECT_FALSE(base::PathExists(backup_file)); 560 EXPECT_FALSE(base::PathExists(backup_file));
561 561
562 // Now delete the destination and try copying the file again. 562 // Now delete the destination and try copying the file again.
563 base::DeleteFile(file_name_to, true); 563 base::DeleteFile(file_name_to, false);
564 work_item.reset(WorkItem::CreateCopyTreeWorkItem( 564 work_item.reset(WorkItem::CreateCopyTreeWorkItem(
565 file_name_from, file_name_to, 565 file_name_from, file_name_to,
566 temp_dir_.path(), WorkItem::IF_NOT_PRESENT, 566 temp_dir_.path(), WorkItem::IF_NOT_PRESENT,
567 base::FilePath())); 567 base::FilePath()));
568 EXPECT_TRUE(work_item->Do()); 568 EXPECT_TRUE(work_item->Do());
569 569
570 // verify that the source, destination are the same and backup path 570 // verify that the source, destination are the same and backup path
571 // does not exist 571 // does not exist
572 EXPECT_TRUE(base::PathExists(file_name_from)); 572 EXPECT_TRUE(base::PathExists(file_name_from));
573 EXPECT_TRUE(base::PathExists(file_name_to)); 573 EXPECT_TRUE(base::PathExists(file_name_to));
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); 712 EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1));
713 713
714 base::FilePath file_name_to_2(dir_name_to); 714 base::FilePath file_name_to_2(dir_name_to);
715 file_name_to_2 = file_name_to_2.AppendASCII("2"); 715 file_name_to_2 = file_name_to_2.AppendASCII("2");
716 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); 716 file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt");
717 EXPECT_TRUE(base::PathExists(file_name_to_2)); 717 EXPECT_TRUE(base::PathExists(file_name_to_2));
718 VLOG(1) << "compare " << file_name_from_2.value() 718 VLOG(1) << "compare " << file_name_from_2.value()
719 << " and " << file_name_to_2.value(); 719 << " and " << file_name_to_2.value();
720 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); 720 EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2));
721 } 721 }
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_info_cache_unittest.cc ('k') | storage/browser/fileapi/file_system_usage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698