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

Unified Diff: chrome/installer/util/move_tree_work_item_unittest.cc

Issue 2321573002: //chrome misc: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Fix Win compilation Created 4 years, 3 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/installer/util/move_tree_work_item_unittest.cc
diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc
index 8a82a800bc89ff837383dd0ae1bb04dd710e93fd..6c6152b7a9ac241104b9f5f739e63bc9705f6073 100644
--- a/chrome/installer/util/move_tree_work_item_unittest.cc
+++ b/chrome/installer/util/move_tree_work_item_unittest.cc
@@ -60,7 +60,7 @@ const wchar_t kTextContent2[] = L"Overwrite Me";
// exist.
TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
// Create two level deep source dir
- base::FilePath from_dir1(temp_from_dir_.path());
+ base::FilePath from_dir1(temp_from_dir_.GetPath());
from_dir1 = from_dir1.AppendASCII("From_Dir1");
base::CreateDirectory(from_dir1);
ASSERT_TRUE(base::PathExists(from_dir1));
@@ -76,7 +76,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
ASSERT_TRUE(base::PathExists(from_file));
// Generate destination path
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
ASSERT_FALSE(base::PathExists(to_dir));
@@ -87,7 +87,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
// test Do()
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_dir1, to_dir, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_FALSE(base::PathExists(from_dir1));
@@ -106,7 +106,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) {
// exists.
TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// Create two level deep source dir
- base::FilePath from_dir1(temp_from_dir_.path());
+ base::FilePath from_dir1(temp_from_dir_.GetPath());
from_dir1 = from_dir1.AppendASCII("From_Dir1");
base::CreateDirectory(from_dir1);
ASSERT_TRUE(base::PathExists(from_dir1));
@@ -122,7 +122,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
ASSERT_TRUE(base::PathExists(from_file));
// Create destination path
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
base::CreateDirectory(to_dir);
ASSERT_TRUE(base::PathExists(to_dir));
@@ -139,7 +139,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// test Do(), don't check for duplicates.
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_dir1, to_dir, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_FALSE(base::PathExists(from_dir1));
@@ -162,7 +162,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) {
// exist.
TEST_F(MoveTreeWorkItemTest, MoveAFile) {
// Create a file inside source dir
- base::FilePath from_dir(temp_from_dir_.path());
+ base::FilePath from_dir(temp_from_dir_.GetPath());
from_dir = from_dir.AppendASCII("From_Dir");
base::CreateDirectory(from_dir);
ASSERT_TRUE(base::PathExists(from_dir));
@@ -173,13 +173,13 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) {
ASSERT_TRUE(base::PathExists(from_file));
// Generate destination file name
- base::FilePath to_file(temp_from_dir_.path());
+ base::FilePath to_file(temp_from_dir_.GetPath());
to_file = to_file.AppendASCII("To_File");
ASSERT_FALSE(base::PathExists(to_file));
// test Do()
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_file, to_file, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(base::PathExists(from_dir));
@@ -200,7 +200,7 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) {
// exists.
TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// Create a file inside source dir
- base::FilePath from_dir(temp_from_dir_.path());
+ base::FilePath from_dir(temp_from_dir_.GetPath());
from_dir = from_dir.AppendASCII("From_Dir");
base::CreateDirectory(from_dir);
ASSERT_TRUE(base::PathExists(from_dir));
@@ -211,7 +211,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
ASSERT_TRUE(base::PathExists(from_file));
// Create destination path
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
base::CreateDirectory(to_dir);
ASSERT_TRUE(base::PathExists(to_dir));
@@ -223,7 +223,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// test Do()
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_dir, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_file, to_dir, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(base::PathExists(from_dir));
@@ -245,7 +245,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) {
// exists and is in use.
TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// Create a file inside source dir
- base::FilePath from_dir(temp_from_dir_.path());
+ base::FilePath from_dir(temp_from_dir_.GetPath());
from_dir = from_dir.AppendASCII("From_Dir");
base::CreateDirectory(from_dir);
ASSERT_TRUE(base::PathExists(from_dir));
@@ -256,7 +256,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
ASSERT_TRUE(base::PathExists(from_file));
// Create an executable in destination path by copying ourself to it.
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
base::CreateDirectory(to_dir);
ASSERT_TRUE(base::PathExists(to_dir));
@@ -280,7 +280,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// test Do()
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_file, to_file, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(base::PathExists(from_dir));
@@ -305,7 +305,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) {
// Move one file that is in use to destination.
TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// Create an executable for source by copying ourself to a new source dir.
- base::FilePath from_dir(temp_from_dir_.path());
+ base::FilePath from_dir(temp_from_dir_.GetPath());
from_dir = from_dir.AppendASCII("From_Dir");
base::CreateDirectory(from_dir);
ASSERT_TRUE(base::PathExists(from_dir));
@@ -319,7 +319,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
ASSERT_TRUE(base::PathExists(from_file));
// Create a destination source dir and generate destination file name.
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
base::CreateDirectory(to_dir);
ASSERT_TRUE(base::PathExists(to_dir));
@@ -340,7 +340,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// test Do()
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_file, to_file, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_file, to_file, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_TRUE(work_item->Do());
EXPECT_TRUE(base::PathExists(from_dir));
@@ -373,7 +373,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) {
// exists.
TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) {
// Create two level deep source dir
- base::FilePath from_dir1(temp_from_dir_.path());
+ base::FilePath from_dir1(temp_from_dir_.GetPath());
from_dir1 = from_dir1.AppendASCII("From_Dir1");
base::CreateDirectory(from_dir1);
ASSERT_TRUE(base::PathExists(from_dir1));
@@ -389,7 +389,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) {
ASSERT_TRUE(base::PathExists(from_file));
// // Create a file hierarchy identical to the one in the source directory.
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
ASSERT_TRUE(installer::test::CopyFileHierarchy(from_dir1, to_dir));
@@ -401,16 +401,13 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) {
// First check that we can't do the regular Move().
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_to_dir_.path(), WorkItem::ALWAYS_MOVE));
+ from_dir1, to_dir, temp_to_dir_.GetPath(), WorkItem::ALWAYS_MOVE));
EXPECT_FALSE(work_item->Do());
work_item->Rollback();
// Now test Do() with the check for duplicates. This should pass.
- work_item.reset(
- WorkItem::CreateMoveTreeWorkItem(from_dir1,
- to_dir,
- temp_to_dir_.path(),
- WorkItem::CHECK_DUPLICATES));
+ work_item.reset(WorkItem::CreateMoveTreeWorkItem(
+ from_dir1, to_dir, temp_to_dir_.GetPath(), WorkItem::CHECK_DUPLICATES));
EXPECT_TRUE(work_item->Do());
// Make sure that we "moved" the files, i.e. that the source directory isn't
@@ -420,7 +417,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) {
EXPECT_TRUE(base::PathExists(to_dir));
EXPECT_TRUE(base::PathExists(orig_to_file));
// Make sure that the backup path is not empty.
- EXPECT_FALSE(base::IsDirectoryEmpty(temp_to_dir_.path()));
+ EXPECT_FALSE(base::IsDirectoryEmpty(temp_to_dir_.GetPath()));
// Check that the work item believes the source to have been moved.
EXPECT_TRUE(work_item->source_moved_to_backup_);
@@ -443,7 +440,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) {
// exists but contains only a subset of the files in source.
TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) {
// Create two level deep source dir
- base::FilePath from_dir1(temp_from_dir_.path());
+ base::FilePath from_dir1(temp_from_dir_.GetPath());
from_dir1 = from_dir1.AppendASCII("From_Dir1");
base::CreateDirectory(from_dir1);
ASSERT_TRUE(base::PathExists(from_dir1));
@@ -464,7 +461,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) {
ASSERT_TRUE(base::PathExists(from_file2));
// Create destination path
- base::FilePath to_dir(temp_from_dir_.path());
+ base::FilePath to_dir(temp_from_dir_.GetPath());
to_dir = to_dir.AppendASCII("To_Dir");
base::CreateDirectory(to_dir);
ASSERT_TRUE(base::PathExists(to_dir));
@@ -483,7 +480,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) {
// test Do(), check for duplicates.
std::unique_ptr<MoveTreeWorkItem> work_item(WorkItem::CreateMoveTreeWorkItem(
- from_dir1, to_dir, temp_to_dir_.path(), WorkItem::CHECK_DUPLICATES));
+ from_dir1, to_dir, temp_to_dir_.GetPath(), WorkItem::CHECK_DUPLICATES));
EXPECT_TRUE(work_item->Do());
// Make sure that we "moved" the files, i.e. that the source directory isn't
@@ -493,7 +490,7 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) {
EXPECT_TRUE(base::PathExists(to_dir));
EXPECT_TRUE(base::PathExists(orig_to_file));
// Make sure that the backup path is not empty.
- EXPECT_FALSE(base::IsDirectoryEmpty(temp_to_dir_.path()));
+ EXPECT_FALSE(base::IsDirectoryEmpty(temp_to_dir_.GetPath()));
// Make sure that the "new" file is also present.
base::FilePath new_to_file2(to_dir2);
new_to_file2 = new_to_file2.AppendASCII("From_File2");
« no previous file with comments | « chrome/installer/util/lzma_util_unittest.cc ('k') | chrome/installer/util/self_cleaning_temp_dir_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698