diff options
361 files changed, 1509 insertions, 1510 deletions
diff --git a/base/android/path_utils_unittest.cc b/base/android/path_utils_unittest.cc index 52b1928..c4c12fe 100644 --- a/base/android/path_utils_unittest.cc +++ b/base/android/path_utils_unittest.cc @@ -39,7 +39,7 @@ TEST_F(PathUtilsTest, TestGetNativeLibraryDirectory) { // the base tests shared object. FilePath path; GetNativeLibraryDirectory(&path); - EXPECT_TRUE(file_util::PathExists(path.Append(("libbase_unittests.so")))); + EXPECT_TRUE(base::PathExists(path.Append(("libbase_unittests.so")))); } } // namespace android diff --git a/base/base_paths.cc b/base/base_paths.cc index b90efba..9f2b250 100644 --- a/base/base_paths.cc +++ b/base/base_paths.cc @@ -33,7 +33,7 @@ bool PathProvider(int key, FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("base")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // We don't want to create this. + if (!base::PathExists(cur)) // We don't want to create this. return false; break; default: diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm index 1e8bac8..a1121aa 100644 --- a/base/base_paths_mac.mm +++ b/base/base_paths_mac.mm @@ -65,7 +65,7 @@ bool PathProviderMac(int key, base::FilePath* result) { result); #if defined(OS_IOS) // On IOS, this directory does not exist unless it is created explicitly. - if (success && !file_util::PathExists(*result)) + if (success && !base::PathExists(*result)) success = file_util::CreateDirectory(*result); #endif // defined(OS_IOS) return success; diff --git a/base/base_paths_posix.cc b/base/base_paths_posix.cc index 59be094..6d7b5e1 100644 --- a/base/base_paths_posix.cc +++ b/base/base_paths_posix.cc @@ -80,7 +80,7 @@ bool PathProviderPosix(int key, FilePath* result) { std::string cr_source_root; if (env->GetVar("CR_SOURCE_ROOT", &cr_source_root)) { path = FilePath(cr_source_root); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { *result = path; return true; } else { diff --git a/base/file_util.h b/base/file_util.h index 321070f..095734b 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -112,16 +112,16 @@ BASE_EXPORT bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool recursive); +// Returns true if the given path exists on the local filesystem, +// false otherwise. +BASE_EXPORT bool PathExists(const FilePath& path); + } // namespace base // ----------------------------------------------------------------------------- namespace file_util { -// Returns true if the given path exists on the local filesystem, -// false otherwise. -BASE_EXPORT bool PathExists(const base::FilePath& path); - // Returns true if the given path is writable by the user, false otherwise. BASE_EXPORT bool PathIsWritable(const base::FilePath& path); diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 018a48d..f438253 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -227,7 +227,7 @@ bool CopyDirectory(const FilePath& from_path, // This function does not properly handle destinations within the source FilePath real_to_path = to_path; - if (file_util::PathExists(real_to_path)) { + if (PathExists(real_to_path)) { real_to_path = MakeAbsoluteFilePath(real_to_path); if (real_to_path.empty()) return false; @@ -309,6 +309,11 @@ bool CopyDirectory(const FilePath& from_path, return success; } +bool PathExists(const FilePath& path) { + ThreadRestrictions::AssertIOAllowed(); + return access(path.value().c_str(), F_OK) == 0; +} + } // namespace base // ----------------------------------------------------------------------------- @@ -324,11 +329,6 @@ using base::MakeAbsoluteFilePath; using base::RealPath; using base::VerifySpecificPathControlledByUser; -bool PathExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); - return access(path.value().c_str(), F_OK) == 0; -} - bool PathIsWritable(const FilePath& path) { base::ThreadRestrictions::AssertIOAllowed(); return access(path.value().c_str(), W_OK) == 0; diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index 5576548..c73d079 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -349,18 +349,18 @@ TEST_F(FileUtilTest, NormalizeFilePathBasic) { file_util::CreateDirectory(dir_path); FilePath normalized_file_a_path, normalized_file_b_path; - ASSERT_FALSE(file_util::PathExists(file_a_path)); + ASSERT_FALSE(base::PathExists(file_a_path)); ASSERT_FALSE(file_util::NormalizeFilePath(file_a_path, &normalized_file_a_path)) << "NormalizeFilePath() should fail on nonexistent paths."; CreateTextFile(file_a_path, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_a_path)); + ASSERT_TRUE(base::PathExists(file_a_path)); ASSERT_TRUE(file_util::NormalizeFilePath(file_a_path, &normalized_file_a_path)); CreateTextFile(file_b_path, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_b_path)); + ASSERT_TRUE(base::PathExists(file_b_path)); ASSERT_TRUE(file_util::NormalizeFilePath(file_b_path, &normalized_file_b_path)); @@ -626,7 +626,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) { FilePath temp_file; ASSERT_TRUE(file_util::CreateTemporaryFileInDir(short_test_dir, &temp_file)); EXPECT_STREQ(kLongDirName, temp_file.DirName().BaseName().value().c_str()); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); // Create a subdirectory of |long_test_dir| and make |long_test_dir| // unreadable. We should still be able to create a temp file in the @@ -643,7 +643,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileInDirLongPathTest) { // Use the short form of the directory to create a temporary filename. ASSERT_TRUE(file_util::CreateTemporaryFileInDir( short_test_dir.Append(kTestSubDirName), &temp_file)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); EXPECT_TRUE(short_test_dir.IsParent(temp_file.DirName())); // Check that the long path can't be determined for |temp_file|. @@ -733,32 +733,32 @@ TEST_F(FileUtilTest, NormalizeFilePathSymlinks) { TEST_F(FileUtilTest, DeleteNonExistent) { FilePath non_existent = temp_dir_.path().AppendASCII("bogus_file_dne.foobar"); - ASSERT_FALSE(file_util::PathExists(non_existent)); + ASSERT_FALSE(base::PathExists(non_existent)); EXPECT_TRUE(base::Delete(non_existent, false)); - ASSERT_FALSE(file_util::PathExists(non_existent)); + ASSERT_FALSE(base::PathExists(non_existent)); EXPECT_TRUE(base::Delete(non_existent, true)); - ASSERT_FALSE(file_util::PathExists(non_existent)); + ASSERT_FALSE(base::PathExists(non_existent)); } TEST_F(FileUtilTest, DeleteFile) { // Create a file FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteFile 1.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); // Make sure it's deleted EXPECT_TRUE(base::Delete(file_name, false)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); // Test recursive case, create a new file file_name = temp_dir_.path().Append(FPL("Test DeleteFile 2.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); // Make sure it's deleted EXPECT_TRUE(base::Delete(file_name, true)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); } #if defined(OS_POSIX) @@ -766,7 +766,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) { // Create a file. FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteFile 2.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); // Create a symlink to the file. FilePath file_link = temp_dir_.path().Append("file_link_2"); @@ -777,14 +777,14 @@ TEST_F(FileUtilTest, DeleteSymlinkToExistentFile) { EXPECT_TRUE(base::Delete(file_link, false)); // Make sure original file is not deleted. - EXPECT_FALSE(file_util::PathExists(file_link)); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_link)); + EXPECT_TRUE(base::PathExists(file_name)); } TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) { // Create a non-existent file path. FilePath non_existent = temp_dir_.path().Append(FPL("Test DeleteFile 3.txt")); - EXPECT_FALSE(file_util::PathExists(non_existent)); + EXPECT_FALSE(base::PathExists(non_existent)); // Create a symlink to the non-existent file. FilePath file_link = temp_dir_.path().Append("file_link_3"); @@ -793,7 +793,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) { // Make sure the symbolic link is exist. EXPECT_TRUE(file_util::IsLink(file_link)); - EXPECT_FALSE(file_util::PathExists(file_link)); + EXPECT_FALSE(base::PathExists(file_link)); // Delete the symbolic link. EXPECT_TRUE(base::Delete(file_link, false)); @@ -805,7 +805,7 @@ TEST_F(FileUtilTest, DeleteSymlinkToNonExistentFile) { TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) { // Create a file path. FilePath file_name = temp_dir_.path().Append(FPL("Test Readable File.txt")); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); const std::string kData("hello"); @@ -815,7 +815,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) { // Write file. EXPECT_EQ(static_cast<int>(kData.length()), file_util::WriteFile(file_name, kData.data(), kData.length())); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); // Make sure the file is readable. int32 mode = 0; @@ -841,7 +841,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) { // Delete the file. EXPECT_TRUE(base::Delete(file_name, false)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); delete[] buffer; } @@ -849,14 +849,14 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndRead) { TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { // Create a file path. FilePath file_name = temp_dir_.path().Append(FPL("Test Readable File.txt")); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); const std::string kData("hello"); // Write file. EXPECT_EQ(static_cast<int>(kData.length()), file_util::WriteFile(file_name, kData.data(), kData.length())); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); // Make sure the file is writable. int mode = 0; @@ -886,7 +886,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { // Delete the file. EXPECT_TRUE(base::Delete(file_name, false)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); } TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { @@ -894,15 +894,15 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { FilePath subdir_path = temp_dir_.path().Append(FPL("PermissionTest1")); file_util::CreateDirectory(subdir_path); - ASSERT_TRUE(file_util::PathExists(subdir_path)); + ASSERT_TRUE(base::PathExists(subdir_path)); // Create a dummy file to enumerate. FilePath file_name = subdir_path.Append(FPL("Test Readable File.txt")); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); const std::string kData("hello"); EXPECT_EQ(static_cast<int>(kData.length()), file_util::WriteFile(file_name, kData.data(), kData.length())); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); // Make sure the directory has the all permissions. int mode = 0; @@ -917,7 +917,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { // Make sure the file in the directory can't be enumerated. FileEnumerator f1(subdir_path, true, FileEnumerator::FILES); - EXPECT_TRUE(file_util::PathExists(subdir_path)); + EXPECT_TRUE(base::PathExists(subdir_path)); FindResultCollector c1(f1); EXPECT_EQ(c1.size(), 0); EXPECT_FALSE(file_util::GetPosixFilePermissions(file_name, &mode)); @@ -938,7 +938,7 @@ TEST_F(FileUtilTest, ChangeDirectoryPermissionsAndEnumerate) { // Delete the file. EXPECT_TRUE(base::Delete(subdir_path, true)); - EXPECT_FALSE(file_util::PathExists(subdir_path)); + EXPECT_FALSE(base::PathExists(subdir_path)); } #endif // defined(OS_POSIX) @@ -951,11 +951,11 @@ TEST_F(FileUtilTest, DeleteWildCard) { // Create a file and a directory FilePath file_name = temp_dir_.path().Append(FPL("Test DeleteWildCard.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); FilePath subdir_path = temp_dir_.path().Append(FPL("DeleteWildCardDir")); file_util::CreateDirectory(subdir_path); - ASSERT_TRUE(file_util::PathExists(subdir_path)); + ASSERT_TRUE(base::PathExists(subdir_path)); // Create the wildcard path FilePath directory_contents = temp_dir_.path(); @@ -963,13 +963,13 @@ TEST_F(FileUtilTest, DeleteWildCard) { // Delete non-recursively and check that only the file is deleted EXPECT_TRUE(base::Delete(directory_contents, false)); - EXPECT_FALSE(file_util::PathExists(file_name)); - EXPECT_TRUE(file_util::PathExists(subdir_path)); + EXPECT_FALSE(base::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(subdir_path)); // Delete recursively and make sure all contents are deleted EXPECT_TRUE(base::Delete(directory_contents, true)); - EXPECT_FALSE(file_util::PathExists(file_name)); - EXPECT_FALSE(file_util::PathExists(subdir_path)); + EXPECT_FALSE(base::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(subdir_path)); } // TODO(erikkay): see if anyone's actually using this feature of the API @@ -978,7 +978,7 @@ TEST_F(FileUtilTest, DeleteNonExistantWildCard) { FilePath subdir_path = temp_dir_.path().Append(FPL("DeleteNonExistantWildCard")); file_util::CreateDirectory(subdir_path); - ASSERT_TRUE(file_util::PathExists(subdir_path)); + ASSERT_TRUE(base::PathExists(subdir_path)); // Create the wildcard path FilePath directory_contents = subdir_path; @@ -986,11 +986,11 @@ TEST_F(FileUtilTest, DeleteNonExistantWildCard) { // Delete non-recursively and check nothing got deleted EXPECT_TRUE(base::Delete(directory_contents, false)); - EXPECT_TRUE(file_util::PathExists(subdir_path)); + EXPECT_TRUE(base::PathExists(subdir_path)); // Delete recursively and check nothing got deleted EXPECT_TRUE(base::Delete(directory_contents, true)); - EXPECT_TRUE(file_util::PathExists(subdir_path)); + EXPECT_TRUE(base::PathExists(subdir_path)); } #endif @@ -999,29 +999,29 @@ TEST_F(FileUtilTest, DeleteDirNonRecursive) { // Create a subdirectory and put a file and two directories inside. FilePath test_subdir = temp_dir_.path().Append(FPL("DeleteDirNonRecursive")); file_util::CreateDirectory(test_subdir); - ASSERT_TRUE(file_util::PathExists(test_subdir)); + ASSERT_TRUE(base::PathExists(test_subdir)); FilePath file_name = test_subdir.Append(FPL("Test DeleteDir.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); FilePath subdir_path1 = test_subdir.Append(FPL("TestSubDir1")); file_util::CreateDirectory(subdir_path1); - ASSERT_TRUE(file_util::PathExists(subdir_path1)); + ASSERT_TRUE(base::PathExists(subdir_path1)); FilePath subdir_path2 = test_subdir.Append(FPL("TestSubDir2")); file_util::CreateDirectory(subdir_path2); - ASSERT_TRUE(file_util::PathExists(subdir_path2)); + ASSERT_TRUE(base::PathExists(subdir_path2)); // Delete non-recursively and check that the empty dir got deleted EXPECT_TRUE(base::Delete(subdir_path2, false)); - EXPECT_FALSE(file_util::PathExists(subdir_path2)); + EXPECT_FALSE(base::PathExists(subdir_path2)); // Delete non-recursively and check that nothing got deleted EXPECT_FALSE(base::Delete(test_subdir, false)); - EXPECT_TRUE(file_util::PathExists(test_subdir)); - EXPECT_TRUE(file_util::PathExists(file_name)); - EXPECT_TRUE(file_util::PathExists(subdir_path1)); + EXPECT_TRUE(base::PathExists(test_subdir)); + EXPECT_TRUE(base::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(subdir_path1)); } // Tests recursive Delete() for a directory. @@ -1029,29 +1029,29 @@ TEST_F(FileUtilTest, DeleteDirRecursive) { // Create a subdirectory and put a file and two directories inside. FilePath test_subdir = temp_dir_.path().Append(FPL("DeleteDirRecursive")); file_util::CreateDirectory(test_subdir); - ASSERT_TRUE(file_util::PathExists(test_subdir)); + ASSERT_TRUE(base::PathExists(test_subdir)); FilePath file_name = test_subdir.Append(FPL("Test DeleteDirRecursive.txt")); CreateTextFile(file_name, bogus_content); - ASSERT_TRUE(file_util::PathExists(file_name)); + ASSERT_TRUE(base::PathExists(file_name)); FilePath subdir_path1 = test_subdir.Append(FPL("TestSubDir1")); file_util::CreateDirectory(subdir_path1); - ASSERT_TRUE(file_util::PathExists(subdir_path1)); + ASSERT_TRUE(base::PathExists(subdir_path1)); FilePath subdir_path2 = test_subdir.Append(FPL("TestSubDir2")); file_util::CreateDirectory(subdir_path2); - ASSERT_TRUE(file_util::PathExists(subdir_path2)); + ASSERT_TRUE(base::PathExists(subdir_path2)); // Delete recursively and check that the empty dir got deleted EXPECT_TRUE(base::Delete(subdir_path2, true)); - EXPECT_FALSE(file_util::PathExists(subdir_path2)); + EXPECT_FALSE(base::PathExists(subdir_path2)); // Delete recursively and check that everything got deleted EXPECT_TRUE(base::Delete(test_subdir, true)); - EXPECT_FALSE(file_util::PathExists(file_name)); - EXPECT_FALSE(file_util::PathExists(subdir_path1)); - EXPECT_FALSE(file_util::PathExists(test_subdir)); + EXPECT_FALSE(base::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(subdir_path1)); + EXPECT_FALSE(base::PathExists(test_subdir)); } TEST_F(FileUtilTest, MoveFileNew) { @@ -1059,18 +1059,18 @@ TEST_F(FileUtilTest, MoveFileNew) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination. FilePath file_name_to = temp_dir_.path().Append( FILE_PATH_LITERAL("Move_Test_File_Destination.txt")); - ASSERT_FALSE(file_util::PathExists(file_name_to)); + ASSERT_FALSE(base::PathExists(file_name_to)); EXPECT_TRUE(base::Move(file_name_from, file_name_to)); // Check everything has been moved. - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, MoveFileExists) { @@ -1078,19 +1078,19 @@ TEST_F(FileUtilTest, MoveFileExists) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination name. FilePath file_name_to = temp_dir_.path().Append( FILE_PATH_LITERAL("Move_Test_File_Destination.txt")); CreateTextFile(file_name_to, L"Old file content"); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(base::Move(file_name_from, file_name_to)); // Check everything has been moved. - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(L"Gooooooooooooooooooooogle" == ReadTextFile(file_name_to)); } @@ -1099,13 +1099,13 @@ TEST_F(FileUtilTest, MoveFileDirExists) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Move_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination directory FilePath dir_name_to = temp_dir_.path().Append(FILE_PATH_LITERAL("Destination")); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); EXPECT_FALSE(base::Move(file_name_from, dir_name_to)); } @@ -1116,13 +1116,13 @@ TEST_F(FileUtilTest, MoveNew) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Move_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory FilePath txt_file_name(FILE_PATH_LITERAL("Move_Test_File.txt")); FilePath file_name_from = dir_name_from.Append(txt_file_name); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Move the directory. FilePath dir_name_to = @@ -1130,26 +1130,26 @@ TEST_F(FileUtilTest, MoveNew) { FilePath file_name_to = dir_name_to.Append(FILE_PATH_LITERAL("Move_Test_File.txt")); - ASSERT_FALSE(file_util::PathExists(dir_name_to)); + ASSERT_FALSE(base::PathExists(dir_name_to)); EXPECT_TRUE(base::Move(dir_name_from, dir_name_to)); // Check everything has been moved. - EXPECT_FALSE(file_util::PathExists(dir_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(dir_name_from)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); // Test path traversal. file_name_from = dir_name_to.Append(txt_file_name); file_name_to = dir_name_to.Append(FILE_PATH_LITERAL("..")); file_name_to = file_name_to.Append(txt_file_name); EXPECT_FALSE(base::Move(file_name_from, file_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_FALSE(base::PathExists(file_name_to)); EXPECT_TRUE(base::internal::MoveUnsafe(file_name_from, file_name_to)); - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, MoveExist) { @@ -1157,13 +1157,13 @@ TEST_F(FileUtilTest, MoveExist) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Move_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Move_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Move the directory FilePath dir_name_exists = @@ -1176,15 +1176,15 @@ TEST_F(FileUtilTest, MoveExist) { // Create the destination directory. file_util::CreateDirectory(dir_name_exists); - ASSERT_TRUE(file_util::PathExists(dir_name_exists)); + ASSERT_TRUE(base::PathExists(dir_name_exists)); EXPECT_TRUE(base::Move(dir_name_from, dir_name_to)); // Check everything has been moved. - EXPECT_FALSE(file_util::PathExists(dir_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(dir_name_from)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) { @@ -1192,25 +1192,25 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory. FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create a subdirectory. FilePath subdir_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Subdir")); file_util::CreateDirectory(subdir_name_from); - ASSERT_TRUE(file_util::PathExists(subdir_name_from)); + ASSERT_TRUE(base::PathExists(subdir_name_from)); // Create a file under the subdirectory. FilePath file_name2_from = subdir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name2_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name2_from)); + ASSERT_TRUE(base::PathExists(file_name2_from)); // Copy the directory recursively. FilePath dir_name_to = @@ -1222,19 +1222,19 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyNew) { FilePath file_name2_to = subdir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); - ASSERT_FALSE(file_util::PathExists(dir_name_to)); + ASSERT_FALSE(base::PathExists(dir_name_to)); EXPECT_TRUE(base::CopyDirectory(dir_name_from, dir_name_to, true)); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(dir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(subdir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name2_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::PathExists(subdir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name2_to)); + EXPECT_TRUE(base::PathExists(dir_name_from)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(subdir_name_from)); + EXPECT_TRUE(base::PathExists(file_name2_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(subdir_name_to)); + EXPECT_TRUE(base::PathExists(file_name2_to)); } TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) { @@ -1242,25 +1242,25 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory. FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create a subdirectory. FilePath subdir_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Subdir")); file_util::CreateDirectory(subdir_name_from); - ASSERT_TRUE(file_util::PathExists(subdir_name_from)); + ASSERT_TRUE(base::PathExists(subdir_name_from)); // Create a file under the subdirectory. FilePath file_name2_from = subdir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name2_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name2_from)); + ASSERT_TRUE(base::PathExists(file_name2_from)); // Copy the directory recursively. FilePath dir_name_exists = @@ -1277,19 +1277,19 @@ TEST_F(FileUtilTest, CopyDirectoryRecursivelyExists) { // Create the destination directory. file_util::CreateDirectory(dir_name_exists); - ASSERT_TRUE(file_util::PathExists(dir_name_exists)); + ASSERT_TRUE(base::PathExists(dir_name_exists)); EXPECT_TRUE(base::CopyDirectory(dir_name_from, dir_name_exists, true)); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(dir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(subdir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name2_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::PathExists(subdir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name2_to)); + EXPECT_TRUE(base::PathExists(dir_name_from)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(subdir_name_from)); + EXPECT_TRUE(base::PathExists(file_name2_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(subdir_name_to)); + EXPECT_TRUE(base::PathExists(file_name2_to)); } TEST_F(FileUtilTest, CopyDirectoryNew) { @@ -1297,25 +1297,25 @@ TEST_F(FileUtilTest, CopyDirectoryNew) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory. FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create a subdirectory. FilePath subdir_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Subdir")); file_util::CreateDirectory(subdir_name_from); - ASSERT_TRUE(file_util::PathExists(subdir_name_from)); + ASSERT_TRUE(base::PathExists(subdir_name_from)); // Create a file under the subdirectory. FilePath file_name2_from = subdir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name2_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name2_from)); + ASSERT_TRUE(base::PathExists(file_name2_from)); // Copy the directory not recursively. FilePath dir_name_to = @@ -1325,18 +1325,18 @@ TEST_F(FileUtilTest, CopyDirectoryNew) { FilePath subdir_name_to = dir_name_to.Append(FILE_PATH_LITERAL("Subdir")); - ASSERT_FALSE(file_util::PathExists(dir_name_to)); + ASSERT_FALSE(base::PathExists(dir_name_to)); EXPECT_TRUE(base::CopyDirectory(dir_name_from, dir_name_to, false)); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(dir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(subdir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name2_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); - EXPECT_FALSE(file_util::PathExists(subdir_name_to)); + EXPECT_TRUE(base::PathExists(dir_name_from)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(subdir_name_from)); + EXPECT_TRUE(base::PathExists(file_name2_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(subdir_name_to)); } TEST_F(FileUtilTest, CopyDirectoryExists) { @@ -1344,25 +1344,25 @@ TEST_F(FileUtilTest, CopyDirectoryExists) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory. FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create a subdirectory. FilePath subdir_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Subdir")); file_util::CreateDirectory(subdir_name_from); - ASSERT_TRUE(file_util::PathExists(subdir_name_from)); + ASSERT_TRUE(base::PathExists(subdir_name_from)); // Create a file under the subdirectory. FilePath file_name2_from = subdir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name2_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name2_from)); + ASSERT_TRUE(base::PathExists(file_name2_from)); // Copy the directory not recursively. FilePath dir_name_to = @@ -1374,18 +1374,18 @@ TEST_F(FileUtilTest, CopyDirectoryExists) { // Create the destination directory. file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); EXPECT_TRUE(base::CopyDirectory(dir_name_from, dir_name_to, false)); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(dir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(subdir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name2_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); - EXPECT_FALSE(file_util::PathExists(subdir_name_to)); + EXPECT_TRUE(base::PathExists(dir_name_from)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(subdir_name_from)); + EXPECT_TRUE(base::PathExists(file_name2_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(subdir_name_to)); } TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToNew) { @@ -1393,17 +1393,17 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToNew) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination name FilePath file_name_to = temp_dir_.path().Append( FILE_PATH_LITERAL("Copy_Test_File_Destination.txt")); - ASSERT_FALSE(file_util::PathExists(file_name_to)); + ASSERT_FALSE(base::PathExists(file_name_to)); EXPECT_TRUE(base::CopyDirectory(file_name_from, file_name_to, true)); // Check the has been copied - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExisting) { @@ -1411,18 +1411,18 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExisting) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination name FilePath file_name_to = temp_dir_.path().Append( FILE_PATH_LITERAL("Copy_Test_File_Destination.txt")); CreateTextFile(file_name_to, L"Old file content"); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(base::CopyDirectory(file_name_from, file_name_to, true)); // Check the has been copied - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(L"Gooooooooooooooooooooogle" == ReadTextFile(file_name_to)); } @@ -1431,20 +1431,20 @@ TEST_F(FileUtilTest, CopyFileWithCopyDirectoryRecursiveToExistingDirectory) { FilePath file_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // The destination FilePath dir_name_to = temp_dir_.path().Append(FILE_PATH_LITERAL("Destination")); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); FilePath file_name_to = dir_name_to.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); EXPECT_TRUE(base::CopyDirectory(file_name_from, dir_name_to, true)); // Check the has been copied - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) { @@ -1452,13 +1452,13 @@ TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory. FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Copy the directory recursively. FilePath dir_name_to = @@ -1478,10 +1478,10 @@ TEST_F(FileUtilTest, CopyDirectoryWithTrailingSeparators) { EXPECT_TRUE(base::CopyDirectory(from_path, dir_name_to, true)); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(dir_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(dir_name_from)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, CopyFile) { @@ -1489,14 +1489,14 @@ TEST_F(FileUtilTest, CopyFile) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("Copy_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("Copy_Test_File.txt")); const std::wstring file_contents(L"Gooooooooooooooooooooogle"); CreateTextFile(file_name_from, file_contents); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Copy the file. FilePath dest_file = dir_name_from.Append(FILE_PATH_LITERAL("DestFile.txt")); @@ -1514,12 +1514,12 @@ TEST_F(FileUtilTest, CopyFile) { dest_file2_test = dest_file2_test.AppendASCII("DestFile.txt"); // Check everything has been copied. - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(dest_file)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(dest_file)); const std::wstring read_contents = ReadTextFile(dest_file); EXPECT_EQ(file_contents, read_contents); - EXPECT_TRUE(file_util::PathExists(dest_file2_test)); - EXPECT_TRUE(file_util::PathExists(dest_file2)); + EXPECT_TRUE(base::PathExists(dest_file2_test)); + EXPECT_TRUE(base::PathExists(dest_file2)); } // file_util winds up using autoreleased objects on the Mac, so this needs @@ -1530,7 +1530,7 @@ TEST_F(ReadOnlyFileUtilTest, ContentsEqual) { FilePath data_dir; ASSERT_TRUE(PathService::Get(base::DIR_TEST_DATA, &data_dir)); data_dir = data_dir.AppendASCII("file_util"); - ASSERT_TRUE(file_util::PathExists(data_dir)); + ASSERT_TRUE(base::PathExists(data_dir)); FilePath original_file = data_dir.Append(FILE_PATH_LITERAL("original.txt")); @@ -1577,7 +1577,7 @@ TEST_F(ReadOnlyFileUtilTest, TextContentsEqual) { FilePath data_dir; ASSERT_TRUE(PathService::Get(base::DIR_TEST_DATA, &data_dir)); data_dir = data_dir.AppendASCII("file_util"); - ASSERT_TRUE(file_util::PathExists(data_dir)); + ASSERT_TRUE(base::PathExists(data_dir)); FilePath original_file = data_dir.Append(FILE_PATH_LITERAL("original.txt")); @@ -1628,13 +1628,13 @@ TEST_F(FileUtilTest, CopyAndDeleteDirectoryTest) { FilePath dir_name_from = temp_dir_.path().Append(FILE_PATH_LITERAL("CopyAndDelete_From_Subdir")); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); // Create a file under the directory FilePath file_name_from = dir_name_from.Append(FILE_PATH_LITERAL("CopyAndDelete_Test_File.txt")); CreateTextFile(file_name_from, L"Gooooooooooooooooooooogle"); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Move the directory by using CopyAndDeleteDirectory FilePath dir_name_to = temp_dir_.path().Append( @@ -1642,16 +1642,16 @@ TEST_F(FileUtilTest, CopyAndDeleteDirectoryTest) { FilePath file_name_to = dir_name_to.Append(FILE_PATH_LITERAL("CopyAndDelete_Test_File.txt")); - ASSERT_FALSE(file_util::PathExists(dir_name_to)); + ASSERT_FALSE(base::PathExists(dir_name_to)); EXPECT_TRUE(base::internal::CopyAndDeleteDirectory(dir_name_from, dir_name_to)); // Check everything has been moved. - EXPECT_FALSE(file_util::PathExists(dir_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(dir_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_FALSE(base::PathExists(dir_name_from)); + EXPECT_FALSE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(dir_name_to)); + EXPECT_TRUE(base::PathExists(file_name_to)); } TEST_F(FileUtilTest, GetTempDirTest) { @@ -1687,7 +1687,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileTest) { FilePath temp_files[3]; for (int i = 0; i < 3; i++) { ASSERT_TRUE(file_util::CreateTemporaryFile(&(temp_files[i]))); - EXPECT_TRUE(file_util::PathExists(temp_files[i])); + EXPECT_TRUE(base::PathExists(temp_files[i])); EXPECT_FALSE(file_util::DirectoryExists(temp_files[i])); } for (int i = 0; i < 3; i++) @@ -1705,7 +1705,7 @@ TEST_F(FileUtilTest, CreateAndOpenTemporaryFileTest) { for (i = 0; i < 3; ++i) { fps[i] = file_util::CreateAndOpenTemporaryFile(&(names[i])); ASSERT_TRUE(fps[i]); - EXPECT_TRUE(file_util::PathExists(names[i])); + EXPECT_TRUE(base::PathExists(names[i])); } // Make sure all names are unique. @@ -1724,7 +1724,7 @@ TEST_F(FileUtilTest, CreateNewTempDirectoryTest) { FilePath temp_dir; ASSERT_TRUE(file_util::CreateNewTempDirectory(FilePath::StringType(), &temp_dir)); - EXPECT_TRUE(file_util::PathExists(temp_dir)); + EXPECT_TRUE(base::PathExists(temp_dir)); EXPECT_TRUE(base::Delete(temp_dir, false)); } @@ -1734,7 +1734,7 @@ TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) { temp_dir_.path(), FILE_PATH_LITERAL("CreateNewTemporaryDirInDirTest"), &new_dir)); - EXPECT_TRUE(file_util::PathExists(new_dir)); + EXPECT_TRUE(base::PathExists(new_dir)); EXPECT_TRUE(temp_dir_.path().IsParent(new_dir)); EXPECT_TRUE(base::Delete(new_dir, false)); } @@ -1756,22 +1756,22 @@ TEST_F(FileUtilTest, CreateDirectoryTest) { test_root.Append(FILE_PATH_LITERAL("dir/tree/likely/doesnt/exist/")); #endif - EXPECT_FALSE(file_util::PathExists(test_path)); + EXPECT_FALSE(base::PathExists(test_path)); EXPECT_TRUE(file_util::CreateDirectory(test_path)); - EXPECT_TRUE(file_util::PathExists(test_path)); + EXPECT_TRUE(base::PathExists(test_path)); // CreateDirectory returns true if the DirectoryExists returns true. EXPECT_TRUE(file_util::CreateDirectory(test_path)); // Doesn't work to create it on top of a non-dir test_path = test_path.Append(FILE_PATH_LITERAL("foobar.txt")); - EXPECT_FALSE(file_util::PathExists(test_path)); + EXPECT_FALSE(base::PathExists(test_path)); CreateTextFile(test_path, L"test file"); - EXPECT_TRUE(file_util::PathExists(test_path)); + EXPECT_TRUE(base::PathExists(test_path)); EXPECT_FALSE(file_util::CreateDirectory(test_path)); EXPECT_TRUE(base::Delete(test_root, true)); - EXPECT_FALSE(file_util::PathExists(test_root)); - EXPECT_FALSE(file_util::PathExists(test_path)); + EXPECT_FALSE(base::PathExists(test_root)); + EXPECT_FALSE(base::PathExists(test_path)); // Verify assumptions made by the Windows implementation: // 1. The current directory always exists. @@ -1794,7 +1794,7 @@ TEST_F(FileUtilTest, CreateDirectoryTest) { FilePath invalid_drive(FILE_PATH_LITERAL("o:\\")); FilePath invalid_path = invalid_drive.Append(FILE_PATH_LITERAL("some\\inaccessible\\dir")); - if (!file_util::PathExists(invalid_drive)) { + if (!base::PathExists(invalid_drive)) { EXPECT_FALSE(file_util::CreateDirectory(invalid_path)); } #endif @@ -1804,16 +1804,16 @@ TEST_F(FileUtilTest, DetectDirectoryTest) { // Check a directory FilePath test_root = temp_dir_.path().Append(FILE_PATH_LITERAL("detect_directory_test")); - EXPECT_FALSE(file_util::PathExists(test_root)); + EXPECT_FALSE(base::PathExists(test_root)); EXPECT_TRUE(file_util::CreateDirectory(test_root)); - EXPECT_TRUE(file_util::PathExists(test_root)); + EXPECT_TRUE(base::PathExists(test_root)); EXPECT_TRUE(file_util::DirectoryExists(test_root)); // Check a file FilePath test_path = test_root.Append(FILE_PATH_LITERAL("foobar.txt")); - EXPECT_FALSE(file_util::PathExists(test_path)); + EXPECT_FALSE(base::PathExists(test_path)); CreateTextFile(test_path, L"test file"); - EXPECT_TRUE(file_util::PathExists(test_path)); + EXPECT_TRUE(base::PathExists(test_path)); EXPECT_FALSE(file_util::DirectoryExists(test_path)); EXPECT_TRUE(base::Delete(test_path, false)); @@ -1934,13 +1934,13 @@ TEST_F(FileUtilTest, AppendToFile) { temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest")); // Create a fresh, empty copy of this directory. - if (file_util::PathExists(data_dir)) { + if (base::PathExists(data_dir)) { ASSERT_TRUE(base::Delete(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); // Create a fresh, empty copy of this directory. - if (file_util::PathExists(data_dir)) { + if (base::PathExists(data_dir)) { ASSERT_TRUE(base::Delete(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); @@ -1962,7 +1962,7 @@ TEST_F(FileUtilTest, TouchFile) { temp_dir_.path().Append(FILE_PATH_LITERAL("FilePathTest")); // Create a fresh, empty copy of this directory. - if (file_util::PathExists(data_dir)) { + if (base::PathExists(data_dir)) { ASSERT_TRUE(base::Delete(data_dir, true)); } ASSERT_TRUE(file_util::CreateDirectory(data_dir)); @@ -1995,7 +1995,7 @@ TEST_F(FileUtilTest, TouchFile) { TEST_F(FileUtilTest, IsDirectoryEmpty) { FilePath empty_dir = temp_dir_.path().Append(FILE_PATH_LITERAL("EmptyDir")); - ASSERT_FALSE(file_util::PathExists(empty_dir)); + ASSERT_FALSE(base::PathExists(empty_dir)); ASSERT_TRUE(file_util::CreateDirectory(empty_dir)); @@ -2123,7 +2123,7 @@ TEST_F(VerifyPathControlledByUserTest, Symlinks) { << "Failed to create symlink."; FilePath file_path_with_link = link_to_sub_dir.AppendASCII("file.txt"); - ASSERT_TRUE(file_util::PathExists(file_path_with_link)); + ASSERT_TRUE(base::PathExists(file_path_with_link)); EXPECT_FALSE( file_util::VerifyPathControlledByUser( diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 928b66e..90d8fca 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -180,7 +180,7 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, // Instead of creating a new directory, we copy the old one to include the // security information of the folder as part of the copy. - if (!file_util::PathExists(to_path)) { + if (!PathExists(to_path)) { // Except that Vista fails to do that, and instead do a recursive copy if // the target directory doesn't exist. if (base::win::GetVersion() >= base::win::VERSION_VISTA) @@ -193,6 +193,11 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, return ShellCopy(directory, to_path, false); } +bool PathExists(const FilePath& path) { + ThreadRestrictions::AssertIOAllowed(); + return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES); +} + } // namespace base // ----------------------------------------------------------------------------- @@ -202,11 +207,6 @@ namespace file_util { using base::FilePath; using base::kFileShareAll; -bool PathExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); - return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES); -} - bool PathIsWritable(const FilePath& path) { base::ThreadRestrictions::AssertIOAllowed(); HANDLE dir = diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc index 8cf95ed..b9270ee 100644 --- a/base/files/file_path_watcher_linux.cc +++ b/base/files/file_path_watcher_linux.cc @@ -351,7 +351,7 @@ void FilePathWatcherImpl::OnFilePathChanged(InotifyReader::Watch fired_watch, // recheck. if (target_changed || (change_on_target_path && !created) || - (change_on_target_path && file_util::PathExists(target_))) { + (change_on_target_path && PathExists(target_))) { callback_.Run(target_, false); return; } diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc index 9f65da8e..5eb9fe5 100644 --- a/base/files/file_util_proxy.cc +++ b/base/files/file_util_proxy.cc @@ -107,7 +107,7 @@ class GetFileInfoHelper { : error_(PLATFORM_FILE_OK) {} void RunWorkForFilePath(const FilePath& file_path) { - if (!file_util::PathExists(file_path)) { + if (!PathExists(file_path)) { error_ = PLATFORM_FILE_ERROR_NOT_FOUND; return; } @@ -210,7 +210,7 @@ PlatformFileError CloseAdapter(PlatformFile file_handle) { } PlatformFileError DeleteAdapter(const FilePath& file_path, bool recursive) { - if (!file_util::PathExists(file_path)) { + if (!PathExists(file_path)) { return PLATFORM_FILE_ERROR_NOT_FOUND; } if (!base::Delete(file_path, recursive)) { diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc index f524ba4..e8680bb 100644 --- a/base/files/file_util_proxy_unittest.cc +++ b/base/files/file_util_proxy_unittest.cc @@ -128,13 +128,13 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_Create) { EXPECT_EQ(PLATFORM_FILE_OK, error_); EXPECT_TRUE(created_); EXPECT_NE(kInvalidPlatformFileValue, file_); - EXPECT_TRUE(file_util::PathExists(test_path())); + EXPECT_TRUE(PathExists(test_path())); } TEST_F(FileUtilProxyTest, CreateOrOpen_Open) { // Creates a file. file_util::WriteFile(test_path(), NULL, 0); - ASSERT_TRUE(file_util::PathExists(test_path())); + ASSERT_TRUE(PathExists(test_path())); // Opens the created file. FileUtilProxy::CreateOrOpen( @@ -159,7 +159,7 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_OpenNonExistent) { EXPECT_EQ(PLATFORM_FILE_ERROR_NOT_FOUND, error_); EXPECT_FALSE(created_); EXPECT_EQ(kInvalidPlatformFileValue, file_); - EXPECT_FALSE(file_util::PathExists(test_path())); + EXPECT_FALSE(PathExists(test_path())); } TEST_F(FileUtilProxyTest, Close) { @@ -190,7 +190,7 @@ TEST_F(FileUtilProxyTest, CreateTemporary) { Bind(&FileUtilProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr())); MessageLoop::current()->Run(); EXPECT_EQ(PLATFORM_FILE_OK, error_); - EXPECT_TRUE(file_util::PathExists(path_)); + EXPECT_TRUE(PathExists(path_)); EXPECT_NE(kInvalidPlatformFileValue, file_); // The file should be writable. diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc index 759436cf..3f24d10 100644 --- a/base/files/important_file_writer_unittest.cc +++ b/base/files/important_file_writer_unittest.cc @@ -61,11 +61,11 @@ class ImportantFileWriterTest : public testing::Test { TEST_F(ImportantFileWriterTest, Basic) { ImportantFileWriter writer(file_, MessageLoopProxy::current().get()); - EXPECT_FALSE(file_util::PathExists(writer.path())); + EXPECT_FALSE(PathExists(writer.path())); writer.WriteNow("foo"); RunLoop().RunUntilIdle(); - ASSERT_TRUE(file_util::PathExists(writer.path())); + ASSERT_TRUE(PathExists(writer.path())); EXPECT_EQ("foo", GetFileContent(writer.path())); } @@ -82,7 +82,7 @@ TEST_F(ImportantFileWriterTest, ScheduleWrite) { TimeDelta::FromMilliseconds(100)); MessageLoop::current()->Run(); EXPECT_FALSE(writer.HasPendingWrite()); - ASSERT_TRUE(file_util::PathExists(writer.path())); + ASSERT_TRUE(PathExists(writer.path())); EXPECT_EQ("foo", GetFileContent(writer.path())); } @@ -99,7 +99,7 @@ TEST_F(ImportantFileWriterTest, DoScheduledWrite) { TimeDelta::FromMilliseconds(100)); MessageLoop::current()->Run(); EXPECT_FALSE(writer.HasPendingWrite()); - ASSERT_TRUE(file_util::PathExists(writer.path())); + ASSERT_TRUE(PathExists(writer.path())); EXPECT_EQ("foo", GetFileContent(writer.path())); } @@ -115,7 +115,7 @@ TEST_F(ImportantFileWriterTest, BatchingWrites) { MessageLoop::QuitWhenIdleClosure(), TimeDelta::FromMilliseconds(100)); MessageLoop::current()->Run(); - ASSERT_TRUE(file_util::PathExists(writer.path())); + ASSERT_TRUE(PathExists(writer.path())); EXPECT_EQ("baz", GetFileContent(writer.path())); } diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc index d6cff33..37371e8 100644 --- a/base/json/json_file_value_serializer.cc +++ b/base/json/json_file_value_serializer.cc @@ -55,7 +55,7 @@ int JSONFileValueSerializer::ReadFileToString(std::string* json_string) { return JSON_ACCESS_DENIED; } #endif - if (!file_util::PathExists(json_file_path_)) + if (!base::PathExists(json_file_path_)) return JSON_NO_SUCH_FILE; else return JSON_CANNOT_READ_FILE; diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc index 0180f48..41650b4 100644 --- a/base/json/json_reader_unittest.cc +++ b/base/json/json_reader_unittest.cc @@ -544,7 +544,7 @@ TEST(JSONReaderTest, ReadFromFile) { FilePath path; ASSERT_TRUE(PathService::Get(base::DIR_TEST_DATA, &path)); path = path.AppendASCII("json"); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(path)); std::string input; ASSERT_TRUE(file_util::ReadFileToString( diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc index 78be11e..ce7129f 100644 --- a/base/json/json_value_serializer_unittest.cc +++ b/base/json/json_value_serializer_unittest.cc @@ -385,7 +385,7 @@ TEST_F(JSONFileValueSerializerTest, Roundtrip) { original_file_path = original_file_path.Append(FILE_PATH_LITERAL("serializer_test.json")); - ASSERT_TRUE(file_util::PathExists(original_file_path)); + ASSERT_TRUE(PathExists(original_file_path)); JSONFileValueSerializer deserializer(original_file_path); scoped_ptr<Value> root; @@ -417,10 +417,10 @@ TEST_F(JSONFileValueSerializerTest, Roundtrip) { const base::FilePath written_file_path = temp_dir_.path().Append(FILE_PATH_LITERAL("test_output.js")); - ASSERT_FALSE(file_util::PathExists(written_file_path)); + ASSERT_FALSE(PathExists(written_file_path)); JSONFileValueSerializer serializer(written_file_path); ASSERT_TRUE(serializer.Serialize(*root)); - ASSERT_TRUE(file_util::PathExists(written_file_path)); + ASSERT_TRUE(PathExists(written_file_path)); // Now compare file contents. EXPECT_TRUE(file_util::TextContentsEqual(original_file_path, @@ -434,7 +434,7 @@ TEST_F(JSONFileValueSerializerTest, RoundtripNested) { original_file_path = original_file_path.Append( FILE_PATH_LITERAL("serializer_nested_test.json")); - ASSERT_TRUE(file_util::PathExists(original_file_path)); + ASSERT_TRUE(PathExists(original_file_path)); JSONFileValueSerializer deserializer(original_file_path); scoped_ptr<Value> root; @@ -445,10 +445,10 @@ TEST_F(JSONFileValueSerializerTest, RoundtripNested) { base::FilePath written_file_path = temp_dir_.path().Append( FILE_PATH_LITERAL("test_output.json")); - ASSERT_FALSE(file_util::PathExists(written_file_path)); + ASSERT_FALSE(PathExists(written_file_path)); JSONFileValueSerializer serializer(written_file_path); ASSERT_TRUE(serializer.Serialize(*root)); - ASSERT_TRUE(file_util::PathExists(written_file_path)); + ASSERT_TRUE(PathExists(written_file_path)); // Now compare file contents. EXPECT_TRUE(file_util::TextContentsEqual(original_file_path, @@ -461,7 +461,7 @@ TEST_F(JSONFileValueSerializerTest, NoWhitespace) { ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &source_file_path)); source_file_path = source_file_path.Append( FILE_PATH_LITERAL("serializer_test_nowhitespace.json")); - ASSERT_TRUE(file_util::PathExists(source_file_path)); + ASSERT_TRUE(PathExists(source_file_path)); JSONFileValueSerializer serializer(source_file_path); scoped_ptr<Value> root; root.reset(serializer.Deserialize(NULL, NULL)); diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm index 0e52cbc..d246757 100644 --- a/base/mac/mac_util_unittest.mm +++ b/base/mac/mac_util_unittest.mm @@ -246,7 +246,7 @@ TEST_F(MacUtilTest, TestRemoveQuarantineAttributeNonExistentPath) { ScopedTempDir temp_dir_; ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); FilePath non_existent_path = temp_dir_.path().Append("DummyPath"); - ASSERT_FALSE(file_util::PathExists(non_existent_path)); + ASSERT_FALSE(PathExists(non_existent_path)); EXPECT_FALSE(RemoveQuarantineAttribute(non_existent_path)); } diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc index 2be787d..93e0b76 100644 --- a/base/memory/shared_memory_posix.cc +++ b/base/memory/shared_memory_posix.cc @@ -236,9 +236,8 @@ bool SharedMemory::Delete(const std::string& name) { if (!FilePathForMemoryName(name, &path)) return false; - if (file_util::PathExists(path)) { + if (PathExists(path)) return base::Delete(path, false); - } // Doesn't exist, so success. return true; diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc index a611e4d..7c1d660 100644 --- a/base/nix/mime_util_xdg.cc +++ b/base/nix/mime_util_xdg.cc @@ -171,7 +171,7 @@ IconTheme::IconTheme(const std::string& name) if (!file_util::DirectoryExists(theme_path)) continue; FilePath theme_index = theme_path.Append("index.theme"); - if (!index_theme_loaded_ && file_util::PathExists(theme_index)) { + if (!index_theme_loaded_ && PathExists(theme_index)) { if (!LoadIndexTheme(theme_index)) return; index_theme_loaded_ = true; @@ -248,7 +248,7 @@ FilePath IconTheme::GetIconPathUnderSubdir(const std::string& icon_name, for (size_t i = 0; i < icon_formats->size(); ++i) { icon_path = dir_iter->Append(subdir); icon_path = icon_path.Append(icon_name + (*icon_formats)[i]); - if (file_util::PathExists(icon_path)) + if (PathExists(icon_path)) return icon_path; } } @@ -490,7 +490,7 @@ FilePath LookupFallbackIcon(const std::string& icon_name) { for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) { for (size_t i = 0; i < icon_formats->size(); ++i) { FilePath icon = iter->first.Append(icon_name + (*icon_formats)[i]); - if (file_util::PathExists(icon)) + if (PathExists(icon)) return icon; } } @@ -640,7 +640,7 @@ FilePath GetMimeIcon(const std::string& mime_type, size_t size) { for (size_t i = 0; i < icon_names.size(); i++) { if (icon_names[i][0] == '/') { icon_file = FilePath(icon_names[i]); - if (file_util::PathExists(icon_file)) + if (PathExists(icon_file)) return icon_file; } else { icon_file = LookupIconInDefaultTheme(icon_names[i], size); diff --git a/base/path_service.cc b/base/path_service.cc index 5cfb1ef..89e58b2 100644 --- a/base/path_service.cc +++ b/base/path_service.cc @@ -253,7 +253,7 @@ bool PathService::OverrideAndCreateIfNeeded(int key, // Make sure the directory exists. We need to do this before we translate // this to the absolute path because on POSIX, MakeAbsoluteFilePath fails // if called on a non-existent path. - if (!file_util::PathExists(file_path) && + if (!base::PathExists(file_path) && !file_util::CreateDirectory(file_path)) return false; } diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc index 68565cc..fbb2d76 100644 --- a/base/path_service_unittest.cc +++ b/base/path_service_unittest.cc @@ -73,7 +73,7 @@ bool ReturnsValidPath(int dir_type) { return false; #endif return result && !path.empty() && (!check_path_exists || - file_util::PathExists(path)); + base::PathExists(path)); } #if defined(OS_WIN) @@ -156,18 +156,18 @@ TEST_F(PathServiceTest, Override) { // PathService::Override should always create the path provided if it doesn't // exist. EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir)); - EXPECT_TRUE(file_util::PathExists(fake_cache_dir)); + EXPECT_TRUE(base::PathExists(fake_cache_dir)); base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("cache2")); // PathService::OverrideAndCreateIfNeeded should obey the |create| parameter. PathService::OverrideAndCreateIfNeeded(my_special_key, fake_cache_dir2, false); - EXPECT_FALSE(file_util::PathExists(fake_cache_dir2)); + EXPECT_FALSE(base::PathExists(fake_cache_dir2)); EXPECT_TRUE(PathService::OverrideAndCreateIfNeeded(my_special_key, fake_cache_dir2, true)); - EXPECT_TRUE(file_util::PathExists(fake_cache_dir2)); + EXPECT_TRUE(base::PathExists(fake_cache_dir2)); } // Check if multiple overrides can co-exist. @@ -177,21 +177,21 @@ TEST_F(PathServiceTest, OverrideMultiple) { ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); base::FilePath fake_cache_dir1(temp_dir.path().AppendASCII("1")); EXPECT_TRUE(PathService::Override(my_special_key, fake_cache_dir1)); - EXPECT_TRUE(file_util::PathExists(fake_cache_dir1)); + EXPECT_TRUE(base::PathExists(fake_cache_dir1)); ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir1.AppendASCII("t1"), ".", 1)); base::FilePath fake_cache_dir2(temp_dir.path().AppendASCII("2")); EXPECT_TRUE(PathService::Override(my_special_key + 1, fake_cache_dir2)); - EXPECT_TRUE(file_util::PathExists(fake_cache_dir2)); + EXPECT_TRUE(base::PathExists(fake_cache_dir2)); ASSERT_EQ(1, file_util::WriteFile(fake_cache_dir2.AppendASCII("t2"), ".", 1)); base::FilePath result; EXPECT_TRUE(PathService::Get(my_special_key, &result)); // Override might have changed the path representation but our test file // should be still there. - EXPECT_TRUE(file_util::PathExists(result.AppendASCII("t1"))); + EXPECT_TRUE(base::PathExists(result.AppendASCII("t1"))); EXPECT_TRUE(PathService::Get(my_special_key + 1, &result)); - EXPECT_TRUE(file_util::PathExists(result.AppendASCII("t2"))); + EXPECT_TRUE(base::PathExists(result.AppendASCII("t2"))); } TEST_F(PathServiceTest, RemoveOverride) { diff --git a/base/platform_file_unittest.cc b/base/platform_file_unittest.cc index 0ba7782..a1f3927 100644 --- a/base/platform_file_unittest.cc +++ b/base/platform_file_unittest.cc @@ -103,7 +103,7 @@ TEST(PlatformFile, CreatePlatformFile) { EXPECT_EQ(base::PLATFORM_FILE_OK, error_code); EXPECT_TRUE(base::ClosePlatformFile(file)); - EXPECT_FALSE(file_util::PathExists(file_path)); + EXPECT_FALSE(base::PathExists(file_path)); } TEST(PlatformFile, DeleteOpenFile) { @@ -139,7 +139,7 @@ TEST(PlatformFile, DeleteOpenFile) { // Close both handles and check that the file is gone. base::ClosePlatformFile(file); base::ClosePlatformFile(same_file); - EXPECT_FALSE(file_util::PathExists(file_path)); + EXPECT_FALSE(base::PathExists(file_path)); } TEST(PlatformFile, ReadWritePlatformFile) { diff --git a/base/prefs/json_pref_store.cc b/base/prefs/json_pref_store.cc index ff3c232..0b93f74 100644 --- a/base/prefs/json_pref_store.cc +++ b/base/prefs/json_pref_store.cc @@ -69,7 +69,7 @@ class FileThreadDeserializer JSONFileValueSerializer serializer(path); base::Value* value = serializer.Deserialize(&error_code, &error_msg); HandleErrors(value, path, error_code, error_msg, error); - *no_dir = !file_util::PathExists(path.DirName()); + *no_dir = !base::PathExists(path.DirName()); return value; } @@ -128,7 +128,7 @@ void FileThreadDeserializer::HandleErrors( // If they've ever had a parse error before, put them in another bucket. // TODO(erikkay) if we keep this error checking for very long, we may // want to differentiate between recent and long ago errors. - if (file_util::PathExists(bad)) + if (base::PathExists(bad)) *error = PersistentPrefStore::PREF_READ_ERROR_JSON_REPEAT; base::Move(path, bad); break; diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc index c3b89a0..5c506d4 100644 --- a/base/prefs/json_pref_store_unittest.cc +++ b/base/prefs/json_pref_store_unittest.cc @@ -44,7 +44,7 @@ class JsonPrefStoreTest : public testing::Test { ASSERT_TRUE(PathService::Get(base::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("prefs"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(PathExists(data_dir_)); } // The path to temporary directory used to contain the test operations. @@ -58,7 +58,7 @@ class JsonPrefStoreTest : public testing::Test { // Test fallback behavior for a nonexistent file. TEST_F(JsonPrefStoreTest, NonExistentFile) { base::FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); - ASSERT_FALSE(file_util::PathExists(bogus_input_file)); + ASSERT_FALSE(PathExists(bogus_input_file)); scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore( bogus_input_file, message_loop_.message_loop_proxy().get()); EXPECT_EQ(PersistentPrefStore::PREF_READ_ERROR_NO_FILE, @@ -78,9 +78,9 @@ TEST_F(JsonPrefStoreTest, InvalidFile) { EXPECT_FALSE(pref_store->ReadOnly()); // The file should have been moved aside. - EXPECT_FALSE(file_util::PathExists(invalid_file)); + EXPECT_FALSE(PathExists(invalid_file)); base::FilePath moved_aside = temp_dir_.path().AppendASCII("invalid.bad"); - EXPECT_TRUE(file_util::PathExists(moved_aside)); + EXPECT_TRUE(PathExists(moved_aside)); EXPECT_TRUE(file_util::TextContentsEqual(invalid_file_original, moved_aside)); } @@ -144,7 +144,7 @@ void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store, EXPECT_EQ(214748364842LL, value); // Serialize and compare to expected output. - ASSERT_TRUE(file_util::PathExists(golden_output_file)); + ASSERT_TRUE(PathExists(golden_output_file)); pref_store->CommitPendingWrite(); RunLoop().RunUntilIdle(); EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); @@ -157,7 +157,7 @@ TEST_F(JsonPrefStoreTest, Basic) { // Test that the persistent value can be loaded. base::FilePath input_file = temp_dir_.path().AppendASCII("write.json"); - ASSERT_TRUE(file_util::PathExists(input_file)); + ASSERT_TRUE(PathExists(input_file)); scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore(input_file, message_loop_.message_loop_proxy().get()); ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); @@ -183,7 +183,7 @@ TEST_F(JsonPrefStoreTest, BasicAsync) { // Test that the persistent value can be loaded. base::FilePath input_file = temp_dir_.path().AppendASCII("write.json"); - ASSERT_TRUE(file_util::PathExists(input_file)); + ASSERT_TRUE(PathExists(input_file)); scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore(input_file, message_loop_.message_loop_proxy().get()); @@ -220,7 +220,7 @@ TEST_F(JsonPrefStoreTest, BasicAsync) { // Tests asynchronous reading of the file when there is no file. TEST_F(JsonPrefStoreTest, AsyncNonExistingFile) { base::FilePath bogus_input_file = data_dir_.AppendASCII("read.txt"); - ASSERT_FALSE(file_util::PathExists(bogus_input_file)); + ASSERT_FALSE(PathExists(bogus_input_file)); scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore( bogus_input_file, message_loop_.message_loop_proxy().get()); MockPrefStoreObserver mock_observer; @@ -246,7 +246,7 @@ TEST_F(JsonPrefStoreTest, NeedsEmptyValue) { pref_file)); // Test that the persistent value can be loaded. - ASSERT_TRUE(file_util::PathExists(pref_file)); + ASSERT_TRUE(PathExists(pref_file)); scoped_refptr<JsonPrefStore> pref_store = new JsonPrefStore(pref_file, message_loop_.message_loop_proxy().get()); ASSERT_EQ(PersistentPrefStore::PREF_READ_ERROR_NONE, pref_store->ReadPrefs()); @@ -281,7 +281,7 @@ TEST_F(JsonPrefStoreTest, NeedsEmptyValue) { // Compare to expected output. base::FilePath golden_output_file = data_dir_.AppendASCII("write.golden.need_empty_value.json"); - ASSERT_TRUE(file_util::PathExists(golden_output_file)); + ASSERT_TRUE(PathExists(golden_output_file)); EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); } diff --git a/base/process/memory_linux.cc b/base/process/memory_linux.cc index 81cf20c..53afa1a 100644 --- a/base/process/memory_linux.cc +++ b/base/process/memory_linux.cc @@ -150,7 +150,7 @@ bool AdjustOOMScore(ProcessId process, int score) { // Attempt to write the newer oom_score_adj file first. FilePath oom_file = oom_path.AppendASCII("oom_score_adj"); - if (file_util::PathExists(oom_file)) { + if (PathExists(oom_file)) { std::string score_str = IntToString(score); DVLOG(1) << "Adjusting oom_score_adj of " << process << " to " << score_str; @@ -163,7 +163,7 @@ bool AdjustOOMScore(ProcessId process, int score) { // If the oom_score_adj file doesn't exist, then we write the old // style file and translate the oom_adj score to the range 0-15. oom_file = oom_path.AppendASCII("oom_adj"); - if (file_util::PathExists(oom_file)) { + if (PathExists(oom_file)) { // Max score for the old oom_adj range. Used for conversion of new // values to old values. const int kMaxOldOomScore = 15; diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc index 9e3697b..3cfd233 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -119,7 +119,7 @@ bool DieFileDie(const base::FilePath& file, bool recurse) { const base::TimeDelta kTimeout = base::TimeDelta::FromSeconds(10) / kIterations; - if (!file_util::PathExists(file)) + if (!base::PathExists(file)) return true; // Sometimes Delete fails, so try a few more times. Divide the timeout diff --git a/base/win/shortcut.cc b/base/win/shortcut.cc index eb7a72c..57a93dc 100644 --- a/base/win/shortcut.cc +++ b/base/win/shortcut.cc @@ -53,7 +53,7 @@ bool CreateOrUpdateShortcutLink(const FilePath& shortcut_path, return false; } - bool shortcut_existed = file_util::PathExists(shortcut_path); + bool shortcut_existed = PathExists(shortcut_path); // Interfaces to the old shortcut when replacing an existing shortcut. ScopedComPtr<IShellLink> old_i_shell_link; diff --git a/base/win/shortcut_unittest.cc b/base/win/shortcut_unittest.cc index 56f3b4a..b3247b6 100644 --- a/base/win/shortcut_unittest.cc +++ b/base/win/shortcut_unittest.cc @@ -212,7 +212,7 @@ TEST_F(ShortcutTest, UpdateShortcutClearArguments) { TEST_F(ShortcutTest, FailUpdateShortcutThatDoesNotExist) { ASSERT_FALSE(CreateOrUpdateShortcutLink( link_file_, link_properties_, SHORTCUT_UPDATE_EXISTING)); - ASSERT_FALSE(file_util::PathExists(link_file_)); + ASSERT_FALSE(PathExists(link_file_)); } TEST_F(ShortcutTest, ReplaceShortcutAllProperties) { @@ -249,7 +249,7 @@ TEST_F(ShortcutTest, ReplaceShortcutSomeProperties) { TEST_F(ShortcutTest, FailReplaceShortcutThatDoesNotExist) { ASSERT_FALSE(CreateOrUpdateShortcutLink( link_file_, link_properties_, SHORTCUT_REPLACE_EXISTING)); - ASSERT_FALSE(file_util::PathExists(link_file_)); + ASSERT_FALSE(PathExists(link_file_)); } // Test that the old arguments remain on the replaced shortcut when not diff --git a/cc/test/paths.cc b/cc/test/paths.cc index 2aa7aa7..a54d551 100644 --- a/cc/test/paths.cc +++ b/cc/test/paths.cc @@ -22,7 +22,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("cc")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // we don't want to create this + if (!base::PathExists(cur)) // we don't want to create this return false; break; default: diff --git a/chrome/browser/bookmarks/bookmark_codec_unittest.cc b/chrome/browser/bookmarks/bookmark_codec_unittest.cc index e12d11d..9b98001 100644 --- a/chrome/browser/bookmarks/bookmark_codec_unittest.cc +++ b/chrome/browser/bookmarks/bookmark_codec_unittest.cc @@ -300,7 +300,7 @@ TEST_F(BookmarkCodecTest, CanDecodeModelWithoutMobileBookmarks) { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory)); base::FilePath test_file = test_data_directory.AppendASCII( "bookmarks/model_without_sync.json"); - ASSERT_TRUE(file_util::PathExists(test_file)); + ASSERT_TRUE(base::PathExists(test_file)); JSONFileValueSerializer serializer(test_file); scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); diff --git a/chrome/browser/bookmarks/bookmark_storage.cc b/chrome/browser/bookmarks/bookmark_storage.cc index 8e9e3a3..79a8528 100644 --- a/chrome/browser/bookmarks/bookmark_storage.cc +++ b/chrome/browser/bookmarks/bookmark_storage.cc @@ -53,7 +53,7 @@ void LoadCallback(const base::FilePath& path, BookmarkLoadDetails* details) { startup_metric_utils::ScopedSlowStartupUMA scoped_timer("Startup.SlowStartupBookmarksLoad"); - bool bookmark_file_exists = file_util::PathExists(path); + bool bookmark_file_exists = base::PathExists(path); if (bookmark_file_exists) { JSONFileValueSerializer serializer(path); scoped_ptr<Value> root(serializer.Deserialize(NULL, NULL)); diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 8d9bde8..be9d189 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -236,7 +236,7 @@ PrefService* InitializeLocalState( TRACE_EVENT0("startup", "ChromeBrowserMainParts::InitializeLocalState") base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); - bool local_state_file_exists = file_util::PathExists(local_state_path); + bool local_state_file_exists = base::PathExists(local_state_path); // Load local state. This includes the application locale so we know which // locale dll to load. This also causes local state prefs to be registered. diff --git a/chrome/browser/chrome_plugin_browsertest.cc b/chrome/browser/chrome_plugin_browsertest.cc index 1ef83fa..d7b76b0 100644 --- a/chrome/browser/chrome_plugin_browsertest.cc +++ b/chrome/browser/chrome_plugin_browsertest.cc @@ -78,7 +78,7 @@ class ChromePluginTest : public InProcessBrowserTest { base::FilePath path; PathService::Get(content::DIR_TEST_DATA, &path); path = path.AppendASCII("plugin").AppendASCII(filename); - CHECK(file_util::PathExists(path)); + CHECK(base::PathExists(path)); return net::FilePathToFileURL(path); } diff --git a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc index 639d07f..7e998cd 100644 --- a/chrome/browser/chromeos/app_mode/kiosk_app_data.cc +++ b/chrome/browser/chromeos/app_mode/kiosk_app_data.cc @@ -52,7 +52,7 @@ void SaveIconToLocalOnBlockingPool( DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); base::FilePath dir = icon_path.DirName(); - if (!file_util::PathExists(dir)) + if (!base::PathExists(dir)) CHECK(file_util::CreateDirectory(dir)); CHECK_EQ(static_cast<int>(raw_icon->size()), diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc index a9919ae..ead638d 100644 --- a/chrome/browser/chromeos/boot_times_loader.cc +++ b/chrome/browser/chromeos/boot_times_loader.cc @@ -198,7 +198,7 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) { static const base::FilePath::CharType kBootTimesSent[] = FPL("/tmp/boot-times-sent"); base::FilePath sent(kBootTimesSent); - if (file_util::PathExists(sent)) + if (base::PathExists(sent)) return; UMA_HISTOGRAM_TIMES("BootTime.Total", @@ -228,7 +228,7 @@ static void SendBootTimesToUMA(const BootTimesLoader::BootTimes& boot_times) { boot_times.system, boot_times.chrome); file_util::WriteFile(sent, boot_times_text.data(), boot_times_text.size()); - DCHECK(file_util::PathExists(sent)); + DCHECK(base::PathExists(sent)); } void BootTimesLoader::Backend::GetBootTimesAndRunCallback( @@ -250,7 +250,7 @@ void BootTimesLoader::Backend::GetBootTimesAndRunCallback( // Wait until firmware-boot-time file exists by reposting. base::FilePath log_dir(kLogPath); base::FilePath log_file = log_dir.Append(kFirmwareBootTime); - if (!file_util::PathExists(log_file)) { + if (!base::PathExists(log_file)) { BrowserThread::PostDelayedTask( BrowserThread::FILE, FROM_HERE, diff --git a/chrome/browser/chromeos/drive/fake_file_system.cc b/chrome/browser/chromeos/drive/fake_file_system.cc index 54c12b8..ba8e419 100644 --- a/chrome/browser/chromeos/drive/fake_file_system.cc +++ b/chrome/browser/chromeos/drive/fake_file_system.cc @@ -296,7 +296,7 @@ void FakeFileSystem::GetFileContentByPathAfterGetWapiResourceEntry( base::FilePath cache_path = cache_dir_.path().AppendASCII(entry->resource_id()); - if (file_util::PathExists(cache_path)) { + if (base::PathExists(cache_path)) { // Cache file is found. initialized_callback.Run(FILE_ERROR_OK, entry.Pass(), cache_path, base::Closure()); diff --git a/chrome/browser/chromeos/drive/file_cache.cc b/chrome/browser/chromeos/drive/file_cache.cc index 0a18c54..a99f565 100644 --- a/chrome/browser/chromeos/drive/file_cache.cc +++ b/chrome/browser/chromeos/drive/file_cache.cc @@ -688,7 +688,7 @@ bool FileCache::HasEnoughSpaceFor(int64 num_bytes, } bool FileCache::ImportOldDB(const base::FilePath& old_db_path) { - if (!file_util::PathExists(old_db_path)) // Old DB is not there, do nothing. + if (!base::PathExists(old_db_path)) // Old DB is not there, do nothing. return false; // Copy all entries stored in the old DB. diff --git a/chrome/browser/chromeos/drive/file_cache_metadata.cc b/chrome/browser/chromeos/drive/file_cache_metadata.cc index b421b43..7d6c662 100644 --- a/chrome/browser/chromeos/drive/file_cache_metadata.cc +++ b/chrome/browser/chromeos/drive/file_cache_metadata.cc @@ -95,7 +95,7 @@ FileCacheMetadata::InitializeResult FileCacheMetadata::Initialize( const base::FilePath& db_path) { AssertOnSequencedWorkerPool(); - bool created = !file_util::PathExists(db_path); + bool created = !base::PathExists(db_path); leveldb::DB* level_db = NULL; leveldb::Options options; diff --git a/chrome/browser/chromeos/drive/file_cache_unittest.cc b/chrome/browser/chromeos/drive/file_cache_unittest.cc index 560d579..4b68555 100644 --- a/chrome/browser/chromeos/drive/file_cache_unittest.cc +++ b/chrome/browser/chromeos/drive/file_cache_unittest.cc @@ -167,7 +167,7 @@ class FileCacheTestOnUIThread : public testing::Test { EXPECT_EQ(FILE_ERROR_OK, error); const base::FilePath path = cache_->GetCacheFilePath(resource_id); - EXPECT_FALSE(file_util::PathExists(path)); + EXPECT_FALSE(base::PathExists(path)); } } @@ -267,7 +267,7 @@ class FileCacheTestOnUIThread : public testing::Test { &error, &cache_file_path)); test_util::RunBlockingPoolTask(); - EXPECT_TRUE(file_util::PathExists(cache_file_path)); + EXPECT_TRUE(base::PathExists(cache_file_path)); EXPECT_EQ(cache_file_path, cache_->GetCacheFilePath(resource_id)); } @@ -293,7 +293,7 @@ class FileCacheTestOnUIThread : public testing::Test { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - EXPECT_TRUE(file_util::PathExists(cache_file_path)); + EXPECT_TRUE(base::PathExists(cache_file_path)); EXPECT_EQ(cache_file_path, cache_->GetCacheFilePath(resource_id)); } @@ -322,7 +322,7 @@ class FileCacheTestOnUIThread : public testing::Test { // Verify actual cache file. base::FilePath dest_path = cache_->GetCacheFilePath(resource_id); EXPECT_EQ((expected_cache_state_ & TEST_CACHE_STATE_PRESENT) != 0, - file_util::PathExists(dest_path)); + base::PathExists(dest_path)); } // Helper function to call GetCacheEntry from origin thread. @@ -600,7 +600,7 @@ TEST_F(FileCacheTestOnUIThread, PinAndUnpinDirtyCache) { google_apis::test_util::CreateCopyResultCallback(&error, &dirty_path)); test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - EXPECT_TRUE(file_util::PathExists(dirty_path)); + EXPECT_TRUE(base::PathExists(dirty_path)); // Pin the dirty file. TestPin(resource_id, FILE_ERROR_OK, @@ -609,14 +609,14 @@ TEST_F(FileCacheTestOnUIThread, PinAndUnpinDirtyCache) { TEST_CACHE_STATE_PINNED); // Verify dirty file still exist at the same pathname. - EXPECT_TRUE(file_util::PathExists(dirty_path)); + EXPECT_TRUE(base::PathExists(dirty_path)); // Unpin the dirty file. TestUnpin(resource_id, FILE_ERROR_OK, TEST_CACHE_STATE_PRESENT | TEST_CACHE_STATE_DIRTY); // Verify dirty file still exist at the same pathname. - EXPECT_TRUE(file_util::PathExists(dirty_path)); + EXPECT_TRUE(base::PathExists(dirty_path)); } TEST_F(FileCacheTestOnUIThread, DirtyCacheRepetitive) { @@ -918,10 +918,10 @@ TEST_F(FileCacheTest, FreeDiskSpaceIfNeededFor) { // Only 'temporary' file gets removed. FileCacheEntry entry; EXPECT_FALSE(cache_->GetCacheEntry(resource_id_tmp, md5_tmp, &entry)); - EXPECT_FALSE(file_util::PathExists(tmp_path)); + EXPECT_FALSE(base::PathExists(tmp_path)); EXPECT_TRUE(cache_->GetCacheEntry(resource_id_pinned, md5_pinned, &entry)); - EXPECT_TRUE(file_util::PathExists(pinned_path)); + EXPECT_TRUE(base::PathExists(pinned_path)); // Returns false when disk space cannot be freed. fake_free_disk_space_getter_->set_default_value(0); @@ -948,13 +948,13 @@ TEST_F(FileCacheTest, ImportOldDB) { entry.set_md5(md5_2); old_metadata.AddOrUpdateCacheEntry(key2, entry); } - EXPECT_TRUE(file_util::PathExists(old_db_path)); + EXPECT_TRUE(base::PathExists(old_db_path)); // Do import. EXPECT_TRUE(ImportOldDB(cache_.get(), old_db_path)); // Old DB should be removed. - EXPECT_FALSE(file_util::PathExists(old_db_path)); + EXPECT_FALSE(base::PathExists(old_db_path)); // Data is imported correctly. FileCacheEntry entry; diff --git a/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc b/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc index 83056ff..4e22efe 100644 --- a/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system/open_file_operation_unittest.cc @@ -48,7 +48,7 @@ TEST_F(OpenFileOperationTest, OpenExistingFile) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); int64 local_file_size; ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(file_size, local_file_size); @@ -107,7 +107,7 @@ TEST_F(OpenFileOperationTest, CreateNonExistingFile) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); int64 local_file_size; ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(0, local_file_size); // Should be an empty file. @@ -132,7 +132,7 @@ TEST_F(OpenFileOperationTest, OpenOrCreateExistingFile) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); int64 local_file_size; ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(file_size, local_file_size); @@ -154,7 +154,7 @@ TEST_F(OpenFileOperationTest, OpenOrCreateNonExistingFile) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); int64 local_file_size; ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(0, local_file_size); // Should be an empty file. @@ -179,7 +179,7 @@ TEST_F(OpenFileOperationTest, OpenFileTwice) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); int64 local_file_size; ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(file_size, local_file_size); @@ -196,7 +196,7 @@ TEST_F(OpenFileOperationTest, OpenFileTwice) { test_util::RunBlockingPoolTask(); EXPECT_EQ(FILE_ERROR_OK, error); - ASSERT_TRUE(file_util::PathExists(file_path)); + ASSERT_TRUE(base::PathExists(file_path)); ASSERT_TRUE(file_util::GetFileSize(file_path, &local_file_size)); EXPECT_EQ(file_size, local_file_size); diff --git a/chrome/browser/chromeos/drive/file_system_util.cc b/chrome/browser/chromeos/drive/file_system_util.cc index fc79abc..1907bab 100644 --- a/chrome/browser/chromeos/drive/file_system_util.cc +++ b/chrome/browser/chromeos/drive/file_system_util.cc @@ -122,7 +122,7 @@ void MoveAllFilesFromDirectory(const base::FilePath& directory_from, for (base::FilePath file_from = enumerator.Next(); !file_from.empty(); file_from = enumerator.Next()) { const base::FilePath file_to = directory_to.Append(file_from.BaseName()); - if (!file_util::PathExists(file_to)) // Do not overwrite existing files. + if (!base::PathExists(file_to)) // Do not overwrite existing files. base::Move(file_from, file_to); } } @@ -315,7 +315,7 @@ void MigrateCacheFilesFromOldDirectories( cache_root_directory.AppendASCII("persistent"); const base::FilePath tmp_directory = cache_root_directory.AppendASCII("tmp"); - if (!file_util::PathExists(persistent_directory)) + if (!base::PathExists(persistent_directory)) return; const base::FilePath cache_file_directory = diff --git a/chrome/browser/chromeos/drive/file_system_util_unittest.cc b/chrome/browser/chromeos/drive/file_system_util_unittest.cc index de912a5..9355866 100644 --- a/chrome/browser/chromeos/drive/file_system_util_unittest.cc +++ b/chrome/browser/chromeos/drive/file_system_util_unittest.cc @@ -206,9 +206,9 @@ TEST(FileSystemUtilTest, MigrateCacheFilesFromOldDirectories) { // Migrate. MigrateCacheFilesFromOldDirectories(temp_dir.path()); - EXPECT_FALSE(file_util::PathExists(persistent_directory)); - EXPECT_TRUE(file_util::PathExists(files_directory.AppendASCII("foo.abc"))); - EXPECT_TRUE(file_util::PathExists(files_directory.AppendASCII("bar.123"))); + EXPECT_FALSE(base::PathExists(persistent_directory)); + EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("foo.abc"))); + EXPECT_TRUE(base::PathExists(files_directory.AppendASCII("bar.123"))); } TEST(FileSystemUtilTest, NeedsNamespaceMigration) { diff --git a/chrome/browser/chromeos/drive/resource_metadata_storage.cc b/chrome/browser/chromeos/drive/resource_metadata_storage.cc index b7a6264..8dc0fbc 100644 --- a/chrome/browser/chromeos/drive/resource_metadata_storage.cc +++ b/chrome/browser/chromeos/drive/resource_metadata_storage.cc @@ -230,7 +230,7 @@ bool ResourceMetadataStorage::Initialize() { options.create_if_missing = false; DBInitStatus open_existing_result = DB_INIT_NOT_FOUND; - if (file_util::PathExists(resource_map_path)) { + if (base::PathExists(resource_map_path)) { leveldb::Status status = leveldb::DB::Open(options, resource_map_path.AsUTF8Unsafe(), &db); open_existing_result = LevelDBStatusToDBInitStatus(status); diff --git a/chrome/browser/chromeos/enterprise_extension_observer.cc b/chrome/browser/chromeos/enterprise_extension_observer.cc index f34632e..34860e8 100644 --- a/chrome/browser/chromeos/enterprise_extension_observer.cc +++ b/chrome/browser/chromeos/enterprise_extension_observer.cc @@ -53,7 +53,7 @@ void EnterpriseExtensionObserver::Observe( void EnterpriseExtensionObserver::CheckExtensionAndNotifyEntd( const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (file_util::PathExists( + if (base::PathExists( path.Append(FILE_PATH_LITERAL("isa-cros-policy")))) { BrowserThread::PostTask( BrowserThread::UI, diff --git a/chrome/browser/chromeos/extensions/default_app_order.cc b/chrome/browser/chromeos/extensions/default_app_order.cc index 4ffc078..ac88f72 100644 --- a/chrome/browser/chromeos/extensions/default_app_order.cc +++ b/chrome/browser/chromeos/extensions/default_app_order.cc @@ -27,7 +27,7 @@ ExternalLoader* loader_instance = NULL; // if the file does not exist or could not be parsed properly. Caller takes // ownership of the returned value. base::ListValue* ReadExternalOrdinalFile(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return NULL; JSONFileValueSerializer serializer(path); diff --git a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc index 7f92499..e89af59 100644 --- a/chrome/browser/chromeos/extensions/default_app_order_unittest.cc +++ b/chrome/browser/chromeos/extensions/default_app_order_unittest.cc @@ -100,7 +100,7 @@ TEST_F(DefaultAppOrderTest, NoExternalFile) { base::FilePath none_existent_file = scoped_tmp_dir.path().AppendASCII("none_existent_file"); - ASSERT_FALSE(file_util::PathExists(none_existent_file)); + ASSERT_FALSE(base::PathExists(none_existent_file)); SetExternalFile(none_existent_file); scoped_ptr<default_app_order::ExternalLoader> loader( diff --git a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc index 6f827f7..c63e08e 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc @@ -264,7 +264,7 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { FileBrowserHandlerExtensionTest::TestSelectFileFunctionFactory)); // Selected path should still not exist. - ASSERT_FALSE(file_util::PathExists(selected_path)); + ASSERT_FALSE(base::PathExists(selected_path)); const Extension* extension = LoadExtension( test_data_dir_.AppendASCII("file_browser/filehandler_create")); @@ -281,7 +281,7 @@ IN_PROC_BROWSER_TEST_F(FileBrowserHandlerExtensionTest, EndToEnd) { // Selected path should have been created by the test extension after the // extension function call. - ASSERT_TRUE(file_util::PathExists(selected_path)); + ASSERT_TRUE(base::PathExists(selected_path)); // Let's check that the file has the expected content. const std::string expected_contents = "hello from test extension."; diff --git a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc index 3e88f65..c72c1cd 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_handler_util.cc @@ -607,7 +607,7 @@ ExtensionTaskExecutor::SetupFileAccessPermissions( // If the file is under drive mount point, there is no actual file to be // found on the url.path(). if (!is_drive_file) { - if (!file_util::PathExists(local_path) || + if (!base::PathExists(local_path) || file_util::IsLink(local_path) || !file_util::GetFileInfo(local_path, &file_info)) { continue; diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index cb4acbb..c1c3000 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -83,7 +83,7 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) { } base::FilePath file_path = data_dir.Append(file_name); - return file_util::PathExists(file_path) || + return base::PathExists(file_path) || (file_util::WriteFile(file_path, data.c_str(), data.size()) != -1); } @@ -98,7 +98,7 @@ bool GetData(const base::FilePath& path, std::string* data) { !file_util::CreateDirectory(data_dir)) return false; - return !file_util::PathExists(path) || + return !base::PathExists(path) || file_util::ReadFileToString(path, data); } @@ -382,10 +382,10 @@ void WallpaperPrivateSetWallpaperIfExistsFunction:: std::string data; base::FilePath path = file_path; - if (!file_util::PathExists(file_path)) + if (!base::PathExists(file_path)) path = fallback_path; - if (file_util::PathExists(path) && + if (base::PathExists(path) && file_util::ReadFileToString(path, &data)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&WallpaperPrivateSetWallpaperIfExistsFunction::StartDecode, @@ -492,7 +492,7 @@ void WallpaperPrivateSetWallpaperFunction::SaveToFile() { CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); base::FilePath file_path = wallpaper_dir.Append( file_name).InsertBeforeExtension(chromeos::kSmallWallpaperSuffix); - if (file_util::PathExists(file_path)) + if (base::PathExists(file_path)) return; // Generates and saves small resolution wallpaper. Uses CENTER_CROPPED to // maintain the aspect ratio after resize. @@ -628,7 +628,7 @@ void WallpaperPrivateSetCustomWallpaperFunction::GenerateThumbnail( DCHECK(BrowserThread::GetBlockingPool()->IsRunningSequenceOnCurrentThread( sequence_token_)); chromeos::UserImage wallpaper(*image.get()); - if (!file_util::PathExists(thumbnail_path.DirName())) + if (!base::PathExists(thumbnail_path.DirName())) file_util::CreateDirectory(thumbnail_path.DirName()); scoped_refptr<base::RefCountedBytes> data; diff --git a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc index f2c0292..12c633f 100644 --- a/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.cc @@ -240,8 +240,8 @@ void ComponentExtensionIMEManagerImpl::ReadComponentExtensionsInfo( const base::FilePath manifest_path = component_ime.path.Append("manifest.json"); - if (!file_util::PathExists(component_ime.path) || - !file_util::PathExists(manifest_path)) + if (!base::PathExists(component_ime.path) || + !base::PathExists(manifest_path)) continue; if (!file_util::ReadFileToString(manifest_path, &component_ime.manifest)) diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc index 8285a53..40bf44d 100644 --- a/chrome/browser/chromeos/login/login_utils.cc +++ b/chrome/browser/chromeos/login/login_utils.cc @@ -549,7 +549,7 @@ void LoginUtilsImpl::InitRlzDelayed(Profile* user_profile) { base::PostTaskAndReplyWithResult( base::WorkerPool::GetTaskRunner(false), FROM_HERE, - base::Bind(&file_util::PathExists, GetRlzDisabledFlagPath()), + base::Bind(&base::PathExists, GetRlzDisabledFlagPath()), base::Bind(&LoginUtilsImpl::InitRlz, AsWeakPtr(), user_profile)); #endif } diff --git a/chrome/browser/chromeos/login/startup_utils.cc b/chrome/browser/chromeos/login/startup_utils.cc index a46615a..73fd8a6 100644 --- a/chrome/browser/chromeos/login/startup_utils.cc +++ b/chrome/browser/chromeos/login/startup_utils.cc @@ -107,7 +107,7 @@ static base::FilePath GetOobeCompleteFlagPath() { static void CreateOobeCompleteFlagFile() { // Create flag file for boot-time init scripts. base::FilePath oobe_complete_path = GetOobeCompleteFlagPath(); - if (!file_util::PathExists(oobe_complete_path)) { + if (!base::PathExists(oobe_complete_path)) { FILE* oobe_flag_file = file_util::OpenFile(oobe_complete_path, "w+b"); if (oobe_flag_file == NULL) DLOG(WARNING) << oobe_complete_path.value() << " doesn't exist."; @@ -133,7 +133,7 @@ bool StartupUtils::IsDeviceRegistered() { // IO on UI thread. But it's required for update from old versions. base::ThreadRestrictions::ScopedAllowIO allow_io; base::FilePath oobe_complete_flag_file_path = GetOobeCompleteFlagPath(); - bool file_exists = file_util::PathExists(oobe_complete_flag_file_path); + bool file_exists = base::PathExists(oobe_complete_flag_file_path); SaveIntegerPreferenceForced(kDeviceRegistered, file_exists ? 1 : 0); return file_exists; } diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index 8be01de..e7bbf72 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -393,7 +393,7 @@ void WallpaperManager::ResizeAndSaveWallpaper(const UserImage& wallpaper, int preferred_height) { if (layout == ash::WALLPAPER_LAYOUT_CENTER) { // TODO(bshe): Generates cropped custom wallpaper for CENTER layout. - if (file_util::PathExists(path)) + if (base::PathExists(path)) base::Delete(path, false); return; } @@ -731,16 +731,16 @@ void WallpaperManager::EnsureCustomWallpaperDirectories( const std::string& email) { base::FilePath dir; dir = GetCustomWallpaperDir(kSmallWallpaperSubDir, email); - if (!file_util::PathExists(dir)) + if (!base::PathExists(dir)) file_util::CreateDirectory(dir); dir = GetCustomWallpaperDir(kLargeWallpaperSubDir, email); - if (!file_util::PathExists(dir)) + if (!base::PathExists(dir)) file_util::CreateDirectory(dir); dir = GetCustomWallpaperDir(kOriginalWallpaperSubDir, email); - if (!file_util::PathExists(dir)) + if (!base::PathExists(dir)) file_util::CreateDirectory(dir); dir = GetCustomWallpaperDir(kThumbnailWallpaperSubDir, email); - if (!file_util::PathExists(dir)) + if (!base::PathExists(dir)) file_util::CreateDirectory(dir); } @@ -846,25 +846,25 @@ void WallpaperManager::MoveCustomWallpapersOnWorker(const UserList& users) { EnsureCustomWallpaperDirectories(email); from_path = GetWallpaperPathForUser(email, true); // Old wallpaper with extension name may still exist. - if (!file_util::PathExists(from_path)) + if (!base::PathExists(from_path)) from_path = from_path.AddExtension(".png"); - if (file_util::PathExists(from_path)) { + if (base::PathExists(from_path)) { // Appends DUMMY to the file name of moved custom wallpaper. This way we // do not need to update WallpaperInfo for user. to_path = GetCustomWallpaperPath(kSmallWallpaperSubDir, email, "DUMMY"); base::Move(from_path, to_path); } from_path = GetWallpaperPathForUser(email, false); - if (!file_util::PathExists(from_path)) + if (!base::PathExists(from_path)) from_path = from_path.AddExtension(".png"); - if (file_util::PathExists(from_path)) { + if (base::PathExists(from_path)) { to_path = GetCustomWallpaperPath(kLargeWallpaperSubDir, email, "DUMMY"); base::Move(from_path, to_path); } from_path = GetOriginalWallpaperPathForUser(email); - if (!file_util::PathExists(from_path)) + if (!base::PathExists(from_path)) from_path = from_path.AddExtension(".png"); - if (file_util::PathExists(from_path)) { + if (base::PathExists(from_path)) { to_path = GetCustomWallpaperPath(kOriginalWallpaperSubDir, email, "DUMMY"); base::Move(from_path, to_path); @@ -922,8 +922,8 @@ void WallpaperManager::GetCustomWallpaperInternalOld( IsRunningSequenceOnCurrentThread(sequence_token_)); std::string file_name = wallpaper_path.BaseName().value(); - if (!file_util::PathExists(wallpaper_path)) { - if (file_util::PathExists(wallpaper_path.AddExtension(".png"))) { + if (!base::PathExists(wallpaper_path)) { + if (base::PathExists(wallpaper_path.AddExtension(".png"))) { // Old wallpaper may have a png extension. file_name += ".png"; } else { @@ -935,7 +935,7 @@ void WallpaperManager::GetCustomWallpaperInternalOld( } base::FilePath valid_path = wallpaper_path.DirName().Append(file_name); - if (!file_util::PathExists(valid_path)) + if (!base::PathExists(valid_path)) valid_path = valid_path.AddExtension(".png"); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, @@ -956,7 +956,7 @@ void WallpaperManager::GetCustomWallpaperInternal( IsRunningSequenceOnCurrentThread(sequence_token_)); base::FilePath valid_path = wallpaper_path; - if (!file_util::PathExists(wallpaper_path)) { + if (!base::PathExists(wallpaper_path)) { // Falls back on original file if the correct resoltuion file does not // exist. This may happen when the original custom wallpaper is small or // browser shutdown before resized wallpaper saved. @@ -964,7 +964,7 @@ void WallpaperManager::GetCustomWallpaperInternal( info.file); } - if (!file_util::PathExists(valid_path)) { + if (!base::PathExists(valid_path)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc index 77b3be6..77833c0 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc @@ -291,8 +291,8 @@ IN_PROC_BROWSER_TEST_F(WallpaperManagerBrowserTest, EXPECT_EQ(3, LoadedWallpapers()); base::FilePath new_wallpaper_path = GetCustomWallpaperPath( kOriginalWallpaperSubDir, kTestUser1, "DUMMY"); - EXPECT_FALSE(file_util::PathExists(old_wallpaper_path)); - EXPECT_TRUE(file_util::PathExists(new_wallpaper_path)); + EXPECT_FALSE(base::PathExists(old_wallpaper_path)); + EXPECT_TRUE(base::PathExists(new_wallpaper_path)); } // Some users have old user profiles which may have legacy wallpapers. And these diff --git a/chrome/browser/chromeos/mobile/mobile_activator.cc b/chrome/browser/chromeos/mobile/mobile_activator.cc index 2628fb1..db658b1 100644 --- a/chrome/browser/chromeos/mobile/mobile_activator.cc +++ b/chrome/browser/chromeos/mobile/mobile_activator.cc @@ -89,7 +89,7 @@ void CellularConfigDocument::LoadCellularConfigFile() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Load partner customization startup manifest if it is available. base::FilePath config_path(kCellularConfigPath); - if (!file_util::PathExists(config_path)) + if (!base::PathExists(config_path)) return; if (LoadFromFile(config_path)) diff --git a/chrome/browser/chromeos/policy/app_pack_updater.cc b/chrome/browser/chromeos/policy/app_pack_updater.cc index 628150f..7ce7a20 100644 --- a/chrome/browser/chromeos/policy/app_pack_updater.cc +++ b/chrome/browser/chromeos/policy/app_pack_updater.cc @@ -478,7 +478,7 @@ void AppPackUpdater::BlockingInstallCacheEntry( base::FilePath cache_dir(kAppPackCacheDir); base::FilePath cached_crx_path = cache_dir.Append(basename); - if (file_util::PathExists(cached_crx_path)) { + if (base::PathExists(cached_crx_path)) { LOG(WARNING) << "AppPack downloaded a crx whose filename will overwrite " << "an existing cached crx."; base::Delete(cached_crx_path, true /* recursive */); diff --git a/chrome/browser/chromeos/policy/enterprise_install_attributes.cc b/chrome/browser/chromeos/policy/enterprise_install_attributes.cc index 0f04454..c4eef36 100644 --- a/chrome/browser/chromeos/policy/enterprise_install_attributes.cc +++ b/chrome/browser/chromeos/policy/enterprise_install_attributes.cc @@ -100,7 +100,7 @@ EnterpriseInstallAttributes::~EnterpriseInstallAttributes() {} void EnterpriseInstallAttributes::ReadCacheFile( const base::FilePath& cache_file) { - if (device_locked_ || !file_util::PathExists(cache_file)) + if (device_locked_ || !base::PathExists(cache_file)) return; device_locked_ = true; diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc index ae9b79c..651de62 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.cc @@ -409,7 +409,7 @@ void UserCloudPolicyStoreChromeOS::InstallLegacyTokens( // static void UserCloudPolicyStoreChromeOS::RemoveLegacyCacheDir( const base::FilePath& dir) { - if (file_util::PathExists(dir) && !base::Delete(dir, true)) + if (base::PathExists(dir) && !base::Delete(dir, true)) LOG(ERROR) << "Failed to remove cache dir " << dir.value(); } @@ -430,7 +430,7 @@ void UserCloudPolicyStoreChromeOS::ReloadPolicyKey( // static void UserCloudPolicyStoreChromeOS::LoadPolicyKey(const base::FilePath& path, std::vector<uint8>* key) { - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { // There is no policy key the first time that a user fetches policy. If // |path| does not exist then that is the most likely scenario, so there's // no need to sample a failure. diff --git a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc index a552ef9..96f19d6 100644 --- a/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc +++ b/chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos_unittest.cc @@ -502,7 +502,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationAndStoreNew) { store_->policy()->SerializeAsString()); VerifyPolicyMap(kDefaultHomepage); EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); - EXPECT_TRUE(file_util::PathExists(policy_file())); + EXPECT_TRUE(base::PathExists(policy_file())); // Now store a new policy using the new homepage location. const char kNewHomepage[] = "http://google.com"; @@ -516,7 +516,7 @@ TEST_F(UserCloudPolicyStoreChromeOSTest, MigrationAndStoreNew) { VerifyPolicyMap(kNewHomepage); // Verify that the legacy cache has been removed. - EXPECT_FALSE(file_util::PathExists(policy_file())); + EXPECT_FALSE(base::PathExists(policy_file())); } } // namespace diff --git a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc index 456e1c7..bb93e89 100644 --- a/chrome/browser/chromeos/policy/user_policy_disk_cache.cc +++ b/chrome/browser/chromeos/policy/user_policy_disk_cache.cc @@ -66,7 +66,7 @@ void UserPolicyDiskCache::LoadOnFileThread() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); em::CachedCloudPolicyResponse cached_response; - if (!file_util::PathExists(backing_file_path_)) { + if (!base::PathExists(backing_file_path_)) { LoadDone(LOAD_RESULT_NOT_FOUND, cached_response); return; } diff --git a/chrome/browser/chromeos/policy/user_policy_token_loader.cc b/chrome/browser/chromeos/policy/user_policy_token_loader.cc index 666e2be..b20c4d2 100644 --- a/chrome/browser/chromeos/policy/user_policy_token_loader.cc +++ b/chrome/browser/chromeos/policy/user_policy_token_loader.cc @@ -58,7 +58,7 @@ void UserPolicyTokenLoader::LoadOnFileThread() { std::string device_token; std::string device_id; - if (file_util::PathExists(cache_file_)) { + if (base::PathExists(cache_file_)) { std::string data; em::DeviceCredentials device_credentials; if (file_util::ReadFileToString(cache_file_, &data) && diff --git a/chrome/browser/chromeos/settings/owner_key_util.cc b/chrome/browser/chromeos/settings/owner_key_util.cc index d1bbbd4..2b333d1 100644 --- a/chrome/browser/chromeos/settings/owner_key_util.cc +++ b/chrome/browser/chromeos/settings/owner_key_util.cc @@ -71,7 +71,7 @@ crypto::RSAPrivateKey* OwnerKeyUtilImpl::FindPrivateKey( } bool OwnerKeyUtilImpl::IsPublicKeyPresent() { - return file_util::PathExists(key_file_); + return base::PathExists(key_file_); } } // namespace chromeos diff --git a/chrome/browser/chromeos/system/input_device_settings.cc b/chrome/browser/chromeos/system/input_device_settings.cc index d937267..dec6b5f 100644 --- a/chrome/browser/chromeos/system/input_device_settings.cc +++ b/chrome/browser/chromeos/system/input_device_settings.cc @@ -30,7 +30,7 @@ const char kMouseControl[] = "/opt/google/mouse/mousecontrol"; bool ScriptExists(const std::string& script) { DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - return file_util::PathExists(base::FilePath(script)); + return base::PathExists(base::FilePath(script)); } // Executes the input control script asynchronously, if it exists. diff --git a/chrome/browser/chromeos/system/timezone_settings.cc b/chrome/browser/chromeos/system/timezone_settings.cc index 5aa6593..83946f5 100644 --- a/chrome/browser/chromeos/system/timezone_settings.cc +++ b/chrome/browser/chromeos/system/timezone_settings.cc @@ -201,7 +201,7 @@ void SetTimezoneIDFromString(const std::string& id) { base::FilePath timezone_file(kTimezoneFilesDir + id); // Make sure timezone_file exists. - if (!file_util::PathExists(timezone_file)) { + if (!base::PathExists(timezone_file)) { LOG(ERROR) << "SetTimezoneID: Cannot find timezone file " << timezone_file.value(); return; diff --git a/chrome/browser/component_updater/component_patcher.cc b/chrome/browser/component_updater/component_patcher.cc index 54bc62d..de082a7 100644 --- a/chrome/browser/component_updater/component_patcher.cc +++ b/chrome/browser/component_updater/component_patcher.cc @@ -20,7 +20,7 @@ namespace { base::ListValue* ReadCommands(const base::FilePath& unpack_path) { const base::FilePath commands = unpack_path.Append(FILE_PATH_LITERAL("commands.json")); - if (!file_util::PathExists(commands)) + if (!base::PathExists(commands)) return NULL; JSONFileValueSerializer serializer(commands); diff --git a/chrome/browser/component_updater/component_patcher_win.cc b/chrome/browser/component_updater/component_patcher_win.cc index a2f6865..76a72c5d 100644 --- a/chrome/browser/component_updater/component_patcher_win.cc +++ b/chrome/browser/component_updater/component_patcher_win.cc @@ -42,12 +42,12 @@ base::FilePath FindSetupProgram() { base::FilePath setup_path = exe_dir; setup_path = setup_path.AppendASCII(installer_dir); setup_path = setup_path.AppendASCII(setup_exe); - if (file_util::PathExists(setup_path)) + if (base::PathExists(setup_path)) return setup_path; setup_path = exe_dir; setup_path = setup_path.AppendASCII(setup_exe); - if (file_util::PathExists(setup_path)) + if (base::PathExists(setup_path)) return setup_path; return base::FilePath(); diff --git a/chrome/browser/component_updater/component_unpacker.cc b/chrome/browser/component_updater/component_unpacker.cc index de7cfcb..1e3e558 100644 --- a/chrome/browser/component_updater/component_unpacker.cc +++ b/chrome/browser/component_updater/component_unpacker.cc @@ -92,7 +92,7 @@ class CRXValidator { base::DictionaryValue* ReadManifest(const base::FilePath& unpack_path) { base::FilePath manifest = unpack_path.Append(FILE_PATH_LITERAL("manifest.json")); - if (!file_util::PathExists(manifest)) + if (!base::PathExists(manifest)) return NULL; JSONFileValueSerializer serializer(manifest); std::string error; @@ -109,7 +109,7 @@ base::DictionaryValue* ReadManifest(const base::FilePath& unpack_path) { // This method doesn't take any special steps to prevent files from // being inserted into the target directory by another process or thread. bool MakeEmptyDirectory(const base::FilePath& path) { - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { if (!base::Delete(path, true)) return false; } diff --git a/chrome/browser/component_updater/pepper_flash_component_installer.cc b/chrome/browser/component_updater/pepper_flash_component_installer.cc index c7cf4da..5f5d369 100644 --- a/chrome/browser/component_updater/pepper_flash_component_installer.cc +++ b/chrome/browser/component_updater/pepper_flash_component_installer.cc @@ -274,13 +274,13 @@ bool PepperFlashComponentInstaller::Install( return false; if (current_version_.CompareTo(version) > 0) return false; - if (!file_util::PathExists(unpack_path.Append( + if (!base::PathExists(unpack_path.Append( chrome::kPepperFlashPluginFilename))) return false; // Passed the basic tests. Time to install it. base::FilePath path = GetPepperFlashBaseDirectory().AppendASCII(version.GetString()); - if (file_util::PathExists(path)) + if (base::PathExists(path)) return false; if (!base::Move(unpack_path, path)) return false; @@ -358,7 +358,7 @@ void FinishPepperFlashUpdateRegistration(ComponentUpdateService* cus, void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::FilePath path = GetPepperFlashBaseDirectory(); - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create Pepper Flash directory."; return; @@ -369,7 +369,7 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) { std::vector<base::FilePath> older_dirs; if (GetPepperFlashDirectory(&path, &version, &older_dirs)) { path = path.Append(chrome::kPepperFlashPluginFilename); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&RegisterPepperFlashWithChrome, path, version)); diff --git a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc index 44b66f3..e0ad6c3 100644 --- a/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc +++ b/chrome/browser/component_updater/pnacl/pnacl_component_installer.cc @@ -122,7 +122,7 @@ base::DictionaryValue* ReadJSONManifest( base::DictionaryValue* ReadPnaclManifest(const base::FilePath& unpack_path) { base::FilePath manifest_path = GetPlatformDir(unpack_path).AppendASCII( "pnacl_public_pnacl_json"); - if (!file_util::PathExists(manifest_path)) + if (!base::PathExists(manifest_path)) return NULL; return ReadJSONManifest(manifest_path); } @@ -132,7 +132,7 @@ base::DictionaryValue* ReadComponentManifest( const base::FilePath& unpack_path) { base::FilePath manifest_path = unpack_path.Append( FILE_PATH_LITERAL("manifest.json")); - if (!file_util::PathExists(manifest_path)) + if (!base::PathExists(manifest_path)) return NULL; return ReadJSONManifest(manifest_path); } @@ -265,7 +265,7 @@ bool PnaclComponentInstaller::Install(const base::DictionaryValue& manifest, // Passed the basic tests. Time to install it. base::FilePath path = GetPnaclBaseDirectory().AppendASCII( version.GetString()); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { LOG(WARNING) << "Target path already exists, not installing."; NotifyInstallError(); return false; @@ -372,7 +372,7 @@ void FinishPnaclUpdateRegistration(const Version& current_version, void StartPnaclUpdateRegistration(PnaclComponentInstaller* pci) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::FilePath path = pci->GetPnaclBaseDirectory(); - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create base Pnacl directory."; return; diff --git a/chrome/browser/component_updater/recovery_component_installer.cc b/chrome/browser/component_updater/recovery_component_installer.cc index 4891aab1..625afd6 100644 --- a/chrome/browser/component_updater/recovery_component_installer.cc +++ b/chrome/browser/component_updater/recovery_component_installer.cc @@ -112,7 +112,7 @@ bool RecoveryComponentInstaller::Install(const base::DictionaryValue& manifest, if (current_version_.CompareTo(version) >= 0) return false; base::FilePath main_file = unpack_path.Append(kRecoveryFileName); - if (!file_util::PathExists(main_file)) + if (!base::PathExists(main_file)) return false; // Passed the basic tests. The installation continues with the // recovery component itself running from the temp directory. diff --git a/chrome/browser/component_updater/swiftshader_component_installer.cc b/chrome/browser/component_updater/swiftshader_component_installer.cc index 9aa42e0..12e8d8a 100644 --- a/chrome/browser/component_updater/swiftshader_component_installer.cc +++ b/chrome/browser/component_updater/swiftshader_component_installer.cc @@ -72,8 +72,8 @@ bool GetLatestSwiftShaderDirectory(base::FilePath* result, if (!version.IsValid()) continue; if (version.CompareTo(*latest) > 0 && - file_util::PathExists(path.Append(kSwiftShaderEglName)) && - file_util::PathExists(path.Append(kSwiftShaderGlesName))) { + base::PathExists(path.Append(kSwiftShaderEglName)) && + base::PathExists(path.Append(kSwiftShaderGlesName))) { if (found && older_dirs) older_dirs->push_back(*result); *latest = version; @@ -135,13 +135,13 @@ bool SwiftShaderComponentInstaller::Install( return false; if (current_version_.CompareTo(version) >= 0) return false; - if (!file_util::PathExists(unpack_path.Append(kSwiftShaderEglName)) || - !file_util::PathExists(unpack_path.Append(kSwiftShaderGlesName))) + if (!base::PathExists(unpack_path.Append(kSwiftShaderEglName)) || + !base::PathExists(unpack_path.Append(kSwiftShaderGlesName))) return false; // Passed the basic tests. Time to install it. base::FilePath path = GetSwiftShaderBaseDirectory().AppendASCII(version.GetString()); - if (file_util::PathExists(path)) + if (base::PathExists(path)) return false; if (!base::Move(unpack_path, path)) return false; @@ -208,7 +208,7 @@ void UpdateChecker::OnGpuInfoUpdate() { void RegisterSwiftShaderPath(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::FilePath path = GetSwiftShaderBaseDirectory(); - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { if (!file_util::CreateDirectory(path)) { NOTREACHED() << "Could not create SwiftShader directory."; return; diff --git a/chrome/browser/component_updater/test/component_installers_unittest.cc b/chrome/browser/component_updater/test/component_installers_unittest.cc index 91b59bb..a97bb18 100644 --- a/chrome/browser/component_updater/test/component_installers_unittest.cc +++ b/chrome/browser/component_updater/test/component_installers_unittest.cc @@ -65,7 +65,7 @@ TEST(ComponentInstallerTest, MAYBE_PepperFlashCheck) { manifest = manifest.Append(kDataPath); manifest = manifest.AppendASCII("manifest.json"); - if (!file_util::PathExists(manifest)) { + if (!base::PathExists(manifest)) { LOG(WARNING) << "No test manifest available. Skipping."; return; } diff --git a/chrome/browser/component_updater/widevine_cdm_component_installer.cc b/chrome/browser/component_updater/widevine_cdm_component_installer.cc index fe69eda..96a2345 100644 --- a/chrome/browser/component_updater/widevine_cdm_component_installer.cc +++ b/chrome/browser/component_updater/widevine_cdm_component_installer.cc @@ -221,18 +221,18 @@ bool WidevineCdmComponentInstaller::Install( if (current_version_.CompareTo(version) > 0) return false; - if (!file_util::PathExists(unpack_path.AppendASCII(kWidevineCdmFileName))) + if (!base::PathExists(unpack_path.AppendASCII(kWidevineCdmFileName))) return false; base::FilePath adapter_source_path; PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &adapter_source_path); - if (!file_util::PathExists(adapter_source_path)) + if (!base::PathExists(adapter_source_path)) return false; // Passed the basic tests. Time to install it. base::FilePath install_path = GetWidevineCdmBaseDirectory().AppendASCII(version.GetString()); - if (file_util::PathExists(install_path)) + if (base::PathExists(install_path)) return false; if (!base::Move(unpack_path, install_path)) return false; @@ -281,7 +281,7 @@ void FinishWidevineCdmUpdateRegistration(ComponentUpdateService* cus, void StartWidevineCdmUpdateRegistration(ComponentUpdateService* cus) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); base::FilePath base_dir = GetWidevineCdmBaseDirectory(); - if (!file_util::PathExists(base_dir) && + if (!base::PathExists(base_dir) && !file_util::CreateDirectory(base_dir)) { NOTREACHED() << "Could not create Widevine CDM directory."; return; @@ -296,8 +296,8 @@ void StartWidevineCdmUpdateRegistration(ComponentUpdateService* cus) { latest_dir.AppendASCII(kWidevineCdmAdapterFileName); base::FilePath cdm_path = latest_dir.AppendASCII(kWidevineCdmFileName); - if (file_util::PathExists(adapter_path) && - file_util::PathExists(cdm_path)) { + if (base::PathExists(adapter_path) && + base::PathExists(cdm_path)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&RegisterWidevineCdmWithChrome, adapter_path, version)); diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc index 857612c..4acdfd4 100644 --- a/chrome/browser/content_settings/content_settings_browsertest.cc +++ b/chrome/browser/content_settings/content_settings_browsertest.cc @@ -496,7 +496,7 @@ class PepperContentSettingsTest : public ContentSettingsTest { base::FilePath plugin_dir; EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); base::FilePath plugin_lib = plugin_dir.AppendASCII(kLibraryName); - EXPECT_TRUE(file_util::PathExists(plugin_lib)); + EXPECT_TRUE(base::PathExists(plugin_lib)); base::FilePath::StringType pepper_plugin = plugin_lib.value(); pepper_plugin.append(FILE_PATH_LITERAL( "#Clear Key CDM#Clear Key CDM 0.1.0.0#0.1.0.0;")); diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index fc69ad7..f2043e5 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -245,7 +245,7 @@ class PathTest : public DiagnosticsTest { RecordStopFailure(DIAG_RECON_PATH_PROVIDER, "Path provider failure"); return false; } - if (!file_util::PathExists(dir_or_file)) { + if (!base::PathExists(dir_or_file)) { RecordFailure( DIAG_RECON_PATH_NOT_FOUND, "Path not found: " + UTF16ToUTF8(dir_or_file.LossyDisplayName())); @@ -332,7 +332,7 @@ class JSONTest : public DiagnosticsTest { : DiagnosticsTest(id, name), path_(path), max_file_size_(max_file_size) {} virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) OVERRIDE { - if (!file_util::PathExists(path_)) { + if (!base::PathExists(path_)) { RecordFailure(DIAG_RECON_FILE_NOT_FOUND, "File not found"); return true; } diff --git a/chrome/browser/diagnostics/sqlite_diagnostics.cc b/chrome/browser/diagnostics/sqlite_diagnostics.cc index ed938d3..81753a8 100644 --- a/chrome/browser/diagnostics/sqlite_diagnostics.cc +++ b/chrome/browser/diagnostics/sqlite_diagnostics.cc @@ -63,7 +63,7 @@ class SqliteIntegrityTest : public DiagnosticsTest { else path = db_path_; - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { if (critical_) { RecordOutcome(DIAG_SQLITE_FILE_NOT_FOUND, "File not found", diff --git a/chrome/browser/download/chrome_download_manager_delegate.cc b/chrome/browser/download/chrome_download_manager_delegate.cc index 2274fb7..d4d2905 100644 --- a/chrome/browser/download/chrome_download_manager_delegate.cc +++ b/chrome/browser/download/chrome_download_manager_delegate.cc @@ -370,7 +370,7 @@ void ChromeDownloadManagerDelegate::CheckForFileExistence( #endif BrowserThread::PostTaskAndReplyWithResult( BrowserThread::FILE, FROM_HERE, - base::Bind(&file_util::PathExists, download->GetTargetFilePath()), + base::Bind(&base::PathExists, download->GetTargetFilePath()), callback); } diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc index b501650..2836388 100644 --- a/chrome/browser/download/download_browsertest.cc +++ b/chrome/browser/download/download_browsertest.cc @@ -660,13 +660,13 @@ class DownloadTest : public InProcessBrowserTest { bool CheckDownloadFullPaths(Browser* browser, const base::FilePath& downloaded_file, const base::FilePath& origin_file) { - bool origin_file_exists = file_util::PathExists(origin_file); + bool origin_file_exists = base::PathExists(origin_file); EXPECT_TRUE(origin_file_exists) << origin_file.value(); if (!origin_file_exists) return false; // Confirm the downloaded data file exists. - bool downloaded_file_exists = file_util::PathExists(downloaded_file); + bool downloaded_file_exists = base::PathExists(downloaded_file); EXPECT_TRUE(downloaded_file_exists) << downloaded_file.value(); if (!downloaded_file_exists) return false; @@ -783,7 +783,7 @@ class DownloadTest : public InProcessBrowserTest { downloads_directory_.path().Append(basefilename); EXPECT_TRUE(browser->window()->IsDownloadShelfVisible()); - bool downloaded_path_exists = file_util::PathExists(download_path); + bool downloaded_path_exists = base::PathExists(download_path); EXPECT_TRUE(downloaded_path_exists); if (!downloaded_path_exists) return false; @@ -796,7 +796,7 @@ class DownloadTest : public InProcessBrowserTest { // Delete the file we just downloaded. EXPECT_TRUE(file_util::DieFileDie(download_path, true)); - EXPECT_FALSE(file_util::PathExists(download_path)); + EXPECT_FALSE(base::PathExists(download_path)); return true; } @@ -958,7 +958,7 @@ class DownloadTest : public InProcessBrowserTest { // Clean up the file, in case it ended up in the My Documents folder. base::FilePath destination_folder = GetDownloadDirectory(browser()); base::FilePath my_downloaded_file = item->GetTargetFilePath(); - EXPECT_TRUE(file_util::PathExists(my_downloaded_file)); + EXPECT_TRUE(base::PathExists(my_downloaded_file)); EXPECT_TRUE(base::Delete(my_downloaded_file, false)); EXPECT_EQ(download_info.should_redirect_to_documents ? @@ -1209,7 +1209,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, NoDownload) { ui_test_utils::NavigateToURL(browser(), url); // Check that we did not download the web page. - EXPECT_FALSE(file_util::PathExists(file_path)); + EXPECT_FALSE(base::PathExists(file_path)); // Check state. EXPECT_EQ(1, browser()->tab_strip_model()->count()); @@ -1295,7 +1295,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadResourceThrottleCancels) { // Check that we did not download the file. base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); base::FilePath file_path(DestinationFile(browser(), file)); - EXPECT_FALSE(file_util::PathExists(file_path)); + EXPECT_FALSE(base::PathExists(file_path)); // Check state. EXPECT_EQ(1, browser()->tab_strip_model()->count()); @@ -1464,7 +1464,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) { // later. base::FilePath origin(OriginFile(base::FilePath(FILE_PATH_LITERAL( "downloads/a_zip_file.zip")))); - ASSERT_TRUE(file_util::PathExists(origin)); + ASSERT_TRUE(base::PathExists(origin)); int64 origin_file_size = 0; EXPECT_TRUE(file_util::GetFileSize(origin, &origin_file_size)); std::string original_contents; @@ -1485,7 +1485,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) { ASSERT_EQ(1UL, download_items.size()); ASSERT_EQ(base::FilePath(FILE_PATH_LITERAL("a_zip_file.zip")), download_items[0]->GetTargetFilePath().BaseName()); - ASSERT_TRUE(file_util::PathExists(download_items[0]->GetTargetFilePath())); + ASSERT_TRUE(base::PathExists(download_items[0]->GetTargetFilePath())); EXPECT_TRUE(VerifyFile(download_items[0]->GetTargetFilePath(), original_contents, origin_file_size)); @@ -1517,7 +1517,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_IncognitoRegular) { ASSERT_EQ(1UL, download_items.size()); ASSERT_EQ(base::FilePath(FILE_PATH_LITERAL("a_zip_file (1).zip")), download_items[0]->GetTargetFilePath().BaseName()); - ASSERT_TRUE(file_util::PathExists(download_items[0]->GetTargetFilePath())); + ASSERT_TRUE(base::PathExists(download_items[0]->GetTargetFilePath())); EXPECT_TRUE(VerifyFile(download_items[0]->GetTargetFilePath(), original_contents, origin_file_size)); } @@ -2010,7 +2010,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, AnchorDownloadTag) { // Confirm the downloaded data exists. base::FilePath downloaded_file = GetDownloadDirectory(browser()); downloaded_file = downloaded_file.Append(FILE_PATH_LITERAL("a_red_dot.png")); - EXPECT_TRUE(file_util::PathExists(downloaded_file)); + EXPECT_TRUE(base::PathExists(downloaded_file)); } // Test to make sure auto-open works. @@ -2819,7 +2819,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { content::DownloadManager* manager = DownloadManagerForBrowser(browser()); base::FilePath origin_file(OriginFile(base::FilePath(FILE_PATH_LITERAL( "downloads/a_zip_file.zip")))); - ASSERT_TRUE(file_util::PathExists(origin_file)); + ASSERT_TRUE(base::PathExists(origin_file)); std::string origin_contents; ASSERT_TRUE(file_util::ReadFileToString(origin_file, &origin_contents)); @@ -2836,7 +2836,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { (index == 0 ? std::string(".zip") : base::StringPrintf(" (%d).zip", index)), target_path.BaseName().AsUTF8Unsafe()); - ASSERT_TRUE(file_util::PathExists(target_path)); + ASSERT_TRUE(base::PathExists(target_path)); ASSERT_TRUE(VerifyFile(target_path, origin_contents, origin_contents.size())); } @@ -3021,7 +3021,7 @@ IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_PercentComplete) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); // Check that the file downloaded correctly. - ASSERT_TRUE(file_util::PathExists(download_items[0]->GetTargetFilePath())); + ASSERT_TRUE(base::PathExists(download_items[0]->GetTargetFilePath())); int64 downloaded_size = 0; ASSERT_TRUE(file_util::GetFileSize( download_items[0]->GetTargetFilePath(), &downloaded_size)); diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc index 554cc12..d241649 100644 --- a/chrome/browser/download/download_path_reservation_tracker.cc +++ b/chrome/browser/download/download_path_reservation_tracker.cc @@ -96,7 +96,7 @@ bool IsPathInUse(const base::FilePath& path) { return true; // If the path exists in the file system, then the path is in use. - if (file_util::PathExists(path)) + if (base::PathExists(path)) return true; return false; diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 33d1de6..0a975d2 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -401,8 +401,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnly) { ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); persisted.WaitForPersisted(); EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); - EXPECT_TRUE(file_util::PathExists(full_file_name)); - EXPECT_FALSE(file_util::PathExists(dir)); + EXPECT_TRUE(base::PathExists(full_file_name)); + EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } @@ -469,8 +469,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SaveHTMLOnlyTabDestroy) { GetCurrentTab(browser())->Close(); EXPECT_EQ(DownloadItem::CANCELLED, items[0]->GetState()); - EXPECT_FALSE(file_util::PathExists(full_file_name)); - EXPECT_FALSE(file_util::PathExists(dir)); + EXPECT_FALSE(base::PathExists(full_file_name)); + EXPECT_FALSE(base::PathExists(dir)); } // Disabled on Windows due to flakiness. http://crbug.com/162323 @@ -506,8 +506,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); - EXPECT_TRUE(file_util::PathExists(full_file_name)); - EXPECT_FALSE(file_util::PathExists(dir)); + EXPECT_TRUE(base::PathExists(full_file_name)); + EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(file_util::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).Append(file_name), full_file_name)); @@ -541,8 +541,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveCompleteHTML) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); - EXPECT_TRUE(file_util::PathExists(full_file_name)); - EXPECT_TRUE(file_util::PathExists(dir)); + EXPECT_TRUE(base::PathExists(full_file_name)); + EXPECT_TRUE(base::PathExists(dir)); EXPECT_TRUE(file_util::TextContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), full_file_name)); @@ -639,8 +639,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_FileNameFromPageTitle) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); - EXPECT_TRUE(file_util::PathExists(full_file_name)); - EXPECT_TRUE(file_util::PathExists(dir)); + EXPECT_TRUE(base::PathExists(full_file_name)); + EXPECT_TRUE(base::PathExists(dir)); EXPECT_TRUE(file_util::TextContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), full_file_name)); @@ -691,8 +691,8 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_RemoveFromList) { removed.WaitForRemoved(); - EXPECT_TRUE(file_util::PathExists(full_file_name)); - EXPECT_FALSE(file_util::PathExists(dir)); + EXPECT_TRUE(base::PathExists(full_file_name)); + EXPECT_FALSE(base::PathExists(dir)); EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } @@ -710,7 +710,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { download_dir.AppendASCII(std::string("test.exe") + kAppendedExtension); base::FilePath dir = download_dir.AppendASCII("test.exe_files"); - EXPECT_FALSE(file_util::PathExists(full_file_name)); + EXPECT_FALSE(base::PathExists(full_file_name)); GURL url = URLRequestMockHTTPJob::GetMockUrl( base::FilePath(kTestDir).Append(file_name)); ui_test_utils::NavigateToURL(browser(), url); @@ -724,7 +724,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, CleanFilenameFromPageTitle) { chrome::SavePage(browser()); loop_runner->Run(); - EXPECT_TRUE(file_util::PathExists(full_file_name)); + EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(file_util::DieFileDie(full_file_name, false)); EXPECT_TRUE(file_util::DieFileDie(dir, true)); @@ -767,7 +767,7 @@ IN_PROC_BROWSER_TEST_F(SavePageAsMHTMLBrowserTest, SavePageAsMHTML) { ASSERT_TRUE(VerifySavePackageExpectations(browser(), url)); persisted.WaitForPersisted(); - ASSERT_TRUE(file_util::PathExists(full_file_name)); + ASSERT_TRUE(base::PathExists(full_file_name)); int64 actual_file_size = -1; EXPECT_TRUE(file_util::GetFileSize(full_file_name, &actual_file_size)); EXPECT_LE(kFileSizeMin, actual_file_size); @@ -787,7 +787,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, SavePageBrowserTest_NonMHTML) { base::FilePath download_dir = DownloadPrefs::FromDownloadManager( GetDownloadManager())->DownloadPath(); base::FilePath filename = download_dir.AppendASCII("dataurl.txt"); - ASSERT_TRUE(file_util::PathExists(filename)); + ASSERT_TRUE(base::PathExists(filename)); std::string contents; EXPECT_TRUE(file_util::ReadFileToString(filename, &contents)); EXPECT_EQ("foo", contents); diff --git a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc index b3f08d0..0bb0c1f 100644 --- a/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc +++ b/chrome/browser/extensions/api/downloads/downloads_api_unittest.cc @@ -1130,8 +1130,8 @@ IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, base::FilePath fake_path = all_downloads[1]->GetTargetFilePath(); EXPECT_EQ(0, file_util::WriteFile(real_path, "", 0)); - ASSERT_TRUE(file_util::PathExists(real_path)); - ASSERT_FALSE(file_util::PathExists(fake_path)); + ASSERT_TRUE(base::PathExists(real_path)); + ASSERT_FALSE(base::PathExists(fake_path)); for (DownloadManager::DownloadVector::iterator iter = all_downloads.begin(); iter != all_downloads.end(); diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc index a441157..0e6cd76 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -212,7 +212,7 @@ bool GetFilePathOfFileEntry(const std::string& filesystem_name, bool DoCheckWritableFile(const base::FilePath& path, const base::FilePath& extension_directory) { // Don't allow links. - if (file_util::PathExists(path) && file_util::IsLink(path)) + if (base::PathExists(path) && file_util::IsLink(path)) return false; if (extension_directory == path || extension_directory.IsParent(path)) diff --git a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc index a2bb28b..5eb86da 100644 --- a/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc +++ b/chrome/browser/extensions/api/page_capture/page_capture_apitest.cc @@ -48,5 +48,5 @@ IN_PROC_BROWSER_TEST_F(ExtensionPageCaptureApiTest, SaveAsMHTML) { // Flush the message loops to make sure the delete happens. content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); content::RunAllPendingInMessageLoop(content::BrowserThread::IO); - ASSERT_FALSE(file_util::PathExists(delegate.temp_file_)); + ASSERT_FALSE(base::PathExists(delegate.temp_file_)); } diff --git a/chrome/browser/extensions/api/record/record_api.cc b/chrome/browser/extensions/api/record/record_api.cc index 866aae0..820c346 100644 --- a/chrome/browser/extensions/api/record/record_api.cc +++ b/chrome/browser/extensions/api/record/record_api.cc @@ -125,14 +125,14 @@ void RunPageCyclerFunction::RunTestBrowser() { // Run the test browser (or a mockup, depending on |process_strategy_|. while (repeat_count_-- && errors_.empty() && - !file_util::PathExists(error_file_path)) + !base::PathExists(error_file_path)) process_strategy_->RunProcess(line, &errors_); // Read URL errors file if there is one, and save errors in |errors_|. // Odd extension handling needed because temp files have lots of "."s in // their names, and we need to cleanly add kURLErrorsSuffix as a final // extension. - if (errors_.empty() && file_util::PathExists(error_file_path)) { + if (errors_.empty() && base::PathExists(error_file_path)) { std::string error_content; file_util::ReadFileToString(error_file_path, &error_content); diff --git a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc index 9705531..fe0f660 100644 --- a/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc +++ b/chrome/browser/extensions/api/storage/settings_frontend_unittest.cc @@ -165,7 +165,7 @@ TEST_F(ExtensionSettingsFrontendTest, LeveldbDatabaseDeletedFromDiskOnClear) { StringValue bar("bar"); ValueStore::WriteResult result = storage->Set(DEFAULTS, "foo", bar); ASSERT_FALSE(result->HasError()); - EXPECT_TRUE(file_util::PathExists(temp_dir_.path())); + EXPECT_TRUE(base::PathExists(temp_dir_.path())); } // Should need to both clear the database and delete the frontend for the @@ -173,7 +173,7 @@ TEST_F(ExtensionSettingsFrontendTest, LeveldbDatabaseDeletedFromDiskOnClear) { { ValueStore::WriteResult result = storage->Clear(); ASSERT_FALSE(result->HasError()); - EXPECT_TRUE(file_util::PathExists(temp_dir_.path())); + EXPECT_TRUE(base::PathExists(temp_dir_.path())); } frontend_.reset(); @@ -181,7 +181,7 @@ TEST_F(ExtensionSettingsFrontendTest, LeveldbDatabaseDeletedFromDiskOnClear) { // TODO(kalman): Figure out why this fails, despite appearing to work. // Leaving this commented out rather than disabling the whole test so that the // deletion code paths are at least exercised. - //EXPECT_FALSE(file_util::PathExists(temp_dir_.path())); + //EXPECT_FALSE(base::PathExists(temp_dir_.path())); } TEST_F(ExtensionSettingsFrontendTest, diff --git a/chrome/browser/extensions/api/storage/storage_schema_manifest_handler.cc b/chrome/browser/extensions/api/storage/storage_schema_manifest_handler.cc index 9537c4b..db9b411 100644 --- a/chrome/browser/extensions/api/storage/storage_schema_manifest_handler.cc +++ b/chrome/browser/extensions/api/storage/storage_schema_manifest_handler.cc @@ -46,7 +46,7 @@ scoped_ptr<policy::PolicySchema> StorageSchemaManifestHandler::GetSchema( return scoped_ptr<policy::PolicySchema>(); } file = extension->path().AppendASCII(path); - if (!file_util::PathExists(file)) { + if (!base::PathExists(file)) { *error = base::StringPrintf("File does not exist: %s", file.value().c_str()); return scoped_ptr<policy::PolicySchema>(); diff --git a/chrome/browser/extensions/convert_user_script_unittest.cc b/chrome/browser/extensions/convert_user_script_unittest.cc index cc534f5..e1d4be1 100644 --- a/chrome/browser/extensions/convert_user_script_unittest.cc +++ b/chrome/browser/extensions/convert_user_script_unittest.cc @@ -79,9 +79,9 @@ TEST_F(ExtensionFromUserScript, Basic) { EXPECT_TRUE(script.emulate_greasemonkey()); // Make sure the files actually exist on disk. - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists( extension->path().Append(script.js_scripts()[0].relative_path()))); - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists( extension->path().Append(kManifestFilename))); } @@ -128,9 +128,9 @@ TEST_F(ExtensionFromUserScript, NoMetadata) { EXPECT_EQ(expected, script.url_patterns()); // Make sure the files actually exist on disk. - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists( extension->path().Append(script.js_scripts()[0].relative_path()))); - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists( extension->path().Append(kManifestFilename))); } @@ -230,7 +230,7 @@ TEST_F(ExtensionFromUserScript, RunAtDocumentIdle) { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_file)); test_file = test_file.AppendASCII("extensions") .AppendASCII("user_script_run_at_idle.user.js"); - ASSERT_TRUE(file_util::PathExists(test_file)) << test_file.value(); + ASSERT_TRUE(base::PathExists(test_file)) << test_file.value(); string16 error; scoped_refptr<Extension> extension(ConvertUserScriptToExtension( diff --git a/chrome/browser/extensions/convert_web_app_unittest.cc b/chrome/browser/extensions/convert_web_app_unittest.cc index 1fb1a4e..fe081da 100644 --- a/chrome/browser/extensions/convert_web_app_unittest.cc +++ b/chrome/browser/extensions/convert_web_app_unittest.cc @@ -150,7 +150,7 @@ TEST(ExtensionFromWebApp, Basic) { web_app.icons[i].width, ExtensionIconSet::MATCH_EXACTLY); ASSERT_TRUE(!resource.empty()); - EXPECT_TRUE(file_util::PathExists(resource.GetFilePath())); + EXPECT_TRUE(base::PathExists(resource.GetFilePath())); } } diff --git a/chrome/browser/extensions/extension_browsertest.cc b/chrome/browser/extensions/extension_browsertest.cc index f2889f7..f4d0cda 100644 --- a/chrome/browser/extensions/extension_browsertest.cc +++ b/chrome/browser/extensions/extension_browsertest.cc @@ -250,7 +250,7 @@ base::FilePath ExtensionBrowserTest::PackExtension( dir_path.ReplaceExtension(FILE_PATH_LITERAL(".pem")); base::FilePath pem_path_out; - if (!file_util::PathExists(pem_path)) { + if (!base::PathExists(pem_path)) { pem_path = base::FilePath(); pem_path_out = crx_path.DirName().AppendASCII("temp.pem"); if (!base::Delete(pem_path_out, false)) { @@ -267,12 +267,12 @@ base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( const base::FilePath& crx_path, const base::FilePath& pem_path, const base::FilePath& pem_out_path) { - if (!file_util::PathExists(dir_path)) { + if (!base::PathExists(dir_path)) { ADD_FAILURE() << "Extension dir not found: " << dir_path.value(); return base::FilePath(); } - if (!file_util::PathExists(pem_path) && pem_out_path.empty()) { + if (!base::PathExists(pem_path) && pem_out_path.empty()) { ADD_FAILURE() << "Must specify a PEM file or PEM output path"; return base::FilePath(); } @@ -288,7 +288,7 @@ base::FilePath ExtensionBrowserTest::PackExtensionWithOptions( return base::FilePath(); } - if (!file_util::PathExists(crx_path)) { + if (!base::PathExists(crx_path)) { ADD_FAILURE() << crx_path.value() << " was not created."; return base::FilePath(); } diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index cedc048..975cd6d 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -57,7 +57,7 @@ bool ExtensionCreator::InitializeInput( // Validate input |private_key| (if provided). if (!private_key_path.value().empty() && - !file_util::PathExists(private_key_path)) { + !base::PathExists(private_key_path)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_INVALID_PATH); return false; @@ -67,7 +67,7 @@ bool ExtensionCreator::InitializeInput( // an existing private key. if (private_key_path.value().empty() && !private_key_output_path.value().empty() && - file_util::PathExists(private_key_output_path)) { + base::PathExists(private_key_output_path)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_EXISTS); return false; @@ -75,7 +75,7 @@ bool ExtensionCreator::InitializeInput( // Check whether crx file already exists. Should be last check, as this is // a warning only. - if (!(run_flags & kOverwriteCRX) && file_util::PathExists(crx_path)) { + if (!(run_flags & kOverwriteCRX) && base::PathExists(crx_path)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_CRX_EXISTS); error_type_ = kCRXExists; @@ -120,7 +120,7 @@ bool ExtensionCreator::ValidateManifest(const base::FilePath& extension_dir, crypto::RSAPrivateKey* ExtensionCreator::ReadInputKey(const base::FilePath& private_key_path) { - if (!file_util::PathExists(private_key_path)) { + if (!base::PathExists(private_key_path)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_PRIVATE_KEY_NO_EXISTS); return NULL; @@ -236,7 +236,7 @@ bool ExtensionCreator::WriteCRX(const base::FilePath& zip_path, crypto::RSAPrivateKey* private_key, const std::vector<uint8>& signature, const base::FilePath& crx_path) { - if (file_util::PathExists(crx_path)) + if (base::PathExists(crx_path)) base::Delete(crx_path, false); ScopedStdioHandle crx_handle(file_util::OpenFile(crx_path, "wb")); if (!crx_handle.get()) { diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc index f4b8e39..5bb7a98 100644 --- a/chrome/browser/extensions/extension_protocols.cc +++ b/chrome/browser/extensions/extension_protocols.cc @@ -101,7 +101,7 @@ void ReadMimeTypeFromFile(const base::FilePath& filename, void GetLastModifiedTime(const base::FilePath& filename, base::Time* last_modified_time) { - if (file_util::PathExists(filename)) { + if (base::PathExists(filename)) { base::PlatformFileInfo info; if (file_util::GetFileInfo(filename, &info)) *last_modified_time = info.last_modified; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index f0f28b8..a470027 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -675,7 +675,7 @@ class ExtensionServiceTest if (pem_path.value().empty()) { pem_output_path = crx_path.DirName().AppendASCII("temp.pem"); } else { - ASSERT_TRUE(file_util::PathExists(pem_path)); + ASSERT_TRUE(base::PathExists(pem_path)); } ASSERT_TRUE(base::Delete(crx_path, false)); @@ -687,7 +687,7 @@ class ExtensionServiceTest pem_output_path, ExtensionCreator::kOverwriteCRX)); - ASSERT_TRUE(file_util::PathExists(crx_path)); + ASSERT_TRUE(base::PathExists(crx_path)); } // Create a CrxInstaller and start installation. To allow the install @@ -699,7 +699,7 @@ class ExtensionServiceTest } void StartCRXInstall(const base::FilePath& crx_path, int creation_flags) { - ASSERT_TRUE(file_util::PathExists(crx_path)) + ASSERT_TRUE(base::PathExists(crx_path)) << "Path does not exist: "<< crx_path.value().c_str(); scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL)); installer->set_creation_flags(creation_flags); @@ -784,7 +784,7 @@ class ExtensionServiceTest const Extension* InstallCRXWithLocation(const base::FilePath& crx_path, Manifest::Location install_location, InstallState install_state) { - EXPECT_TRUE(file_util::PathExists(crx_path)) + EXPECT_TRUE(base::PathExists(crx_path)) << "Path does not exist: "<< crx_path.value().c_str(); // no client (silent install) scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL)); @@ -886,7 +886,7 @@ class ExtensionServiceTest void UpdateExtension(const std::string& id, const base::FilePath& in_path, UpdateState expected_state) { - ASSERT_TRUE(file_util::PathExists(in_path)); + ASSERT_TRUE(base::PathExists(in_path)); // We need to copy this to a temporary location because Update() will delete // it. @@ -938,7 +938,7 @@ class ExtensionServiceTest } // Update() should the temporary input file. - EXPECT_FALSE(file_util::PathExists(path)); + EXPECT_FALSE(base::PathExists(path)); } void TerminateExtension(const std::string& id) { @@ -963,7 +963,7 @@ class ExtensionServiceTest void UninstallExtension(const std::string& id, bool use_helper) { // Verify that the extension is installed. base::FilePath extension_path = extensions_install_dir_.AppendASCII(id); - EXPECT_TRUE(file_util::PathExists(extension_path)); + EXPECT_TRUE(base::PathExists(extension_path)); size_t pref_key_count = GetPrefKeyCount(); EXPECT_GT(pref_key_count, 0u); ValidateIntegerPref(id, "state", Extension::ENABLED); @@ -994,7 +994,7 @@ class ExtensionServiceTest loop_.RunUntilIdle(); // The directory should be gone. - EXPECT_FALSE(file_util::PathExists(extension_path)); + EXPECT_FALSE(base::PathExists(extension_path)); } void ValidatePrefKeyCount(size_t count) { @@ -1205,7 +1205,7 @@ void PackExtensionTestClient::OnPackSuccess( base::MessageLoop::current()->Quit(); EXPECT_EQ(expected_crx_path_.value(), crx_path.value()); EXPECT_EQ(expected_private_key_path_.value(), private_key_path.value()); - ASSERT_TRUE(file_util::PathExists(private_key_path)); + ASSERT_TRUE(base::PathExists(private_key_path)); } // The tests are designed so that we never expect to see a packing error. @@ -1410,7 +1410,7 @@ TEST_F(ExtensionServiceTest, CleanupOnStartup) { // And extension1 dir should now be toast. base::FilePath extension_dir = extensions_install_dir_ .AppendASCII("behllobkkfkfnphdnhnkndlbkcpglgmj"); - ASSERT_FALSE(file_util::PathExists(extension_dir)); + ASSERT_FALSE(base::PathExists(extension_dir)); } // Test that GarbageCollectExtensions deletes the right versions of an @@ -1429,7 +1429,7 @@ TEST_F(ExtensionServiceTest, GarbageCollectWithPendingUpdates) { // This is the directory that is going to be deleted, so make sure it actually // is there before the garbage collection. - ASSERT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + ASSERT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/3"))); service_->GarbageCollectExtensions(); @@ -1438,13 +1438,13 @@ TEST_F(ExtensionServiceTest, GarbageCollectWithPendingUpdates) { // Verify that the pending update for the first extension didn't get // deleted. - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0"))); - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "bjafgdebaacbbbecmhlhpofkepfkgcpa/2.0"))); - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/2"))); - EXPECT_FALSE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_FALSE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/3"))); } @@ -1463,7 +1463,7 @@ TEST_F(ExtensionServiceTest, UpdateOnStartup) { // This is the directory that is going to be deleted, so make sure it actually // is there before the garbage collection. - ASSERT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + ASSERT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/3"))); service_->Init(); @@ -1475,13 +1475,13 @@ TEST_F(ExtensionServiceTest, UpdateOnStartup) { loop_.RunUntilIdle(); // Verify that the pending update for the first extension got installed. - EXPECT_FALSE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_FALSE(base::PathExists(extensions_install_dir_.AppendASCII( "bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0"))); - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "bjafgdebaacbbbecmhlhpofkepfkgcpa/2.0"))); - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/2"))); - EXPECT_FALSE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_FALSE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/3"))); // Make sure update information got deleted. @@ -1512,9 +1512,9 @@ TEST_F(ExtensionServiceTest, PendingImports) { // These extensions are used by the extensions we test below, they must be // installed. - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "bjafgdebaacbbbecmhlhpofkepfkgcpa/1.0"))); - EXPECT_TRUE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_TRUE(base::PathExists(extensions_install_dir_.AppendASCII( "hpiknbiabeeppbpihjehijgoemciehgk/2"))); // Each of these extensions should have been rejected because of dependencies @@ -1539,7 +1539,7 @@ TEST_F(ExtensionServiceTest, PendingImports) { EXPECT_EQ(ExtensionPrefs::DELAY_REASON_WAIT_FOR_IMPORTS, prefs->GetDelayedInstallReason("behllobkkfkfnphdnhnkndlbkcpglgmj")); - EXPECT_FALSE(file_util::PathExists(extensions_install_dir_.AppendASCII( + EXPECT_FALSE(base::PathExists(extensions_install_dir_.AppendASCII( "behllobkkfkfnphdnhnkndlbkcpglgmj/1.0.0.0"))); EXPECT_TRUE(service_->pending_extension_manager()->HasPendingExtensions()); @@ -1801,7 +1801,7 @@ TEST_F(ExtensionServiceTest, InstallUserScript) { base::FilePath path = data_dir_ .AppendASCII("user_script_basic.user.js"); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(path)); scoped_refptr<CrxInstaller> installer(CrxInstaller::Create(service_, NULL)); installer->set_allow_silent_install(true); installer->InstallUserScript( @@ -1851,8 +1851,8 @@ TEST_F(ExtensionServiceTest, GrantedPermissions) { base::FilePath pem_path = path.AppendASCII("unknown.pem"); path = path.AppendASCII("unknown"); - ASSERT_TRUE(file_util::PathExists(pem_path)); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(pem_path)); + ASSERT_TRUE(base::PathExists(path)); ExtensionPrefs* prefs = service_->extension_prefs(); @@ -1900,8 +1900,8 @@ TEST_F(ExtensionServiceTest, DefaultAppsGrantedPermissions) { base::FilePath pem_path = path.AppendASCII("unknown.pem"); path = path.AppendASCII("unknown"); - ASSERT_TRUE(file_util::PathExists(pem_path)); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(pem_path)); + ASSERT_TRUE(base::PathExists(path)); ExtensionPrefs* prefs = service_->extension_prefs(); @@ -1947,7 +1947,7 @@ TEST_F(ExtensionServiceTest, GrantedFullAccessPermissions) { .AppendASCII(good1) .AppendASCII("2"); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(path)); const Extension* extension = PackAndInstallCRX(path, INSTALL_NEW); EXPECT_EQ(0u, GetErrors().size()); EXPECT_EQ(1u, service_->extensions()->size()); @@ -1975,7 +1975,7 @@ TEST_F(ExtensionServiceTest, GrantedAPIAndHostPermissions) { .AppendASCII("permissions") .AppendASCII("unknown"); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(path)); const Extension* extension = PackAndInstallCRX(path, INSTALL_NEW); @@ -2086,8 +2086,8 @@ TEST_F(ExtensionServiceTest, PackExtension) { scoped_ptr<ExtensionCreator> creator(new ExtensionCreator()); ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)); - ASSERT_TRUE(file_util::PathExists(crx_path)); - ASSERT_TRUE(file_util::PathExists(privkey_path)); + ASSERT_TRUE(base::PathExists(crx_path)); + ASSERT_TRUE(base::PathExists(privkey_path)); // Repeat the run with the pem file gone, and no special flags // Should refuse to overwrite the existing crx. @@ -2104,7 +2104,7 @@ TEST_F(ExtensionServiceTest, PackExtension) { ASSERT_FALSE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kOverwriteCRX)); - ASSERT_TRUE(file_util::PathExists(privkey_path)); + ASSERT_TRUE(base::PathExists(privkey_path)); InstallCRX(crx_path, INSTALL_NEW); // Try packing with invalid paths. @@ -2225,8 +2225,8 @@ TEST_F(ExtensionServiceTest, PackExtensionContainingKeyFails) { ASSERT_TRUE(creator->Run(input_directory, crx_path, base::FilePath(), privkey_path, ExtensionCreator::kNoRunFlags)) << creator->error_message(); - ASSERT_TRUE(file_util::PathExists(crx_path)); - ASSERT_TRUE(file_util::PathExists(privkey_path)); + ASSERT_TRUE(base::PathExists(crx_path)); + ASSERT_TRUE(base::PathExists(privkey_path)); base::Delete(crx_path, false); // Move the pem file into the extension. @@ -2256,7 +2256,7 @@ TEST_F(ExtensionServiceTest, PackExtensionOpenSSLKey) { .AppendASCII("1.0.0.0"); base::FilePath privkey_path(data_dir_.AppendASCII( "openssl_privkey_asn1.pem")); - ASSERT_TRUE(file_util::PathExists(privkey_path)); + ASSERT_TRUE(base::PathExists(privkey_path)); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -2330,7 +2330,7 @@ TEST_F(ExtensionServiceTest, LoadLocalizedTheme) { // temporary directory, but it automatically installs to the extension's // directory, and we don't want to copy the whole extension for a unittest. base::FilePath theme_file = extension_path.Append(chrome::kThemePackFilename); - ASSERT_TRUE(file_util::PathExists(theme_file)); + ASSERT_TRUE(base::PathExists(theme_file)); ASSERT_TRUE(base::Delete(theme_file, false)); // Not recursive. } @@ -2353,8 +2353,8 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionCanChangeID) { AppendASCII("unpacked"). AppendASCII("manifest_with_key.json"); - ASSERT_TRUE(file_util::PathExists(manifest_no_key)); - ASSERT_TRUE(file_util::PathExists(manifest_with_key)); + ASSERT_TRUE(base::PathExists(manifest_no_key)); + ASSERT_TRUE(base::PathExists(manifest_with_key)); // Load the unpacked extension with no key. base::CopyFile(manifest_no_key, manifest_path); @@ -2387,9 +2387,9 @@ TEST_F(ExtensionServiceTest, UnpackedExtensionMayContainSymlinkedFiles) { // Paths to test data files. base::FilePath source_manifest = source_data_dir.AppendASCII("manifest.json"); - ASSERT_TRUE(file_util::PathExists(source_manifest)); + ASSERT_TRUE(base::PathExists(source_manifest)); base::FilePath source_icon = source_data_dir.AppendASCII("icon.png"); - ASSERT_TRUE(file_util::PathExists(source_icon)); + ASSERT_TRUE(base::PathExists(source_icon)); // Set up the temporary extension directory. base::ScopedTempDir temp; @@ -2842,7 +2842,7 @@ TEST_F(ExtensionServiceTest, LoadExtensionsCanDowngrade) { base::FilePath extension_path = temp.path(); base::FilePath manifest_path = extension_path.Append(extensions::kManifestFilename); - ASSERT_FALSE(file_util::PathExists(manifest_path)); + ASSERT_FALSE(base::PathExists(manifest_path)); // Start with version 2.0. DictionaryValue manifest; @@ -4061,7 +4061,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { .AddExtension(FILE_PATH_LITERAL(".localstorage")); EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); - EXPECT_TRUE(file_util::PathExists(lso_file_path)); + EXPECT_TRUE(base::PathExists(lso_file_path)); // Create indexed db. Similarly, it is enough to only simulate this by // creating the directory on the disk. @@ -4092,7 +4092,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { EXPECT_EQ(0U, origins.size()); // Check that the LSO file has been removed. - EXPECT_FALSE(file_util::PathExists(lso_file_path)); + EXPECT_FALSE(base::PathExists(lso_file_path)); // Check if the indexed db has disappeared too. EXPECT_FALSE(file_util::DirectoryExists(idb_path)); @@ -4178,7 +4178,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { .AddExtension(FILE_PATH_LITERAL(".localstorage")); EXPECT_TRUE(file_util::CreateDirectory(lso_dir_path)); EXPECT_EQ(0, file_util::WriteFile(lso_file_path, NULL, 0)); - EXPECT_TRUE(file_util::PathExists(lso_file_path)); + EXPECT_TRUE(base::PathExists(lso_file_path)); // Create indexed db. Similarly, it is enough to only simulate this by // creating the directory on the disk. @@ -4226,7 +4226,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { EXPECT_EQ(0U, origins.size()); // Check that the LSO file has been removed. - EXPECT_FALSE(file_util::PathExists(lso_file_path)); + EXPECT_FALSE(base::PathExists(lso_file_path)); // Check if the indexed db has disappeared too. EXPECT_FALSE(file_util::DirectoryExists(idb_path)); @@ -4363,10 +4363,10 @@ void ExtensionServiceTest::TestExternalProvider( base::FilePath install_path = extensions_install_dir_.AppendASCII(id); if (no_uninstall) { // Policy controlled extensions should not have been touched by uninstall. - ASSERT_TRUE(file_util::PathExists(install_path)); + ASSERT_TRUE(base::PathExists(install_path)); } else { // The extension should also be gone from the install directory. - ASSERT_FALSE(file_util::PathExists(install_path)); + ASSERT_FALSE(base::PathExists(install_path)); loaded_.clear(); service_->CheckForExternalUpdates(); loop_.RunUntilIdle(); @@ -4404,7 +4404,7 @@ void ExtensionServiceTest::TestExternalProvider( ValidatePrefKeyCount(0); // The extension should also be gone from the install directory. - ASSERT_FALSE(file_util::PathExists(install_path)); + ASSERT_FALSE(base::PathExists(install_path)); // Now test the case where user uninstalls and then the extension is removed // from the external provider. diff --git a/chrome/browser/extensions/external_pref_loader.cc b/chrome/browser/extensions/external_pref_loader.cc index 849829a..567fdb2 100644 --- a/chrome/browser/extensions/external_pref_loader.cc +++ b/chrome/browser/extensions/external_pref_loader.cc @@ -31,7 +31,7 @@ std::set<base::FilePath> GetPrefsCandidateFilesFromFolder( std::set<base::FilePath> external_extension_paths; - if (!file_util::PathExists(external_extension_search_path)) { + if (!base::PathExists(external_extension_search_path)) { // Does not have to exist. return external_extension_paths; } @@ -156,7 +156,7 @@ void ExternalPrefLoader::ReadExternalExtensionPrefFile(DictionaryValue* prefs) { base::FilePath json_file = base_path_.Append(kExternalExtensionJson); - if (!file_util::PathExists(json_file)) { + if (!base::PathExists(json_file)) { // This is not an error. The file does not exist by default. return; } diff --git a/chrome/browser/extensions/external_registry_loader_win.cc b/chrome/browser/extensions/external_registry_loader_win.cc index 47cf902..cf446c0 100644 --- a/chrome/browser/extensions/external_registry_loader_win.cc +++ b/chrome/browser/extensions/external_registry_loader_win.cc @@ -100,7 +100,7 @@ void ExternalRegistryLoader::LoadOnFileThread() { continue; } - if (!file_util::PathExists(extension_path)) { + if (!base::PathExists(extension_path)) { LOG(ERROR) << "File " << extension_path_str << " for key " << key_path << " does not exist or is not readable."; diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index 03d914b..c6c862cb 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -146,7 +146,7 @@ class PlatformAppPathLauncher DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // If the file doesn't exist, or is a directory, launch with no launch data. - if (!file_util::PathExists(file_path_) || + if (!base::PathExists(file_path_) || file_util::DirectoryExists(file_path_)) { LOG(WARNING) << "No file exists with path " << file_path_.value(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( diff --git a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc index a5cccb4..7e0477f 100644 --- a/chrome/browser/extensions/sandboxed_unpacker_unittest.cc +++ b/chrome/browser/extensions/sandboxed_unpacker_unittest.cc @@ -79,7 +79,7 @@ class SandboxedUnpackerTest : public testing::Test { original_path = original_path.AppendASCII("extensions") .AppendASCII("unpacker") .AppendASCII(crx_name); - ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); + ASSERT_TRUE(base::PathExists(original_path)) << original_path.value(); sandboxed_unpacker_ = new SandboxedUnpacker( original_path, @@ -112,7 +112,7 @@ TEST_F(SandboxedUnpackerTest, NoCatalogsSuccess) { // Check that there is no _locales folder. base::FilePath install_path = GetInstallPath().Append(kLocaleFolder); - EXPECT_FALSE(file_util::PathExists(install_path)); + EXPECT_FALSE(base::PathExists(install_path)); } TEST_F(SandboxedUnpackerTest, WithCatalogsSuccess) { @@ -120,7 +120,7 @@ TEST_F(SandboxedUnpackerTest, WithCatalogsSuccess) { // Check that there is _locales folder. base::FilePath install_path = GetInstallPath().Append(kLocaleFolder); - EXPECT_TRUE(file_util::PathExists(install_path)); + EXPECT_TRUE(base::PathExists(install_path)); } } // namespace extensions diff --git a/chrome/browser/extensions/test_extension_dir.cc b/chrome/browser/extensions/test_extension_dir.cc index 9c1ed76..039fbe8 100644 --- a/chrome/browser/extensions/test_extension_dir.cc +++ b/chrome/browser/extensions/test_extension_dir.cc @@ -45,7 +45,7 @@ base::FilePath TestExtensionDir::Pack() { base::FilePath pem_path = crx_dir_.path().Append(FILE_PATH_LITERAL("ext.pem")); base::FilePath pem_in_path, pem_out_path; - if (file_util::PathExists(pem_path)) + if (base::PathExists(pem_path)) pem_in_path = pem_path; else pem_out_path = pem_path; @@ -58,7 +58,7 @@ base::FilePath TestExtensionDir::Pack() { << "ExtensionCreator::Run() failed: " << creator.error_message(); return base::FilePath(); } - if (!file_util::PathExists(crx_path)) { + if (!base::PathExists(crx_path)) { ADD_FAILURE() << crx_path.value() << " was not created."; return base::FilePath(); } diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc index 18d899a..b797337 100644 --- a/chrome/browser/extensions/user_script_listener_unittest.cc +++ b/chrome/browser/extensions/user_script_listener_unittest.cc @@ -79,7 +79,7 @@ class SimpleTestJob : public net::URLRequestTestJob { // Yoinked from extension_manifest_unittest.cc. DictionaryValue* LoadManifestFile(const base::FilePath path, std::string* error) { - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); JSONFileValueSerializer serializer(path); return static_cast<DictionaryValue*>(serializer.Deserialize(NULL, error)); } diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 86011c8..effb63d 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -169,7 +169,7 @@ base::FilePath GetDefaultPrefFilePath(bool create_profile_dir, base::FilePath default_pref_dir = ProfileManager::GetDefaultProfileDir(user_data_dir); if (create_profile_dir) { - if (!file_util::PathExists(default_pref_dir)) { + if (!base::PathExists(default_pref_dir)) { if (!file_util::CreateDirectory(default_pref_dir)) return base::FilePath(); } @@ -470,7 +470,7 @@ bool IsChromeFirstRun() { base::FilePath first_run_sentinel; if (!internal::GetFirstRunSentinelFilePath(&first_run_sentinel) || - file_util::PathExists(first_run_sentinel)) { + base::PathExists(first_run_sentinel)) { internal::first_run_ = internal::FIRST_RUN_FALSE; return false; } @@ -677,7 +677,7 @@ void AutoImport( base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); - bool local_state_file_exists = file_util::PathExists(local_state_path); + bool local_state_file_exists = base::PathExists(local_state_path); scoped_refptr<ImporterList> importer_list(new ImporterList()); importer_list->DetectSourceProfilesHack( diff --git a/chrome/browser/first_run/first_run_internal_posix.cc b/chrome/browser/first_run/first_run_internal_posix.cc index ce26df8..51f942a 100644 --- a/chrome/browser/first_run/first_run_internal_posix.cc +++ b/chrome/browser/first_run/first_run_internal_posix.cc @@ -28,7 +28,7 @@ void DoPostImportPlatformSpecificTasks(Profile* profile) { #if !defined(USE_AURA) base::FilePath local_state_path; PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); - bool local_state_file_exists = file_util::PathExists(local_state_path); + bool local_state_file_exists = base::PathExists(local_state_path); // Launch the first run dialog only for certain builds, and only if the user // has not already set preferences. if (internal::IsOrganicFirstRun() && !local_state_file_exists) { diff --git a/chrome/browser/first_run/first_run_internal_win.cc b/chrome/browser/first_run/first_run_internal_win.cc index bc46456..5cb5228 100644 --- a/chrome/browser/first_run/first_run_internal_win.cc +++ b/chrome/browser/first_run/first_run_internal_win.cc @@ -112,7 +112,7 @@ bool IsEULANotAccepted(installer::MasterPreferences* install_prefs) { // Be conservative and show the EULA if the path to the sentinel can't be // determined. if (!GetEULASentinelFilePath(&eula_sentinel) || - !file_util::PathExists(eula_sentinel)) { + !base::PathExists(eula_sentinel)) { return true; } } diff --git a/chrome/browser/first_run/first_run_unittest.cc b/chrome/browser/first_run/first_run_unittest.cc index 8cd1edf..0e0edcb 100644 --- a/chrome/browser/first_run/first_run_unittest.cc +++ b/chrome/browser/first_run/first_run_unittest.cc @@ -34,10 +34,10 @@ class FirstRunTest : public testing::Test { TEST_F(FirstRunTest, RemoveSentinel) { EXPECT_TRUE(CreateSentinel()); - EXPECT_TRUE(file_util::PathExists(sentinel_path_)); + EXPECT_TRUE(base::PathExists(sentinel_path_)); EXPECT_TRUE(RemoveSentinel()); - EXPECT_FALSE(file_util::PathExists(sentinel_path_)); + EXPECT_FALSE(base::PathExists(sentinel_path_)); } TEST_F(FirstRunTest, SetupMasterPrefsFromInstallPrefs_VariationsSeed) { diff --git a/chrome/browser/first_run/upgrade_util_win.cc b/chrome/browser/first_run/upgrade_util_win.cc index 23b9067..c669aa0 100644 --- a/chrome/browser/first_run/upgrade_util_win.cc +++ b/chrome/browser/first_run/upgrade_util_win.cc @@ -174,14 +174,14 @@ bool IsUpdatePendingRestart() { base::FilePath new_chrome_exe; if (!GetNewerChromeFile(&new_chrome_exe)) return false; - return file_util::PathExists(new_chrome_exe); + return base::PathExists(new_chrome_exe); } bool SwapNewChromeExeIfPresent() { base::FilePath new_chrome_exe; if (!GetNewerChromeFile(&new_chrome_exe)) return false; - if (!file_util::PathExists(new_chrome_exe)) + if (!base::PathExists(new_chrome_exe)) return false; base::FilePath cur_chrome_exe; if (!PathService::Get(base::FILE_EXE, &cur_chrome_exe)) diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc index c4bd2cd..c253421 100644 --- a/chrome/browser/google/google_update_settings_posix.cc +++ b/chrome/browser/google/google_update_settings_posix.cc @@ -42,8 +42,8 @@ bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); if (consented) { - if ((!file_util::PathExists(consent_file)) || - (file_util::PathExists(consent_file) && + if ((!base::PathExists(consent_file)) || + (base::PathExists(consent_file) && !google_update::posix_guid().empty())) { const char* c_str = google_update::posix_guid().c_str(); int size = google_update::posix_guid().size(); diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc index 74f2200..06059a7 100644 --- a/chrome/browser/history/android/android_provider_backend_unittest.cc +++ b/chrome/browser/history/android/android_provider_backend_unittest.cc @@ -262,8 +262,8 @@ TEST_F(AndroidProviderBackendTest, UpdateTables) { // The history_db_name and thumbnail_db_name files should be created by // HistoryBackend. We need to open the same database files. - ASSERT_TRUE(file_util::PathExists(history_db_name_)); - ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); + ASSERT_TRUE(base::PathExists(history_db_name_)); + ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, @@ -412,8 +412,8 @@ TEST_F(AndroidProviderBackendTest, QueryHistoryAndBookmarks) { // The history_db_name and thumbnail_db_name files should be created by // HistoryBackend. We need to open the same database files. - ASSERT_TRUE(file_util::PathExists(history_db_name_)); - ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); + ASSERT_TRUE(base::PathExists(history_db_name_)); + ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); ASSERT_EQ(sql::INIT_OK, thumbnail_db_.Init(thumbnail_db_name_, NULL, @@ -1826,8 +1826,8 @@ TEST_F(AndroidProviderBackendTest, QueryWithoutThumbnailDB) { // The history_db_name and thumbnail_db_name files should be created by // HistoryBackend. We need to open the same database files. - ASSERT_TRUE(file_util::PathExists(history_db_name_)); - ASSERT_TRUE(file_util::PathExists(thumbnail_db_name_)); + ASSERT_TRUE(base::PathExists(history_db_name_)); + ASSERT_TRUE(base::PathExists(thumbnail_db_name_)); // Only creates the history database ASSERT_EQ(sql::INIT_OK, history_db_.Init(history_db_name_)); diff --git a/chrome/browser/history/in_memory_url_index_unittest.cc b/chrome/browser/history/in_memory_url_index_unittest.cc index 8a2d1de..6fa5d71 100644 --- a/chrome/browser/history/in_memory_url_index_unittest.cc +++ b/chrome/browser/history/in_memory_url_index_unittest.cc @@ -203,7 +203,7 @@ void InMemoryURLIndexTest::SetUp() { history_proto_path = history_proto_path.Append( FILE_PATH_LITERAL("History")); history_proto_path = history_proto_path.Append(TestDBName()); - EXPECT_TRUE(file_util::PathExists(history_proto_path)); + EXPECT_TRUE(base::PathExists(history_proto_path)); std::ifstream proto_file(history_proto_path.value().c_str()); static const size_t kCommandBufferMaxSize = 2048; diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index 7353174..0f5db89 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -127,7 +127,7 @@ TextDatabase::DBIdent TextDatabase::FileNameToID( bool TextDatabase::Init() { // Make sure, if we're not allowed to create the file, that it exists. if (!allow_create_) { - if (!file_util::PathExists(file_name_)) + if (!base::PathExists(file_name_)) return false; } diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc index cf4220d..6192a87 100644 --- a/chrome/browser/history/top_sites_database.cc +++ b/chrome/browser/history/top_sites_database.cc @@ -25,7 +25,7 @@ TopSitesDatabase::~TopSitesDatabase() { } bool TopSitesDatabase::Init(const base::FilePath& db_name) { - bool file_existed = file_util::PathExists(db_name); + bool file_existed = base::PathExists(db_name); if (!file_existed) may_need_history_migration_ = true; diff --git a/chrome/browser/history/top_sites_impl_unittest.cc b/chrome/browser/history/top_sites_impl_unittest.cc index 566e8e9..e97a8d4 100644 --- a/chrome/browser/history/top_sites_impl_unittest.cc +++ b/chrome/browser/history/top_sites_impl_unittest.cc @@ -910,7 +910,7 @@ TEST_F(TopSitesMigrationTest, Migrate) { WaitForHistory(); // Make sure there is no longer a Thumbnails file on disk. - ASSERT_FALSE(file_util::PathExists( + ASSERT_FALSE(base::PathExists( profile()->GetPath().Append(chrome::kThumbnailsFilename))); // Recreate top sites and make sure everything is still there. diff --git a/chrome/browser/history/top_sites_likely_impl_unittest.cc b/chrome/browser/history/top_sites_likely_impl_unittest.cc index 14529ca..4bd3c85 100644 --- a/chrome/browser/history/top_sites_likely_impl_unittest.cc +++ b/chrome/browser/history/top_sites_likely_impl_unittest.cc @@ -911,7 +911,7 @@ TEST_F(TopSitesLikelyMigrationTest, Migrate) { WaitForHistory(); // Make sure there is no longer a Thumbnails file on disk. - ASSERT_FALSE(file_util::PathExists( + ASSERT_FALSE(base::PathExists( profile()->GetPath().Append(chrome::kThumbnailsFilename))); // Recreate top sites and make sure everything is still there. diff --git a/chrome/browser/history/url_index_private_data.cc b/chrome/browser/history/url_index_private_data.cc index 3315adb6..d4548cb 100644 --- a/chrome/browser/history/url_index_private_data.cc +++ b/chrome/browser/history/url_index_private_data.cc @@ -396,7 +396,7 @@ scoped_refptr<URLIndexPrivateData> URLIndexPrivateData::RestoreFromFile( const base::FilePath& file_path, const std::string& languages) { base::TimeTicks beginning_time = base::TimeTicks::Now(); - if (!file_util::PathExists(file_path)) + if (!base::PathExists(file_path)) return NULL; std::string data; // If there is no cache file then simply give up. This will cause us to diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index d8cc90c..1cfdbce 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -131,7 +131,7 @@ void Firefox3Importer::StartImport( void Firefox3Importer::ImportHistory() { base::FilePath file = source_path_.AppendASCII("places.sqlite"); - if (!file_util::PathExists(file)) + if (!base::PathExists(file)) return; sql::Connection db; @@ -175,7 +175,7 @@ void Firefox3Importer::ImportHistory() { void Firefox3Importer::ImportBookmarks() { base::FilePath file = source_path_.AppendASCII("places.sqlite"); - if (!file_util::PathExists(file)) + if (!base::PathExists(file)) return; sql::Connection db; @@ -333,13 +333,13 @@ void Firefox3Importer::ImportPasswords() { std::vector<content::PasswordForm> forms; base::FilePath source_path = source_path_; base::FilePath file = source_path.AppendASCII("signons.sqlite"); - if (file_util::PathExists(file)) { + if (base::PathExists(file)) { // Since Firefox 3.1, passwords are in signons.sqlite db. decryptor.ReadAndParseSignons(file, &forms); } else { // Firefox 3.0 uses signons3.txt to store the passwords. file = source_path.AppendASCII("signons3.txt"); - if (!file_util::PathExists(file)) + if (!base::PathExists(file)) file = source_path.AppendASCII("signons2.txt"); std::string content; @@ -371,7 +371,7 @@ void Firefox3Importer::ImportHomepage() { void Firefox3Importer::GetSearchEnginesXMLData( std::vector<std::string>* search_engine_data) { base::FilePath file = source_path_.AppendASCII("search.sqlite"); - if (!file_util::PathExists(file)) + if (!base::PathExists(file)) return; sql::Connection db; diff --git a/chrome/browser/importer/firefox_importer_browsertest.cc b/chrome/browser/importer/firefox_importer_browsertest.cc index e8d854d..688c2c2 100644 --- a/chrome/browser/importer/firefox_importer_browsertest.cc +++ b/chrome/browser/importer/firefox_importer_browsertest.cc @@ -248,7 +248,7 @@ class FirefoxProfileImporterBrowserTest : public InProcessBrowserTest { if (import_search_plugins) { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); data_path = data_path.AppendASCII("firefox3_searchplugins"); - if (!file_util::PathExists(data_path)) { + if (!base::PathExists(data_path)) { // TODO(maruel): Create search test data that we can open source! LOG(ERROR) << L"Missing internal test data"; return; diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc index 5610f5b..782e1fa 100644 --- a/chrome/browser/importer/firefox_importer_utils.cc +++ b/chrome/browser/importer/firefox_importer_utils.cc @@ -321,7 +321,7 @@ std::string GetPrefsJsValue(const std::string& content, string16 GetFirefoxImporterName(const base::FilePath& app_path) { const base::FilePath app_ini_file = app_path.AppendASCII("application.ini"); std::string branding_name; - if (file_util::PathExists(app_ini_file)) { + if (base::PathExists(app_ini_file)) { std::string content; file_util::ReadFileToString(app_ini_file, &content); std::vector<std::string> lines; diff --git a/chrome/browser/importer/firefox_importer_utils_linux.cc b/chrome/browser/importer/firefox_importer_utils_linux.cc index 98f9c2a4..0162d05 100644 --- a/chrome/browser/importer/firefox_importer_utils_linux.cc +++ b/chrome/browser/importer/firefox_importer_utils_linux.cc @@ -14,7 +14,7 @@ base::FilePath GetProfilesINI() { if (!home.empty()) { ini_file = home.Append(".mozilla/firefox/profiles.ini"); } - if (file_util::PathExists(ini_file)) + if (base::PathExists(ini_file)) return ini_file; return base::FilePath(); diff --git a/chrome/browser/importer/firefox_importer_utils_mac.mm b/chrome/browser/importer/firefox_importer_utils_mac.mm index 6aa9040..10171fd 100644 --- a/chrome/browser/importer/firefox_importer_utils_mac.mm +++ b/chrome/browser/importer/firefox_importer_utils_mac.mm @@ -18,7 +18,7 @@ base::FilePath GetProfilesINI() { } base::FilePath ini_file = app_data_path.Append("Firefox").Append("profiles.ini"); - if (!file_util::PathExists(ini_file)) { + if (!base::PathExists(ini_file)) { return base::FilePath(); } return ini_file; diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc index 68a4453..638deb2 100644 --- a/chrome/browser/importer/firefox_importer_utils_win.cc +++ b/chrome/browser/importer/firefox_importer_utils_win.cc @@ -78,5 +78,5 @@ base::FilePath GetProfilesINI() { ini_file = ini_file.AppendASCII("Firefox"); ini_file = ini_file.AppendASCII("profiles.ini"); - return file_util::PathExists(ini_file) ? ini_file : base::FilePath(); + return base::PathExists(ini_file) ? ini_file : base::FilePath(); } diff --git a/chrome/browser/importer/firefox_profile_lock_unittest.cc b/chrome/browser/importer/firefox_profile_lock_unittest.cc index 7506a71..95a4b4b 100644 --- a/chrome/browser/importer/firefox_profile_lock_unittest.cc +++ b/chrome/browser/importer/firefox_profile_lock_unittest.cc @@ -39,27 +39,27 @@ TEST_F(FirefoxProfileLockTest, ProfileLock) { scoped_ptr<FirefoxProfileLock> lock; EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock.get()); - EXPECT_FALSE(file_util::PathExists(lock_file_path)); + EXPECT_FALSE(base::PathExists(lock_file_path)); lock.reset(new FirefoxProfileLock(test_path)); EXPECT_TRUE(lock->HasAcquired()); - EXPECT_TRUE(file_util::PathExists(lock_file_path)); + EXPECT_TRUE(base::PathExists(lock_file_path)); lock->Unlock(); EXPECT_FALSE(lock->HasAcquired()); // In the posix code, we don't delete the file when releasing the lock. #if !defined(OS_POSIX) - EXPECT_FALSE(file_util::PathExists(lock_file_path)); + EXPECT_FALSE(base::PathExists(lock_file_path)); #endif // !defined(OS_POSIX) lock->Lock(); EXPECT_TRUE(lock->HasAcquired()); - EXPECT_TRUE(file_util::PathExists(lock_file_path)); + EXPECT_TRUE(base::PathExists(lock_file_path)); lock->Lock(); EXPECT_TRUE(lock->HasAcquired()); lock->Unlock(); EXPECT_FALSE(lock->HasAcquired()); // In the posix code, we don't delete the file when releasing the lock. #if !defined(OS_POSIX) - EXPECT_FALSE(file_util::PathExists(lock_file_path)); + EXPECT_FALSE(base::PathExists(lock_file_path)); #endif // !defined(OS_POSIX) } @@ -74,7 +74,7 @@ TEST_F(FirefoxProfileLockTest, ProfileLockOrphaned) { FILE* lock_file = file_util::OpenFile(lock_file_path, "w"); ASSERT_TRUE(lock_file); file_util::CloseFile(lock_file); - EXPECT_TRUE(file_util::PathExists(lock_file_path)); + EXPECT_TRUE(base::PathExists(lock_file_path)); scoped_ptr<FirefoxProfileLock> lock; EXPECT_EQ(static_cast<FirefoxProfileLock*>(NULL), lock.get()); diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm index 7bb0cd4..eb04d67 100644 --- a/chrome/browser/importer/safari_importer.mm +++ b/chrome/browser/importer/safari_importer.mm @@ -61,9 +61,9 @@ bool SafariImporter::CanImport(const base::FilePath& library_dir, base::FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); base::FilePath history_path = safari_dir.Append("History.plist"); - if (file_util::PathExists(bookmarks_path)) + if (base::PathExists(bookmarks_path)) *services_supported |= importer::FAVORITES; - if (file_util::PathExists(history_path)) + if (base::PathExists(history_path)) *services_supported |= importer::HISTORY; return *services_supported != importer::NONE; diff --git a/chrome/browser/importer/safari_importer_unittest.mm b/chrome/browser/importer/safari_importer_unittest.mm index 93e110c..a5aae66 100644 --- a/chrome/browser/importer/safari_importer_unittest.mm +++ b/chrome/browser/importer/safari_importer_unittest.mm @@ -37,7 +37,7 @@ class SafariImporterTest : public PlatformTest { public: SafariImporter* GetSafariImporter() { base::FilePath test_library_dir = GetTestSafariLibraryPath(); - CHECK(file_util::PathExists(test_library_dir)) << + CHECK(base::PathExists(test_library_dir)) << "Missing test data directory"; return new SafariImporter(test_library_dir); diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc index 4447141..ca3a75e 100644 --- a/chrome/browser/jumplist_win.cc +++ b/chrome/browser/jumplist_win.cc @@ -735,7 +735,7 @@ void JumpList::RunUpdate() { // icon directory, and create a new directory which contains new JumpList // icon files. base::FilePath icon_dir_old(icon_dir_.value() + L"Old"); - if (file_util::PathExists(icon_dir_old)) + if (base::PathExists(icon_dir_old)) base::Delete(icon_dir_old, true); base::Move(icon_dir_, icon_dir_old); file_util::CreateDirectory(icon_dir_); diff --git a/chrome/browser/mac/master_prefs.mm b/chrome/browser/mac/master_prefs.mm index 2355b2c..cd22a67 100644 --- a/chrome/browser/mac/master_prefs.mm +++ b/chrome/browser/mac/master_prefs.mm @@ -45,7 +45,7 @@ base::FilePath MasterPrefsPath() { if (chrome::GetDefaultUserDataDirectory(&user_application_support_path)) { user_application_support_path = user_application_support_path.Append(kMasterPreferencesFileName); - if (file_util::PathExists(user_application_support_path)) + if (base::PathExists(user_application_support_path)) return user_application_support_path; } diff --git a/chrome/browser/media/chrome_webrtc_browsertest.cc b/chrome/browser/media/chrome_webrtc_browsertest.cc index bf74bf7..0fd01fa 100644 --- a/chrome/browser/media/chrome_webrtc_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_browsertest.cc @@ -239,7 +239,7 @@ class WebrtcBrowserTest : public InProcessBrowserTest { EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &peerconnection_server)); peerconnection_server = peerconnection_server.Append(kPeerConnectionServer); - EXPECT_TRUE(file_util::PathExists(peerconnection_server)) << + EXPECT_TRUE(base::PathExists(peerconnection_server)) << "Missing peerconnection_server. You must build " "it so it ends up next to the browser test binary."; EXPECT_TRUE(base::LaunchProcess( diff --git a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc index 8dd7d18..c6036a8 100644 --- a/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc +++ b/chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc @@ -109,12 +109,12 @@ class WebrtcVideoQualityBrowserTest : public InProcessBrowserTest { InProcessBrowserTest::SetUp(); // Ensure we have the stuff we need. - EXPECT_TRUE(file_util::PathExists(GetWorkingDir())) + EXPECT_TRUE(base::PathExists(GetWorkingDir())) << "Cannot find the working directory for the reference video and " "the temporary files:" << GetWorkingDir().value(); base::FilePath reference_file = GetWorkingDir().Append(kReferenceYuvFileName); - EXPECT_TRUE(file_util::PathExists(reference_file)) + EXPECT_TRUE(base::PathExists(reference_file)) << "Cannot find the reference file to be used for video quality " << "comparison: " << reference_file.value(); } @@ -144,9 +144,9 @@ class WebrtcVideoQualityBrowserTest : public InProcessBrowserTest { base::FilePath path_to_data_handler = GetSourceDir().Append(FILE_PATH_LITERAL("chrome/test/functional")); - EXPECT_TRUE(file_util::PathExists(pywebsocket_server)) + EXPECT_TRUE(base::PathExists(pywebsocket_server)) << "Fatal: missing pywebsocket server."; - EXPECT_TRUE(file_util::PathExists(path_to_data_handler)) + EXPECT_TRUE(base::PathExists(path_to_data_handler)) << "Fatal: missing data handler for pywebsocket server."; AppendToPythonPath(path_pywebsocket_dir); @@ -277,7 +277,7 @@ class WebrtcVideoQualityBrowserTest : public InProcessBrowserTest { const base::FilePath& captured_video_filename) { base::FilePath path_to_converter = base::MakeAbsoluteFilePath( GetBrowserDir().Append(kArgbToI420ConverterExecutable)); - EXPECT_TRUE(file_util::PathExists(path_to_converter)) + EXPECT_TRUE(base::PathExists(path_to_converter)) << "Missing ARGB->I420 converter: should be in " << path_to_converter.value(); @@ -315,9 +315,9 @@ class WebrtcVideoQualityBrowserTest : public InProcessBrowserTest { base::FilePath path_to_compare_script = GetSourceDir().Append( FILE_PATH_LITERAL("third_party/webrtc/tools/compare_videos.py")); - EXPECT_TRUE(file_util::PathExists(path_to_analyzer)) + EXPECT_TRUE(base::PathExists(path_to_analyzer)) << "Missing frame analyzer: should be in " << path_to_analyzer.value(); - EXPECT_TRUE(file_util::PathExists(path_to_compare_script)) + EXPECT_TRUE(base::PathExists(path_to_compare_script)) << "Missing video compare script: should be in " << path_to_compare_script.value(); @@ -427,7 +427,7 @@ class WebrtcVideoQualityBrowserTest : public InProcessBrowserTest { base::FilePath peerconnection_server = GetBrowserDir().Append(kPeerConnectionServer); - EXPECT_TRUE(file_util::PathExists(peerconnection_server)) + EXPECT_TRUE(base::PathExists(peerconnection_server)) << "Missing peerconnection_server. You must build " "it so it ends up next to the browser test binary."; EXPECT_TRUE(base::LaunchProcess(CommandLine(peerconnection_server), diff --git a/chrome/browser/media/webrtc_log_uploader.cc b/chrome/browser/media/webrtc_log_uploader.cc index 81969ae..d9893b8 100644 --- a/chrome/browser/media/webrtc_log_uploader.cc +++ b/chrome/browser/media/webrtc_log_uploader.cc @@ -226,7 +226,7 @@ void WebRtcLogUploader::AddUploadedLogInfoToUploadListFile( const std::string& report_id) { std::string contents; - if (file_util::PathExists(upload_list_path_)) { + if (base::PathExists(upload_list_path_)) { bool read_ok = file_util::ReadFileToString(upload_list_path_, &contents); DPCHECK(read_ok); diff --git a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc index 40016a5..ea02812 100644 --- a/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc +++ b/chrome/browser/media_galleries/fileapi/itunes_finder_win.cc @@ -70,7 +70,7 @@ void ITunesFinderWin::TryDefaultLocation() { base::FilePath library_file = music_dir.AppendASCII("iTunes").AppendASCII("iTunes Music Library.xml"); - if (!file_util::PathExists(library_file)) { + if (!base::PathExists(library_file)) { PostResultToUIThread(std::string()); return; } @@ -81,7 +81,7 @@ void ITunesFinderWin::FinishedParsingPrefXML( const base::FilePath& library_file) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - if (library_file.empty() || !file_util::PathExists(library_file)) { + if (library_file.empty() || !base::PathExists(library_file)) { TryDefaultLocation(); return; } diff --git a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc index 2b16efe..c9e1d6f 100644 --- a/chrome/browser/media_galleries/fileapi/native_media_file_util.cc +++ b/chrome/browser/media_galleries/fileapi/native_media_file_util.cc @@ -630,7 +630,7 @@ NativeMediaFileUtil::GetFilteredLocalFilePathForExistingFileOrDirectory( if (error != base::PLATFORM_FILE_OK) return error; - if (!file_util::PathExists(file_path)) + if (!base::PathExists(file_path)) return failure_error; base::PlatformFileInfo file_info; if (!file_util::GetFileInfo(file_path, &file_info)) diff --git a/chrome/browser/nacl_host/nacl_file_host.cc b/chrome/browser/nacl_host/nacl_file_host.cc index cfdba1a..18efee9 100644 --- a/chrome/browser/nacl_host/nacl_file_host.cc +++ b/chrome/browser/nacl_host/nacl_file_host.cc @@ -108,7 +108,7 @@ void DoOpenPnaclFile( // PNaCl must be installed. base::FilePath pnacl_dir; if (!NaClBrowser::GetDelegate()->GetPnaclDirectory(&pnacl_dir) || - !file_util::PathExists(pnacl_dir)) { + !base::PathExists(pnacl_dir)) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&TryInstallPnacl, diff --git a/chrome/browser/net/net_log_temp_file.cc b/chrome/browser/net/net_log_temp_file.cc index c764d1f..00c1dc6 100644 --- a/chrome/browser/net/net_log_temp_file.cc +++ b/chrome/browser/net/net_log_temp_file.cc @@ -153,5 +153,5 @@ bool NetLogTempFile::GetNetExportLogDirectory(base::FilePath* path) { bool NetLogTempFile::NetExportLogExists() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE_USER_BLOCKING)); DCHECK(!log_path_.empty()); - return file_util::PathExists(log_path_); + return base::PathExists(log_path_); } diff --git a/chrome/browser/net/net_log_temp_file_unittest.cc b/chrome/browser/net/net_log_temp_file_unittest.cc index e77ecc5..3d062bf 100644 --- a/chrome/browser/net/net_log_temp_file_unittest.cc +++ b/chrome/browser/net/net_log_temp_file_unittest.cc @@ -93,7 +93,7 @@ class NetLogTempFileTest : public ::testing::Test { // constants will always be written to it on creation. void VerifyNetExportLog() { EXPECT_EQ(net_export_log_, net_log_temp_file_->log_path_); - EXPECT_TRUE(file_util::PathExists(net_export_log_)); + EXPECT_TRUE(base::PathExists(net_export_log_)); int64 file_size; // file_util::GetFileSize returns proper file size on open handles. @@ -142,7 +142,7 @@ class NetLogTempFileTest : public ::testing::Test { base::FilePath net_export_file_path; EXPECT_TRUE(net_log_temp_file_->GetFilePath(&net_export_file_path)); - EXPECT_TRUE(file_util::PathExists(net_export_file_path)); + EXPECT_TRUE(base::PathExists(net_export_file_path)); EXPECT_EQ(net_export_log_, net_export_file_path); VerifyNetExportLog(); @@ -187,11 +187,11 @@ TEST_F(NetLogTempFileTest, EnsureInitAllowStartOrSend) { EXPECT_EQ(NetLogTempFile::STATE_ALLOW_START_SEND, net_log_temp_file_->state()); EXPECT_EQ(net_export_log_, net_log_temp_file_->log_path_); - EXPECT_TRUE(file_util::PathExists(net_export_log_)); + EXPECT_TRUE(base::PathExists(net_export_log_)); base::FilePath net_export_file_path; EXPECT_TRUE(net_log_temp_file_->GetFilePath(&net_export_file_path)); - EXPECT_TRUE(file_util::PathExists(net_export_file_path)); + EXPECT_TRUE(base::PathExists(net_export_file_path)); EXPECT_EQ(net_export_log_, net_export_file_path); // GetFilePath should return false if NetExportLogExists() fails. diff --git a/chrome/browser/net/sqlite_server_bound_cert_store.cc b/chrome/browser/net/sqlite_server_bound_cert_store.cc index 865d911..84322675 100644 --- a/chrome/browser/net/sqlite_server_bound_cert_store.cc +++ b/chrome/browser/net/sqlite_server_bound_cert_store.cc @@ -200,7 +200,7 @@ void SQLiteServerBoundCertStore::Backend::LoadOnDBThread( // Ensure the parent directory for storing certs is created before reading // from it. const base::FilePath dir = path_.DirName(); - if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) + if (!base::PathExists(dir) && !file_util::CreateDirectory(dir)) return; int64 db_size = 0; diff --git a/chrome/browser/net/url_fixer_upper.cc b/chrome/browser/net/url_fixer_upper.cc index 6c82ba4..49671ac 100644 --- a/chrome/browser/net/url_fixer_upper.cc +++ b/chrome/browser/net/url_fixer_upper.cc @@ -107,7 +107,7 @@ bool ValidPathForFile(const base::FilePath::StringType& text, if (file_path.empty()) return false; - if (!file_util::PathExists(file_path)) + if (!base::PathExists(file_path)) return false; *full_path = file_path; diff --git a/chrome/browser/page_cycler/page_cycler.cc b/chrome/browser/page_cycler/page_cycler.cc index 0d10e08..8ca9326 100644 --- a/chrome/browser/page_cycler/page_cycler.cc +++ b/chrome/browser/page_cycler/page_cycler.cc @@ -92,7 +92,7 @@ void PageCycler::ReadURLsOnBackgroundThread() { std::string file_contents; std::vector<std::string> url_strings; - CHECK(file_util::PathExists(urls_file_)) << urls_file_.value(); + CHECK(base::PathExists(urls_file_)) << urls_file_.value(); file_util::ReadFileToString(urls_file_, &file_contents); base::SplitStringAlongWhitespace(file_contents, &url_strings); @@ -209,7 +209,7 @@ void PageCycler::WriteResultsOnBackgroundThread(const std::string& output) { if (!output.empty()) { CHECK(!stats_file_.empty()); - if (file_util::PathExists(stats_file_)) { + if (base::PathExists(stats_file_)) { VLOG(1) << "PageCycler: Previous stats file found; appending."; file_util::AppendToFile(stats_file_, output.c_str(), output.size()); } else { @@ -220,7 +220,7 @@ void PageCycler::WriteResultsOnBackgroundThread(const std::string& output) { if (!error_.empty()) { file_util::WriteFile(errors_file_, UTF16ToUTF8(error_).c_str(), error_.size()); - } else if (file_util::PathExists(errors_file_)) { + } else if (base::PathExists(errors_file_)) { // If there is an old error file, delete it to avoid confusion. base::Delete(errors_file_, false); } diff --git a/chrome/browser/page_cycler/page_cycler_browsertest.cc b/chrome/browser/page_cycler/page_cycler_browsertest.cc index f887001..656c687 100644 --- a/chrome/browser/page_cycler/page_cycler_browsertest.cc +++ b/chrome/browser/page_cycler/page_cycler_browsertest.cc @@ -51,9 +51,9 @@ class PageCyclerBrowserTest : public content::NotificationObserver, errors_file_ = temp_path.AppendASCII("errors"); stats_file_ = temp_path.AppendASCII("stats"); - ASSERT_FALSE(file_util::PathExists(urls_file_)); - ASSERT_FALSE(file_util::PathExists(errors_file_)); - ASSERT_FALSE(file_util::PathExists(stats_file_)); + ASSERT_FALSE(base::PathExists(urls_file_)); + ASSERT_FALSE(base::PathExists(errors_file_)); + ASSERT_FALSE(base::PathExists(stats_file_)); } // Initialize a PageCycler using either the base fields, or using provided @@ -152,17 +152,17 @@ class PageCyclerCachedBrowserTest : public PageCyclerBrowserTest { test_dir = test_dir.AppendASCII("page_cycler"); base::FilePath source_data_dir = test_dir.AppendASCII("cached_data_dir"); - CHECK(file_util::PathExists(source_data_dir)); + CHECK(base::PathExists(source_data_dir)); CHECK(user_data_dir_.CreateUniqueTempDir()); base::FilePath dest_data_dir = user_data_dir_.path().AppendASCII("cached_data_dir"); - CHECK(!file_util::PathExists(dest_data_dir)); + CHECK(!base::PathExists(dest_data_dir)); CHECK(base::CopyDirectory(source_data_dir, user_data_dir_.path(), true)); // recursive. - CHECK(file_util::PathExists(dest_data_dir)); + CHECK(base::PathExists(dest_data_dir)); command_line->AppendSwitchPath(switches::kUserDataDir, dest_data_dir); @@ -177,9 +177,9 @@ class PageCyclerCachedBrowserTest : public PageCyclerBrowserTest { errors_file_ = temp_path.AppendASCII("errors"); stats_file_ = temp_path.AppendASCII("stats"); - ASSERT_TRUE(file_util::PathExists(urls_file_)); - ASSERT_FALSE(file_util::PathExists(errors_file_)); - ASSERT_FALSE(file_util::PathExists(stats_file_)); + ASSERT_TRUE(base::PathExists(urls_file_)); + ASSERT_FALSE(base::PathExists(errors_file_)); + ASSERT_FALSE(base::PathExists(stats_file_)); } private: @@ -207,8 +207,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, BasicTest) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_FALSE(file_util::PathExists(errors_file())); - ASSERT_TRUE(file_util::PathExists(stats_file())); + ASSERT_FALSE(base::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); } // Test to make sure that PageCycler will recognize unvisitable URLs, and will @@ -236,8 +236,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, UnvisitableURL) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_TRUE(file_util::PathExists(errors_file())); - ASSERT_TRUE(file_util::PathExists(stats_file())); + ASSERT_TRUE(base::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); std::vector<std::string> errors = GetErrorsFromFile(); @@ -270,8 +270,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, InvalidURL) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_TRUE(file_util::PathExists(errors_file())); - ASSERT_TRUE(file_util::PathExists(stats_file())); + ASSERT_TRUE(base::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); std::vector<std::string> errors = GetErrorsFromFile(); ASSERT_EQ(1u, errors.size()); @@ -303,8 +303,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerBrowserTest, ChromeErrorURL) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_TRUE(file_util::PathExists(errors_file())); - ASSERT_TRUE(file_util::PathExists(stats_file())); + ASSERT_TRUE(base::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); std::vector<std::string> errors = GetErrorsFromFile(); ASSERT_EQ(1u, errors.size()); @@ -343,8 +343,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, DISABLED_PlaybackMode) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_TRUE(file_util::PathExists(stats_file())); - ASSERT_FALSE(file_util::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); + ASSERT_FALSE(base::PathExists(errors_file())); } #endif // !defined(OS_CHROMEOS) @@ -374,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, MAYBE_URLNotInCache) { // other URLs. base::FilePath new_urls_file = temp.path().AppendASCII("urls"); - ASSERT_FALSE(file_util::PathExists(new_urls_file)); + ASSERT_FALSE(base::PathExists(new_urls_file)); ASSERT_TRUE(file_util::WriteFile(new_urls_file, kCacheMissURL, sizeof(kCacheMissURL))); @@ -383,8 +383,8 @@ IN_PROC_BROWSER_TEST_F(PageCyclerCachedBrowserTest, MAYBE_URLNotInCache) { page_cycler()->Run(); content::RunMessageLoop(); - ASSERT_TRUE(file_util::PathExists(errors_file())); - ASSERT_TRUE(file_util::PathExists(stats_file())); + ASSERT_TRUE(base::PathExists(errors_file())); + ASSERT_TRUE(base::PathExists(stats_file())); std::vector<std::string> errors = GetErrorsFromFile(); ASSERT_EQ(1u, errors.size()); diff --git a/chrome/browser/page_cycler/page_cycler_unittest.cc b/chrome/browser/page_cycler/page_cycler_unittest.cc index f46bf09..eef3eb8 100644 --- a/chrome/browser/page_cycler/page_cycler_unittest.cc +++ b/chrome/browser/page_cycler/page_cycler_unittest.cc @@ -30,7 +30,7 @@ using content::RenderViewHost; using content::TestBrowserThread; using content::WebContentsObserver; using file_util::ContentsEqual; -using file_util::PathExists; +using base::PathExists; namespace { const int kFrameID = 1; @@ -122,8 +122,8 @@ class PageCyclerTest : public BrowserWithTestWindowTest { errors_file_ = temp_path.AppendASCII("errors_file"); stats_file_ = temp_path.AppendASCII("stats_file"); - CHECK(!file_util::PathExists(errors_file_)); - CHECK(!file_util::PathExists(stats_file_)); + CHECK(!base::PathExists(errors_file_)); + CHECK(!base::PathExists(stats_file_)); } void FailProvisionalLoad(int error_code, string16& error_description) { diff --git a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc index c5aac77..b5fa1803 100644 --- a/chrome/browser/performance_monitor/performance_monitor_browsertest.cc +++ b/chrome/browser/performance_monitor/performance_monitor_browsertest.cc @@ -307,12 +307,12 @@ class PerformanceMonitorUncleanExitBrowserTest PathService::Get(chrome::DIR_TEST_DATA, &stock_prefs_file); stock_prefs_file = stock_prefs_file.AppendASCII("performance_monitor") .AppendASCII("unclean_exit_prefs"); - CHECK(file_util::PathExists(stock_prefs_file)); + CHECK(base::PathExists(stock_prefs_file)); base::FilePath first_profile_prefs_file = first_profile.Append(chrome::kPreferencesFilename); CHECK(base::CopyFile(stock_prefs_file, first_profile_prefs_file)); - CHECK(file_util::PathExists(first_profile_prefs_file)); + CHECK(base::PathExists(first_profile_prefs_file)); second_profile_name_ = std::string(chrome::kMultiProfileDirPrefix) @@ -325,7 +325,7 @@ class PerformanceMonitorUncleanExitBrowserTest base::FilePath second_profile_prefs_file = second_profile.Append(chrome::kPreferencesFilename); CHECK(base::CopyFile(stock_prefs_file, second_profile_prefs_file)); - CHECK(file_util::PathExists(second_profile_prefs_file)); + CHECK(base::PathExists(second_profile_prefs_file)); return true; } diff --git a/chrome/browser/policy/cloud/user_cloud_policy_store.cc b/chrome/browser/policy/cloud/user_cloud_policy_store.cc index 1381d98..30e00dc 100644 --- a/chrome/browser/policy/cloud/user_cloud_policy_store.cc +++ b/chrome/browser/policy/cloud/user_cloud_policy_store.cc @@ -51,7 +51,7 @@ const base::FilePath::CharType kPolicyCacheFile[] = policy::PolicyLoadResult LoadPolicyFromDisk(const base::FilePath& path) { policy::PolicyLoadResult result; // If the backing file does not exist, just return. - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { result.status = policy::LOAD_RESULT_NO_POLICY_FILE; return result; } diff --git a/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc b/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc index 671f914..1f5b21e 100644 --- a/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc +++ b/chrome/browser/policy/cloud/user_cloud_policy_store_unittest.cc @@ -199,14 +199,14 @@ TEST_F(UserCloudPolicyStoreTest, StoreThenClear) { EXPECT_FALSE(store_->policy_map().empty()); // Policy file should exist. - ASSERT_TRUE(file_util::PathExists(policy_file())); + ASSERT_TRUE(base::PathExists(policy_file())); EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); store_->Clear(); RunUntilIdle(); // Policy file should not exist. - ASSERT_TRUE(!file_util::PathExists(policy_file())); + ASSERT_TRUE(!base::PathExists(policy_file())); // Policy should be gone. EXPECT_FALSE(store_->policy()); diff --git a/chrome/browser/policy/policy_browsertest.cc b/chrome/browser/policy/policy_browsertest.cc index ad812a6..a93280c 100644 --- a/chrome/browser/policy/policy_browsertest.cc +++ b/chrome/browser/policy/policy_browsertest.cc @@ -287,14 +287,14 @@ void DownloadAndVerifyFile( content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); base::FilePath downloaded = dir.Append(file); - EXPECT_FALSE(file_util::PathExists(downloaded)); + EXPECT_FALSE(base::PathExists(downloaded)); ui_test_utils::NavigateToURLWithDisposition( browser, url, CURRENT_TAB, ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); observer.WaitForFinished(); EXPECT_EQ( 1u, observer.NumDownloadsSeenInState(content::DownloadItem::COMPLETE)); - EXPECT_TRUE(file_util::PathExists(downloaded)); + EXPECT_TRUE(base::PathExists(downloaded)); base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES); EXPECT_EQ(file, enumerator.Next().BaseName()); EXPECT_EQ(base::FilePath(), enumerator.Next()); @@ -1127,7 +1127,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { // Verify that the test page exists. It is only present in checkouts with // src-internal. - if (!file_util::PathExists(ui_test_utils::GetTestFilePath( + if (!base::PathExists(ui_test_utils::GetTestFilePath( base::FilePath(FILE_PATH_LITERAL("plugin")), base::FilePath(FILE_PATH_LITERAL("quicktime.html"))))) { LOG(INFO) << @@ -1249,7 +1249,7 @@ IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { UpdateProviderPolicy(policies); DownloadAndVerifyFile(browser(), forced_dir.path(), file); // Verify that the first download location wasn't affected. - EXPECT_FALSE(file_util::PathExists(initial_dir.path().Append(file))); + EXPECT_FALSE(base::PathExists(initial_dir.path().Append(file))); } #endif diff --git a/chrome/browser/policy/policy_loader_win.cc b/chrome/browser/policy/policy_loader_win.cc index 947d70c..e52a866 100644 --- a/chrome/browser/policy/policy_loader_win.cc +++ b/chrome/browser/policy/policy_loader_win.cc @@ -583,12 +583,12 @@ bool PolicyLoaderWin::ReadPRegFile(const base::FilePath& preg_file, // access to the %WINDIR%/System32/GroupPolicy directory to // %WINDIR%/SysWOW64/GroupPolicy, but the file is actually in the // system-native directory. - if (file_util::PathExists(preg_file)) { + if (base::PathExists(preg_file)) { return preg_parser::ReadFile(preg_file, chrome_policy_key_, policy, status); } else { // Try with redirection switched off. ScopedDisableWow64Redirection redirection_disable; - if (redirection_disable.is_active() && file_util::PathExists(preg_file)) { + if (redirection_disable.is_active() && base::PathExists(preg_file)) { status->Add(POLICY_LOAD_STATUS_WOW64_REDIRECTION_DISABLED); return preg_parser::ReadFile(preg_file, chrome_policy_key_, policy, status); diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc index 801ca67..683ffa5 100644 --- a/chrome/browser/prefs/chrome_pref_service_unittest.cc +++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc @@ -67,7 +67,7 @@ class ChromePrefServiceUserFilePrefsTest : public testing::Test { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("pref_service"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(base::PathExists(data_dir_)); } void ClearListValue(PrefService* prefs, const char* key) { @@ -137,7 +137,7 @@ TEST_F(ChromePrefServiceUserFilePrefsTest, PreserveEmptyValue) { // Compare to expected output. base::FilePath golden_output_file = data_dir_.AppendASCII("write.golden.need_empty_value.json"); - ASSERT_TRUE(file_util::PathExists(golden_output_file)); + ASSERT_TRUE(base::PathExists(golden_output_file)); EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); } diff --git a/chrome/browser/prefs/pref_service_browsertest.cc b/chrome/browser/prefs/pref_service_browsertest.cc index c2bcf0f..fc1ba42 100644 --- a/chrome/browser/prefs/pref_service_browsertest.cc +++ b/chrome/browser/prefs/pref_service_browsertest.cc @@ -77,7 +77,7 @@ class PreferenceServiceTest : public InProcessBrowserTest { tmp_pref_file_ = user_data_directory.Append(chrome::kLocalStateFilename); } - CHECK(file_util::PathExists(reference_pref_file)); + CHECK(base::PathExists(reference_pref_file)); // Copy only the Preferences file if |new_profile_|, or Local State if not, // and the rest will be automatically created. CHECK(base::CopyFile(reference_pref_file, tmp_pref_file_)); diff --git a/chrome/browser/printing/printing_layout_browsertest.cc b/chrome/browser/printing/printing_layout_browsertest.cc index 2ce4ffc..4ac0aaf 100644 --- a/chrome/browser/printing/printing_layout_browsertest.cc +++ b/chrome/browser/printing/printing_layout_browsertest.cc @@ -127,7 +127,7 @@ class PrintingLayoutTest : public PrintingTest<InProcessBrowserTest>, base::FilePath cleartype( base_path.Append(verification_name + L"_cleartype.png")); // Looks for Cleartype override. - if (file_util::PathExists(cleartype) && IsClearTypeEnabled()) + if (base::PathExists(cleartype) && IsClearTypeEnabled()) png = cleartype; if (GenerateFiles()) { diff --git a/chrome/browser/profiles/profile_browsertest.cc b/chrome/browser/profiles/profile_browsertest.cc index 19a7e0d..fdfc583 100644 --- a/chrome/browser/profiles/profile_browsertest.cc +++ b/chrome/browser/profiles/profile_browsertest.cc @@ -163,7 +163,7 @@ IN_PROC_BROWSER_TEST_F(ProfileBrowserTest, DISABLED_ProfileReadmeCreated) { content::RunAllPendingInMessageLoop(content::BrowserThread::FILE); // Verify that README exists. - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists( temp_dir.path().Append(chrome::kReadmeFilename))); } diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc index 7123d16..09e414b 100644 --- a/chrome/browser/profiles/profile_impl.cc +++ b/chrome/browser/profiles/profile_impl.cc @@ -202,7 +202,7 @@ base::FilePath GetMediaCachePath(const base::FilePath& base) { void EnsureReadmeFile(const base::FilePath& base) { base::FilePath readme_path = base.Append(chrome::kReadmeFilename); - if (file_util::PathExists(readme_path)) + if (base::PathExists(readme_path)) return; std::string product_name = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME); std::string readme_text = base::StringPrintf( @@ -253,7 +253,7 @@ Profile* Profile::CreateProfile(const base::FilePath& path, DCHECK(delegate); CreateProfileDirectory(sequenced_task_runner.get(), path); } else if (create_mode == CREATE_MODE_SYNCHRONOUS) { - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { // TODO(tc): http://b/1094718 Bad things happen if we can't write to the // profile directory. We should eventually be able to run in this // situation. diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc index dd46660..82e3f81 100644 --- a/chrome/browser/profiles/profile_manager_unittest.cc +++ b/chrome/browser/profiles/profile_manager_unittest.cc @@ -66,7 +66,7 @@ class ProfileManager : public ::ProfileManagerWithoutInit { protected: virtual Profile* CreateProfileHelper( const base::FilePath& file_path) OVERRIDE { - if (!file_util::PathExists(file_path)) { + if (!base::PathExists(file_path)) { if (!file_util::CreateDirectory(file_path)) return NULL; } diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc index 22275db..ac31a6a 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc @@ -73,7 +73,7 @@ class ProfileShortcutManagerTest : public testing::Test { ASSERT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_name)); const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); - ASSERT_FALSE(file_util::PathExists(icon_path)); + ASSERT_FALSE(base::PathExists(icon_path)); } } @@ -121,7 +121,7 @@ class ProfileShortcutManagerTest : public testing::Test { // Returns true if the shortcut for this profile exists. bool ProfileShortcutExistsAtDefaultPath(const string16& profile_name) { - return file_util::PathExists( + return base::PathExists( GetDefaultShortcutPathForProfile(profile_name)); } @@ -130,12 +130,12 @@ class ProfileShortcutManagerTest : public testing::Test { void ValidateProfileShortcutAtPath(const tracked_objects::Location& location, const base::FilePath& shortcut_path, const base::FilePath& profile_path) { - EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString(); + EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString(); // Ensure that the corresponding icon exists. const base::FilePath icon_path = profile_path.AppendASCII(profiles::internal::kProfileIconFileName); - EXPECT_TRUE(file_util::PathExists(icon_path)) << location.ToString(); + EXPECT_TRUE(base::PathExists(icon_path)) << location.ToString(); base::win::ShortcutProperties expected_properties; expected_properties.set_app_id( @@ -161,7 +161,7 @@ class ProfileShortcutManagerTest : public testing::Test { void ValidateNonProfileShortcutAtPath( const tracked_objects::Location& location, const base::FilePath& shortcut_path) { - EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString(); + EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString(); base::win::ShortcutProperties expected_properties; expected_properties.set_target(GetExePath()); @@ -197,7 +197,7 @@ class ProfileShortcutManagerTest : public testing::Test { const string16& shortcut_name) { const base::FilePath shortcut_path = GetUserShortcutsDirectory().Append(shortcut_name + installer::kLnkExt); - EXPECT_FALSE(file_util::PathExists(shortcut_path)) << location.ToString(); + EXPECT_FALSE(base::PathExists(shortcut_path)) << location.ToString(); installer::Product product(GetDistribution()); ShellUtil::ShortcutProperties properties(ShellUtil::CURRENT_USER); @@ -206,7 +206,7 @@ class ProfileShortcutManagerTest : public testing::Test { EXPECT_TRUE(ShellUtil::CreateOrUpdateShortcut( ShellUtil::SHORTCUT_LOCATION_DESKTOP, GetDistribution(), properties, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)) << location.ToString(); - EXPECT_TRUE(file_util::PathExists(shortcut_path)) << location.ToString(); + EXPECT_TRUE(base::PathExists(shortcut_path)) << location.ToString(); return shortcut_path; } @@ -223,7 +223,7 @@ class ProfileShortcutManagerTest : public testing::Test { const base::FilePath system_level_shortcut_path = GetSystemShortcutsDirectory().Append( distribution->GetAppShortCutName() + installer::kLnkExt); - EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)) + EXPECT_TRUE(base::PathExists(system_level_shortcut_path)) << location.ToString(); return system_level_shortcut_path; } @@ -392,8 +392,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) { // Delete the shortcut for the first profile, but keep the one for the 2nd. ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false)); - ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_1_shortcut_path)); + ASSERT_TRUE(base::PathExists(profile_2_shortcut_path)); // Delete the profile that doesn't have a shortcut. profile_info_cache_->DeleteProfileFromCache(profile_1_path_); @@ -402,8 +402,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithoutShortcut) { // Verify that the remaining shortcut does not have a profile name. ValidateNonProfileShortcut(FROM_HERE); // Verify that shortcuts with profile names do not exist. - EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_1_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path)); } TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) { @@ -416,8 +416,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) { // Delete the shortcut for the first profile, but keep the one for the 2nd. ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false)); - ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_1_shortcut_path)); + ASSERT_TRUE(base::PathExists(profile_2_shortcut_path)); // Delete the profile that has a shortcut. profile_info_cache_->DeleteProfileFromCache(profile_2_path_); @@ -426,8 +426,8 @@ TEST_F(ProfileShortcutManagerTest, DeleteSecondToLastProfileWithShortcut) { // Verify that the remaining shortcut does not have a profile name. ValidateNonProfileShortcut(FROM_HERE); // Verify that shortcuts with profile names do not exist. - EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_1_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path)); } TEST_F(ProfileShortcutManagerTest, DeleteOnlyProfileWithShortcuts) { @@ -448,19 +448,19 @@ TEST_F(ProfileShortcutManagerTest, DeleteOnlyProfileWithShortcuts) { ASSERT_TRUE(base::Delete(profile_2_shortcut_path, false)); // Only the shortcut to the third profile should exist. - ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - ASSERT_FALSE(file_util::PathExists(profile_2_shortcut_path)); - ASSERT_FALSE(file_util::PathExists(non_profile_shortcut_path)); - ASSERT_TRUE(file_util::PathExists(profile_3_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_1_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_2_shortcut_path)); + ASSERT_FALSE(base::PathExists(non_profile_shortcut_path)); + ASSERT_TRUE(base::PathExists(profile_3_shortcut_path)); // Delete the third profile and check that its shortcut is gone and no // shortcuts have been re-created. profile_info_cache_->DeleteProfileFromCache(profile_3_path_); RunPendingTasks(); - ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - ASSERT_FALSE(file_util::PathExists(profile_2_shortcut_path)); - ASSERT_FALSE(file_util::PathExists(profile_3_shortcut_path)); - ASSERT_FALSE(file_util::PathExists(non_profile_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_1_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_2_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_3_shortcut_path)); + ASSERT_FALSE(base::PathExists(non_profile_shortcut_path)); } TEST_F(ProfileShortcutManagerTest, DesktopShortcutsCreateSecond) { @@ -504,7 +504,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcuts) { // Delete the renamed shortcut and try to create it again, which should work. ASSERT_TRUE(base::Delete(profile_2_shortcut_path_2, false)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_2)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_2)); profile_shortcut_manager_->CreateProfileShortcut(profile_2_path_); RunPendingTasks(); ValidateProfileShortcut(FROM_HERE, profile_2_name_, profile_2_path_); @@ -531,13 +531,13 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsGetDeleted) { ASSERT_TRUE(base::CopyFile( GetDefaultShortcutPathForProfile(profile_1_name_), preserved_profile_1_shortcut_path)); - EXPECT_TRUE(file_util::PathExists(preserved_profile_1_shortcut_path)); + EXPECT_TRUE(base::PathExists(preserved_profile_1_shortcut_path)); // Delete the profile and ensure both shortcuts were also deleted. profile_info_cache_->DeleteProfileFromCache(profile_2_path_); RunPendingTasks(); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_1)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_2)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_1)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_2)); ValidateNonProfileShortcutAtPath(FROM_HERE, preserved_profile_1_shortcut_path); } @@ -563,7 +563,7 @@ TEST_F(ProfileShortcutManagerTest, RenamedDesktopShortcutsAfterProfileRename) { // The original shortcut should be renamed but the copied shortcut should // keep its name. - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path_1)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path_1)); ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2, profile_2_path_); ValidateProfileShortcut(FROM_HERE, new_profile_2_name, profile_2_path_); @@ -583,7 +583,7 @@ TEST_F(ProfileShortcutManagerTest, UpdateShortcutWithNoFlags) { // Add another profile and check that the shortcut was replaced with // a badged shortcut with the right command line for the profile CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_); - EXPECT_FALSE(file_util::PathExists(regular_shortcut_path)); + EXPECT_FALSE(base::PathExists(regular_shortcut_path)); ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_); } @@ -603,7 +603,7 @@ TEST_F(ProfileShortcutManagerTest, UpdateTwoShortcutsWithNoFlags) { // Add another profile and check that one shortcut was renamed and that the // other shortcut was updated but kept the same name. CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_); - EXPECT_FALSE(file_util::PathExists(regular_shortcut_path)); + EXPECT_FALSE(base::PathExists(regular_shortcut_path)); ValidateProfileShortcutAtPath(FROM_HERE, customized_regular_shortcut_path, profile_1_path_); ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_); @@ -636,8 +636,8 @@ TEST_F(ProfileShortcutManagerTest, RemoveProfileShortcuts) { // shortcuts for profile 2 were kept. profile_shortcut_manager_->RemoveProfileShortcuts(profile_1_path_); RunPendingTasks(); - EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path_1)); - EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path_2)); + EXPECT_FALSE(base::PathExists(profile_1_shortcut_path_1)); + EXPECT_FALSE(base::PathExists(profile_1_shortcut_path_2)); ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_1, profile_2_path_); ValidateProfileShortcutAtPath(FROM_HERE, profile_2_shortcut_path_2, @@ -665,7 +665,7 @@ TEST_F(ProfileShortcutManagerTest, HasProfileShortcuts) { const base::FilePath profile_2_shortcut_path = GetDefaultShortcutPathForProfile(profile_2_name_); ASSERT_TRUE(base::Delete(profile_2_shortcut_path, false)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path)); profile_shortcut_manager_->HasProfileShortcuts(profile_2_path_, callback); RunPendingTasks(); EXPECT_FALSE(result.has_shortcuts); @@ -682,8 +682,8 @@ TEST_F(ProfileShortcutManagerTest, ProfileShortcutsWithSystemLevelShortcut) { ASSERT_EQ(1U, profile_info_cache_->GetNumberOfProfiles()); // Ensure system-level continues to exist and user-level was not created. - EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); - EXPECT_FALSE(file_util::PathExists( + EXPECT_TRUE(base::PathExists(system_level_shortcut_path)); + EXPECT_FALSE(base::PathExists( GetDefaultShortcutPathForProfile(string16()))); // Create another profile with a shortcut and ensure both profiles receive @@ -691,7 +691,7 @@ TEST_F(ProfileShortcutManagerTest, ProfileShortcutsWithSystemLevelShortcut) { CreateProfileWithShortcut(FROM_HERE, profile_2_name_, profile_2_path_); ValidateProfileShortcut(FROM_HERE, profile_1_name_, profile_1_path_); ValidateProfileShortcut(FROM_HERE, profile_2_name_, profile_2_path_); - EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); + EXPECT_TRUE(base::PathExists(system_level_shortcut_path)); // Create a third profile without a shortcut and ensure it doesn't get one. profile_info_cache_->AddProfileToCache(profile_3_path_, profile_3_name_, @@ -736,7 +736,7 @@ TEST_F(ProfileShortcutManagerTest, profile_info_cache_->DeleteProfileFromCache(profile_1_path_); RunPendingTasks(); - EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); + EXPECT_TRUE(base::PathExists(system_level_shortcut_path)); EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(string16())); EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_1_name_)); EXPECT_FALSE(ProfileShortcutExistsAtDefaultPath(profile_2_name_)); @@ -753,8 +753,8 @@ TEST_F(ProfileShortcutManagerTest, // Delete the shortcut for the first profile, but keep the one for the 2nd. ASSERT_TRUE(base::Delete(profile_1_shortcut_path, false)); - ASSERT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - ASSERT_TRUE(file_util::PathExists(profile_2_shortcut_path)); + ASSERT_FALSE(base::PathExists(profile_1_shortcut_path)); + ASSERT_TRUE(base::PathExists(profile_2_shortcut_path)); const base::FilePath system_level_shortcut_path = CreateRegularSystemLevelShortcut(FROM_HERE); @@ -766,9 +766,9 @@ TEST_F(ProfileShortcutManagerTest, RunPendingTasks(); // Verify that only the system-level shortcut still exists. - EXPECT_TRUE(file_util::PathExists(system_level_shortcut_path)); - EXPECT_FALSE(file_util::PathExists( + EXPECT_TRUE(base::PathExists(system_level_shortcut_path)); + EXPECT_FALSE(base::PathExists( GetDefaultShortcutPathForProfile(string16()))); - EXPECT_FALSE(file_util::PathExists(profile_1_shortcut_path)); - EXPECT_FALSE(file_util::PathExists(profile_2_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_1_shortcut_path)); + EXPECT_FALSE(base::PathExists(profile_2_shortcut_path)); } diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc index 296fb28..b0a0937 100644 --- a/chrome/browser/profiles/profile_shortcut_manager_win.cc +++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc @@ -286,12 +286,12 @@ void RenameChromeDesktopShortcutForProfile( const base::FilePath new_shortcut_path = user_shortcuts_directory.Append(new_shortcut_filename); - if (file_util::PathExists(old_shortcut_path)) { + if (base::PathExists(old_shortcut_path)) { // Rename the old shortcut unless a system-level shortcut exists at the // destination, in which case the old shortcut is simply deleted. const base::FilePath possible_new_system_shortcut = system_shortcuts_directory.Append(new_shortcut_filename); - if (file_util::PathExists(possible_new_system_shortcut)) + if (base::PathExists(possible_new_system_shortcut)) base::Delete(old_shortcut_path, false); else if (!RenameDesktopShortcut(old_shortcut_path, new_shortcut_path)) DLOG(ERROR) << "Could not rename Windows profile desktop shortcut."; @@ -304,7 +304,7 @@ void RenameChromeDesktopShortcutForProfile( // properties updated by |CreateOrUpdateDesktopShortcutsForProfile()|. const base::FilePath possible_old_system_shortcut = system_shortcuts_directory.Append(old_shortcut_filename); - if (file_util::PathExists(possible_old_system_shortcut)) + if (base::PathExists(possible_old_system_shortcut)) base::CopyFile(possible_old_system_shortcut, new_shortcut_path); } } diff --git a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc index a21b285..39380db 100644 --- a/chrome/browser/renderer_host/pepper/device_id_fetcher.cc +++ b/chrome/browser/renderer_host/pepper/device_id_fetcher.cc @@ -167,7 +167,7 @@ void DeviceIDFetcher::ComputeOnBlockingPool(const base::FilePath& profile_path, // First check if the legacy device ID file exists on ChromeOS. If it does, we // should just return that. base::FilePath id_path = GetLegacyDeviceIDPath(profile_path); - if (file_util::PathExists(id_path)) { + if (base::PathExists(id_path)) { if (file_util::ReadFileToString(id_path, &id) && !id.empty()) { RunCallbackOnIOThread(id); return; diff --git a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc index a912a3f..167e622 100644 --- a/chrome/browser/safe_browsing/download_feedback_service_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_service_unittest.cc @@ -229,7 +229,7 @@ TEST_F(DownloadFeedbackServiceTest, SingleFeedbackComplete) { // File should still exist since our FakeDownloadFeedback does not delete it. base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(file_path)); + EXPECT_TRUE(base::PathExists(file_path)); } TEST_F(DownloadFeedbackServiceTest, MultiplePendingFeedbackComplete) { @@ -296,9 +296,9 @@ TEST_F(DownloadFeedbackServiceTest, MultiplePendingFeedbackComplete) { base::RunLoop().RunUntilIdle(); // These files should still exist since the FakeDownloadFeedback does not // delete them. - EXPECT_TRUE(file_util::PathExists(file_path[0])); - EXPECT_TRUE(file_util::PathExists(file_path[1])); - EXPECT_TRUE(file_util::PathExists(file_path[2])); + EXPECT_TRUE(base::PathExists(file_path[0])); + EXPECT_TRUE(base::PathExists(file_path[1])); + EXPECT_TRUE(base::PathExists(file_path[2])); } TEST_F(DownloadFeedbackServiceTest, MultiFeedbackWithIncomplete) { @@ -361,17 +361,17 @@ TEST_F(DownloadFeedbackServiceTest, MultiFeedbackWithIncomplete) { EXPECT_EQ(2U, num_feedbacks()); // File should still exist since the FileUtilProxy task hasn't run yet. - EXPECT_TRUE(file_util::PathExists(file_path[2])); + EXPECT_TRUE(base::PathExists(file_path[2])); base::RunLoop().RunUntilIdle(); // File should be deleted since the AcquireFileCallback ran after the service // was deleted. - EXPECT_FALSE(file_util::PathExists(file_path[2])); + EXPECT_FALSE(base::PathExists(file_path[2])); // These files should still exist since the FakeDownloadFeedback does not // delete them. - EXPECT_TRUE(file_util::PathExists(file_path[0])); - EXPECT_TRUE(file_util::PathExists(file_path[1])); + EXPECT_TRUE(base::PathExists(file_path[0])); + EXPECT_TRUE(base::PathExists(file_path[1])); } } // namespace safe_browsing diff --git a/chrome/browser/safe_browsing/download_feedback_unittest.cc b/chrome/browser/safe_browsing/download_feedback_unittest.cc index 0054a69..3edc8bd 100644 --- a/chrome/browser/safe_browsing/download_feedback_unittest.cc +++ b/chrome/browser/safe_browsing/download_feedback_unittest.cc @@ -192,14 +192,14 @@ TEST_F(DownloadFeedbackTest, CompleteUpload) { uploader()->metadata_); EXPECT_EQ(kTestFeedbackURL, uploader()->base_url_.spec()); - EXPECT_TRUE(file_util::PathExists(upload_file_path_)); + EXPECT_TRUE(base::PathExists(upload_file_path_)); EXPECT_FALSE(feedback_finish_called_); uploader()->finish_callback_.Run( TwoPhaseUploader::STATE_SUCCESS, net::OK, 0, ""); EXPECT_TRUE(feedback_finish_called_); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(upload_file_path_)); + EXPECT_FALSE(base::PathExists(upload_file_path_)); } TEST_F(DownloadFeedbackTest, CancelUpload) { @@ -230,13 +230,13 @@ TEST_F(DownloadFeedbackTest, CancelUpload) { ASSERT_TRUE(uploader()); EXPECT_FALSE(feedback_finish_called_); EXPECT_TRUE(uploader()->start_called_); - EXPECT_TRUE(file_util::PathExists(upload_file_path_)); + EXPECT_TRUE(base::PathExists(upload_file_path_)); delete feedback; EXPECT_FALSE(feedback_finish_called_); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(upload_file_path_)); + EXPECT_FALSE(base::PathExists(upload_file_path_)); } } // namespace safe_browsing diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc index 3b61ce7..b81e0b0 100644 --- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc @@ -1126,7 +1126,7 @@ TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) { database_->UpdateFinished(true); // Database file still exists until the corruption handler has run. - EXPECT_TRUE(file_util::PathExists(database_filename_)); + EXPECT_TRUE(base::PathExists(database_filename_)); // Flush through the corruption-handler task. VLOG(1) << "Expect failed check on: SafeBrowsing database reset"; @@ -1134,13 +1134,13 @@ TEST_F(SafeBrowsingDatabaseTest, DISABLED_FileCorruptionHandling) { } // Database file should not exist. - EXPECT_FALSE(file_util::PathExists(database_filename_)); + EXPECT_FALSE(base::PathExists(database_filename_)); // Run the update again successfully. EXPECT_TRUE(database_->UpdateStarted(&lists)); database_->InsertChunks(safe_browsing_util::kMalwareList, chunks); database_->UpdateFinished(true); - EXPECT_TRUE(file_util::PathExists(database_filename_)); + EXPECT_TRUE(base::PathExists(database_filename_)); database_.reset(); } @@ -1647,7 +1647,7 @@ TEST_F(SafeBrowsingDatabaseTest, FilterFile) { // After re-creating the database, it should have a filter read from // a file, so it should find the same results. - ASSERT_TRUE(file_util::PathExists(filter_file)); + ASSERT_TRUE(base::PathExists(filter_file)); database_.reset(new SafeBrowsingDatabaseNew); database_->Init(database_filename_); EXPECT_TRUE(database_->ContainsBrowseUrl( @@ -1659,7 +1659,7 @@ TEST_F(SafeBrowsingDatabaseTest, FilterFile) { // If there is no filter file, the database cannot find malware urls. base::Delete(filter_file, false); - ASSERT_FALSE(file_util::PathExists(filter_file)); + ASSERT_FALSE(base::PathExists(filter_file)); database_.reset(new SafeBrowsingDatabaseNew); database_->Init(database_filename_); EXPECT_FALSE(database_->ContainsBrowseUrl( diff --git a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc index a435585..1cdc96c 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc @@ -895,7 +895,7 @@ class SafeBrowsingDatabaseManagerCookieTest : public InProcessBrowserTest { virtual bool SetUpUserDataDirectory() OVERRIDE { base::FilePath cookie_path( SafeBrowsingService::GetCookieFilePathForTesting()); - EXPECT_FALSE(file_util::PathExists(cookie_path)); + EXPECT_FALSE(base::PathExists(cookie_path)); base::FilePath test_dir; if (!PathService::Get(chrome::DIR_TEST_DATA, &test_dir)) { diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file.cc b/chrome/browser/safe_browsing/safe_browsing_store_file.cc index 234716c..50cacb3 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file.cc @@ -179,7 +179,7 @@ void SafeBrowsingStoreFile::CheckForOriginalAndDelete( const base::FilePath& current_filename) { const base::FilePath original_filename( current_filename.DirName().AppendASCII("Safe Browsing")); - if (file_util::PathExists(original_filename)) { + if (base::PathExists(original_filename)) { int64 size = 0; if (file_util::GetFileSize(original_filename, &size)) { UMA_HISTOGRAM_COUNTS("SB2.OldDatabaseKilobytes", @@ -406,7 +406,7 @@ bool SafeBrowsingStoreFile::BeginUpdate() { if (empty_) { // If the file exists but cannot be opened, try to delete it (not // deleting directly, the bloom filter needs to be deleted, too). - if (file_util::PathExists(filename_)) + if (base::PathExists(filename_)) return OnCorruptDatabase(); new_file_.swap(new_file); @@ -655,7 +655,7 @@ bool SafeBrowsingStoreFile::DoUpdate( // Close the file handle and swizzle the file into place. new_file_.reset(); if (!base::Delete(filename_, false) && - file_util::PathExists(filename_)) + base::PathExists(filename_)) return false; const base::FilePath new_filename = TemporaryFileForFilename(filename_); @@ -736,14 +736,14 @@ void SafeBrowsingStoreFile::DeleteSubChunk(int32 chunk_id) { // static bool SafeBrowsingStoreFile::DeleteStore(const base::FilePath& basename) { if (!base::Delete(basename, false) && - file_util::PathExists(basename)) { + base::PathExists(basename)) { NOTREACHED(); return false; } const base::FilePath new_filename = TemporaryFileForFilename(basename); if (!base::Delete(new_filename, false) && - file_util::PathExists(new_filename)) { + base::PathExists(new_filename)) { NOTREACHED(); return false; } @@ -753,7 +753,7 @@ bool SafeBrowsingStoreFile::DeleteStore(const base::FilePath& basename) { // also removed. const base::FilePath journal_filename( basename.value() + FILE_PATH_LITERAL("-journal")); - if (file_util::PathExists(journal_filename)) + if (base::PathExists(journal_filename)) base::Delete(journal_filename, false); return true; diff --git a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc index 89eec6f..3470736 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_file_unittest.cc @@ -57,24 +57,24 @@ TEST_F(SafeBrowsingStoreFileTest, DeleteTemp) { const base::FilePath temp_file = SafeBrowsingStoreFile::TemporaryFileForFilename(filename_); - EXPECT_FALSE(file_util::PathExists(filename_)); - EXPECT_FALSE(file_util::PathExists(temp_file)); + EXPECT_FALSE(base::PathExists(filename_)); + EXPECT_FALSE(base::PathExists(temp_file)); // Starting a transaction creates a temporary file. EXPECT_TRUE(store_->BeginUpdate()); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); // Pull the rug out from under the existing store, simulating a // crash. store_.reset(new SafeBrowsingStoreFile()); store_->Init(filename_, base::Closure()); - EXPECT_FALSE(file_util::PathExists(filename_)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_FALSE(base::PathExists(filename_)); + EXPECT_TRUE(base::PathExists(temp_file)); // Make sure the temporary file is deleted. EXPECT_TRUE(store_->Delete()); - EXPECT_FALSE(file_util::PathExists(filename_)); - EXPECT_FALSE(file_util::PathExists(temp_file)); + EXPECT_FALSE(base::PathExists(filename_)); + EXPECT_FALSE(base::PathExists(temp_file)); } // Test basic corruption-handling. @@ -133,7 +133,7 @@ TEST_F(SafeBrowsingStoreFileTest, DetectsCorruption) { TEST_F(SafeBrowsingStoreFileTest, CheckValidity) { // Empty store is valid. - EXPECT_FALSE(file_util::PathExists(filename_)); + EXPECT_FALSE(base::PathExists(filename_)); ASSERT_TRUE(store_->BeginUpdate()); EXPECT_FALSE(corruption_detected_); EXPECT_TRUE(store_->CheckValidity()); @@ -141,9 +141,9 @@ TEST_F(SafeBrowsingStoreFileTest, CheckValidity) { EXPECT_TRUE(store_->CancelUpdate()); // A store with some data is valid. - EXPECT_FALSE(file_util::PathExists(filename_)); + EXPECT_FALSE(base::PathExists(filename_)); SafeBrowsingStoreTestStorePrefix(store_.get()); - EXPECT_TRUE(file_util::PathExists(filename_)); + EXPECT_TRUE(base::PathExists(filename_)); ASSERT_TRUE(store_->BeginUpdate()); EXPECT_FALSE(corruption_detected_); EXPECT_TRUE(store_->CheckValidity()); @@ -154,7 +154,7 @@ TEST_F(SafeBrowsingStoreFileTest, CheckValidity) { // Corrupt the payload. TEST_F(SafeBrowsingStoreFileTest, CheckValidityPayload) { SafeBrowsingStoreTestStorePrefix(store_.get()); - EXPECT_TRUE(file_util::PathExists(filename_)); + EXPECT_TRUE(base::PathExists(filename_)); // 37 is the most random prime number. It's also past the header, // as corrupting the header would fail BeginUpdate() in which case @@ -176,7 +176,7 @@ TEST_F(SafeBrowsingStoreFileTest, CheckValidityPayload) { // Corrupt the checksum. TEST_F(SafeBrowsingStoreFileTest, CheckValidityChecksum) { SafeBrowsingStoreTestStorePrefix(store_.get()); - EXPECT_TRUE(file_util::PathExists(filename_)); + EXPECT_TRUE(base::PathExists(filename_)); // An offset from the end of the file which is in the checksum. const int kOffset = -static_cast<int>(sizeof(base::MD5Digest)); diff --git a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc index acb34b2..48f5e80 100644 --- a/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc +++ b/chrome/browser/safe_browsing/safe_browsing_store_unittest_helper.cc @@ -320,7 +320,7 @@ void SafeBrowsingStoreTestDeleteChunks(SafeBrowsingStore* store) { void SafeBrowsingStoreTestDelete(SafeBrowsingStore* store, const base::FilePath& filename) { // Delete should work if the file wasn't there in the first place. - EXPECT_FALSE(file_util::PathExists(filename)); + EXPECT_FALSE(base::PathExists(filename)); EXPECT_TRUE(store->Delete()); // Create a store file. @@ -345,7 +345,7 @@ void SafeBrowsingStoreTestDelete(SafeBrowsingStore* store, &add_prefixes_result, &add_full_hashes_result)); - EXPECT_TRUE(file_util::PathExists(filename)); + EXPECT_TRUE(base::PathExists(filename)); EXPECT_TRUE(store->Delete()); - EXPECT_FALSE(file_util::PathExists(filename)); + EXPECT_FALSE(base::PathExists(filename)); } diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index 9120251..5e8dffe 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc @@ -145,7 +145,7 @@ void TemplateURLFetcherTest::StartDownload( base::FilePath osdd_full_path; ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); - ASSERT_TRUE(file_util::PathExists(osdd_full_path)); + ASSERT_TRUE(base::PathExists(osdd_full_path)); ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); } diff --git a/chrome/browser/search_engines/template_url_parser_unittest.cc b/chrome/browser/search_engines/template_url_parser_unittest.cc index ae11ecb..3905a3a 100644 --- a/chrome/browser/search_engines/template_url_parser_unittest.cc +++ b/chrome/browser/search_engines/template_url_parser_unittest.cc @@ -77,7 +77,7 @@ TemplateURLParserTest::~TemplateURLParserTest() { void TemplateURLParserTest::SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path_)); full_path_ = full_path_.AppendASCII("osdd"); - if (!file_util::PathExists(full_path_)) { + if (!base::PathExists(full_path_)) { LOG(ERROR) << "This test can't be run without some non-redistributable data"; full_path_ = base::FilePath(); @@ -95,7 +95,7 @@ void TemplateURLParserTest::ParseFile( ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &full_path)); full_path = full_path.AppendASCII("osdd"); full_path = full_path.AppendASCII(file_name); - ASSERT_TRUE(file_util::PathExists(full_path)); + ASSERT_TRUE(base::PathExists(full_path)); std::string contents; ASSERT_TRUE(file_util::ReadFileToString(full_path, &contents)); diff --git a/chrome/browser/sessions/session_backend.cc b/chrome/browser/sessions/session_backend.cc index 90e6a38..19431d8 100644 --- a/chrome/browser/sessions/session_backend.cc +++ b/chrome/browser/sessions/session_backend.cc @@ -47,7 +47,7 @@ class SessionFileReader { buffer_position_(0), available_count_(0) { file_.reset(new net::FileStream(NULL)); - if (file_util::PathExists(path)) + if (base::PathExists(path)) file_->OpenSync(path, base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ); } @@ -274,9 +274,9 @@ void SessionBackend::MoveCurrentSessionToLastSession() { const base::FilePath current_session_path = GetCurrentSessionPath(); const base::FilePath last_session_path = GetLastSessionPath(); - if (file_util::PathExists(last_session_path)) + if (base::PathExists(last_session_path)) base::Delete(last_session_path, false); - if (file_util::PathExists(current_session_path)) { + if (base::PathExists(current_session_path)) { int64 file_size; if (file_util::GetFileSize(current_session_path, &file_size)) { if (type_ == BaseSessionService::TAB_RESTORE) { @@ -290,7 +290,7 @@ void SessionBackend::MoveCurrentSessionToLastSession() { last_session_valid_ = base::Move(current_session_path, last_session_path); } - if (file_util::PathExists(current_session_path)) + if (base::PathExists(current_session_path)) base::Delete(current_session_path, false); // Create and open the file for the current session. diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc index 4551315..505d87b 100644 --- a/chrome/browser/shell_integration.cc +++ b/chrome/browser/shell_integration.cc @@ -79,7 +79,7 @@ CommandLine ShellIntegration::CommandLineArgsForLauncher( if (!user_data_dir.empty()) { // Make sure user_data_dir is an absolute path. user_data_dir = base::MakeAbsoluteFilePath(user_data_dir); - if (!user_data_dir.empty() && file_util::PathExists(user_data_dir)) + if (!user_data_dir.empty() && base::PathExists(user_data_dir)) new_cmd_line.AppendSwitchPath(switches::kUserDataDir, user_data_dir); } diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc index b84d295..3a692a9 100644 --- a/chrome/browser/shell_integration_linux.cc +++ b/chrome/browser/shell_integration_linux.cc @@ -552,7 +552,7 @@ ShellIntegration::ShortcutLocations GetExistingShortcutLocations( // Determine whether there is a shortcut on desktop. if (!desktop_path.empty()) { locations.on_desktop = - file_util::PathExists(desktop_path.Append(shortcut_filename)); + base::PathExists(desktop_path.Append(shortcut_filename)); } // Determine whether there is a shortcut in the applications directory. @@ -605,7 +605,7 @@ bool GetExistingShortcutContents(base::Environment* env, i != search_paths.end(); ++i) { base::FilePath path = i->Append("applications").Append(desktop_filename); VLOG(1) << "Looking for desktop file in " << path.value(); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { VLOG(1) << "Found desktop file at " << path.value(); return file_util::ReadFileToString(path, output); } @@ -627,7 +627,7 @@ base::FilePath GetWebShortcutFilename(const GURL& url) { base::FilePath filepath = desktop_path.Append(filename); base::FilePath alternative_filepath(filepath.value() + ".desktop"); for (size_t i = 1; i < 100; ++i) { - if (file_util::PathExists(base::FilePath(alternative_filepath))) { + if (base::PathExists(base::FilePath(alternative_filepath))) { alternative_filepath = base::FilePath( filepath.value() + "_" + base::IntToString(i) + ".desktop"); } else { diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc index c30dc78..eb37324 100644 --- a/chrome/browser/shell_integration_win.cc +++ b/chrome/browser/shell_integration_win.cc @@ -530,7 +530,7 @@ base::FilePath ShellIntegration::GetStartMenuShortcut( shortcut = shortcut.Append(shortcut_name).Append(shortcut_name + installer::kLnkExt); - if (file_util::PathExists(shortcut)) + if (base::PathExists(shortcut)) return shortcut; } diff --git a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc index cc3db9a..c5c8163 100644 --- a/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_custom_dictionary.cc @@ -96,7 +96,7 @@ void LoadDictionaryFileReliably(WordList& custom_words, return; // Checksum is not valid. See if there's a backup. base::FilePath backup = path.AddExtension(BACKUP_EXTENSION); - if (!file_util::PathExists(backup)) + if (!base::PathExists(backup)) return; // Load the backup and verify its checksum. if (LoadFile(backup, custom_words) != VALID_CHECKSUM) diff --git a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc index a6f5169..67dc923 100644 --- a/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc +++ b/chrome/browser/spellchecker/spellcheck_hunspell_dictionary.cc @@ -80,7 +80,7 @@ scoped_ptr<DictionaryFile> OpenDictionaryFile( base::FilePath user_dir; PathService::Get(chrome::DIR_USER_DATA, &user_dir); base::FilePath fallback = user_dir.Append(file->path.BaseName()); - if (!file_util::PathExists(file->path) && file_util::PathExists(fallback)) + if (!base::PathExists(file->path) && base::PathExists(fallback)) file->path = fallback; #endif @@ -89,7 +89,7 @@ scoped_ptr<DictionaryFile> OpenDictionaryFile( bool bdict_is_valid; { base::MemoryMappedFile map; - bdict_is_valid = file_util::PathExists(file->path) && + bdict_is_valid = base::PathExists(file->path) && map.Initialize(file->path) && hunspell::BDict::Verify(reinterpret_cast<const char*>(map.data()), map.length()); diff --git a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc index 5130600..45754ce 100644 --- a/chrome/browser/spellchecker/spellcheck_service_browsertest.cc +++ b/chrome/browser/spellchecker/spellcheck_service_browsertest.cc @@ -78,7 +78,7 @@ IN_PROC_BROWSER_TEST_F(SpellcheckServiceBrowserTest, DeleteCorruptedBDICT) { content::RunAllPendingInMessageLoop(content::BrowserThread::UI); EXPECT_EQ(SpellcheckService::BDICT_CORRUPTED, SpellcheckService::GetStatusEvent()); - if (file_util::PathExists(bdict_path)) { + if (base::PathExists(bdict_path)) { ADD_FAILURE(); EXPECT_TRUE(base::Delete(bdict_path, true)); } diff --git a/chrome/browser/storage_monitor/media_storage_util.cc b/chrome/browser/storage_monitor/media_storage_util.cc index 785440c..76d39f7 100644 --- a/chrome/browser/storage_monitor/media_storage_util.cc +++ b/chrome/browser/storage_monitor/media_storage_util.cc @@ -44,7 +44,7 @@ void ValidatePathOnFileThread( const base::Callback<void(bool)>& callback) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, - base::Bind(callback, file_util::PathExists(path))); + base::Bind(callback, base::PathExists(path))); } typedef std::vector<StorageInfo> StorageInfoList; @@ -79,7 +79,7 @@ void FilterAttachedDevicesOnFileThread(MediaStorageUtil::DeviceIdSet* devices) { if (type == StorageInfo::FIXED_MASS_STORAGE || type == StorageInfo::ITUNES || type == StorageInfo::PICASA) { - if (!file_util::PathExists(base::FilePath::FromUTF8Unsafe(unique_id))) + if (!base::PathExists(base::FilePath::FromUTF8Unsafe(unique_id))) missing_devices.insert(*it); continue; } diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc index a075a64..f1ddbe7 100644 --- a/chrome/browser/sync/profile_sync_service_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_unittest.cc @@ -465,11 +465,11 @@ TEST_F(ProfileSyncServiceTest, TestStartupWithOldSyncData) { harness_.service.reset(); // This file should have been deleted when the whole directory was nuked. - ASSERT_FALSE(file_util::PathExists(sync_file3)); - ASSERT_FALSE(file_util::PathExists(sync_file1)); + ASSERT_FALSE(base::PathExists(sync_file3)); + ASSERT_FALSE(base::PathExists(sync_file1)); // This will still exist, but the text should have changed. - ASSERT_TRUE(file_util::PathExists(sync_file2)); + ASSERT_TRUE(base::PathExists(sync_file2)); std::string file2text; ASSERT_TRUE(file_util::ReadFileToString(sync_file2, &file2text)); ASSERT_NE(file2text.compare(nonsense2), 0); diff --git a/chrome/browser/sync/test/integration/sync_extension_helper.cc b/chrome/browser/sync/test/integration/sync_extension_helper.cc index 151020b..62204bf 100644 --- a/chrome/browser/sync/test/integration/sync_extension_helper.cc +++ b/chrome/browser/sync/test/integration/sync_extension_helper.cc @@ -305,7 +305,7 @@ scoped_refptr<Extension> CreateExtension(const base::FilePath& base_dir, } const base::FilePath sub_dir = base::FilePath().AppendASCII(name); base::FilePath extension_dir; - if (!file_util::PathExists(base_dir) && + if (!base::PathExists(base_dir) && !file_util::CreateDirectory(base_dir)) { ADD_FAILURE(); return NULL; diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index 8d75d64..02fe845 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -220,7 +220,7 @@ Profile* SyncTest::MakeProfile(const base::FilePath::StringType name) { PathService::Get(chrome::DIR_USER_DATA, &path); path = path.Append(name); - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) CHECK(file_util::CreateDirectory(path)); Profile* profile = diff --git a/chrome/browser/ui/app_list/app_list_service_mac.mm b/chrome/browser/ui/app_list/app_list_service_mac.mm index 42e5432..be91494 100644 --- a/chrome/browser/ui/app_list/app_list_service_mac.mm +++ b/chrome/browser/ui/app_list/app_list_service_mac.mm @@ -178,7 +178,7 @@ void CheckAppListShimOnFileThread(const base::FilePath& profile_path) { CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableAppListShim); base::FilePath install_path = web_app::GetAppInstallPath( GetAppListShortcutInfo(profile_path)); - if (enable == file_util::PathExists(install_path)) + if (enable == base::PathExists(install_path)) return; if (enable) { diff --git a/chrome/browser/ui/ash/screenshot_taker_unittest.cc b/chrome/browser/ui/ash/screenshot_taker_unittest.cc index d91ef4a..a73eb37 100644 --- a/chrome/browser/ui/ash/screenshot_taker_unittest.cc +++ b/chrome/browser/ui/ash/screenshot_taker_unittest.cc @@ -129,7 +129,7 @@ TEST_F(ScreenshotTakerTest, TakeScreenshot) { EXPECT_EQ(ScreenshotTakerObserver::SCREENSHOT_SUCCESS, screenshot_result_); if (ScreenshotTakerObserver::SCREENSHOT_SUCCESS == screenshot_result_) - EXPECT_TRUE(file_util::PathExists(screenshot_path_)); + EXPECT_TRUE(base::PathExists(screenshot_path_)); } } // namespace test diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc index 8bc6dd7..6dca58f 100644 --- a/chrome/browser/ui/metro_pin_tab_helper_win.cc +++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc @@ -124,7 +124,7 @@ bool GetPathToBackupLogo(const base::FilePath& logo_dir, base::FilePath* logo_path) { const wchar_t kDefaultLogoFileName[] = L"SecondaryTile.png"; *logo_path = logo_dir.Append(kDefaultLogoFileName); - if (file_util::PathExists(*logo_path)) + if (base::PathExists(*logo_path)) return true; base::FilePath default_logo_path; diff --git a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc index 92b4f91..d6cd780 100644 --- a/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc +++ b/chrome/browser/ui/prefs/prefs_tab_helper_browsertest.cc @@ -35,7 +35,7 @@ class PrefsTabHelperBrowserTest : public InProcessBrowserTest { return false; } base::FilePath non_global_pref_file = GetPreferencesFilePath(); - if (!file_util::PathExists(non_global_pref_file)) { + if (!base::PathExists(non_global_pref_file)) { LOG(ERROR) << "Doesn't exist " << non_global_pref_file.MaybeAsASCII(); return false; } diff --git a/chrome/browser/ui/views/app_list/app_list_controller_win.cc b/chrome/browser/ui/views/app_list/app_list_controller_win.cc index d459a01..37568a6 100644 --- a/chrome/browser/ui/views/app_list/app_list_controller_win.cc +++ b/chrome/browser/ui/views/app_list/app_list_controller_win.cc @@ -224,7 +224,7 @@ void CreateAppListShortcuts( base::FilePath shortcut_file = shortcut_paths[i].Append(app_list_shortcut_name). AddExtension(installer::kLnkExt); - if (!file_util::PathExists(shortcut_file.DirName()) && + if (!base::PathExists(shortcut_file.DirName()) && !file_util::CreateDirectory(shortcut_file.DirName())) { NOTREACHED(); return; diff --git a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc index 611995e..a1c9cc0 100644 --- a/chrome/browser/ui/views/avatar_menu_button_browsertest.cc +++ b/chrome/browser/ui/views/avatar_menu_button_browsertest.cc @@ -74,7 +74,7 @@ void AvatarMenuButtonTest::CreateTestingProfile() { base::FilePath path; PathService::Get(chrome::DIR_USER_DATA, &path); path = path.AppendASCII("test_profile"); - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) ASSERT_TRUE(file_util::CreateDirectory(path)); Profile* profile = Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); diff --git a/chrome/browser/ui/views/extensions/native_app_window_views.cc b/chrome/browser/ui/views/extensions/native_app_window_views.cc index 8d5433a..a7cc935 100644 --- a/chrome/browser/ui/views/extensions/native_app_window_views.cc +++ b/chrome/browser/ui/views/extensions/native_app_window_views.cc @@ -106,7 +106,7 @@ void CreateIconAndSetRelaunchDetails( ui::win::SetRelaunchDetailsForWindow(command_line.GetCommandLineString(), shortcut_info.title, hwnd); - if (!file_util::PathExists(web_app_path) && + if (!base::PathExists(web_app_path) && !file_util::CreateDirectory(web_app_path)) { return; } diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc index d24c6ac..1cc9584 100644 --- a/chrome/browser/ui/web_applications/web_app_ui.cc +++ b/chrome/browser/ui/web_applications/web_app_ui.cc @@ -260,7 +260,7 @@ void UpdateShortcutWorker::CheckExistingShortcuts() { base::FilePath shortcut_file = path.Append(file_name_). ReplaceExtension(FILE_PATH_LITERAL(".lnk")); - if (file_util::PathExists(shortcut_file)) { + if (base::PathExists(shortcut_file)) { shortcut_files_.push_back(shortcut_file); } } @@ -280,7 +280,7 @@ void UpdateShortcutWorker::UpdateShortcutsOnFileThread() { // Ensure web_app_path exists. web_app_path could be missing for a legacy // shortcut created by Gears. - if (!file_util::PathExists(web_app_path) && + if (!base::PathExists(web_app_path) && !file_util::CreateDirectory(web_app_path)) { NOTREACHED(); return; diff --git a/chrome/browser/ui/webui/nacl_ui.cc b/chrome/browser/ui/webui/nacl_ui.cc index d8da413..744d9cf 100644 --- a/chrome/browser/ui/webui/nacl_ui.cc +++ b/chrome/browser/ui/webui/nacl_ui.cc @@ -162,7 +162,7 @@ void NaClDomHandlerProxy::ValidatePnaclPath() { // However, do not trust that the path returned by the PathService exists. // Check for existence here. ValidatePnaclPathCallback( - got_path && !pnacl_path.empty() && file_util::PathExists(pnacl_path)); + got_path && !pnacl_path.empty() && base::PathExists(pnacl_path)); } void NaClDomHandlerProxy::ValidatePnaclPathCallback(bool is_valid) { diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc index b568e93..bbe55c8 100644 --- a/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc +++ b/chrome/browser/ui/webui/options/advanced_options_utils_x11.cc @@ -82,7 +82,7 @@ bool StartProxyConfigUtil(const char* command[]) { bool found = false; for (size_t i = 0; i < paths.size(); ++i) { base::FilePath file(paths[i]); - if (file_util::PathExists(file.Append(command[0]))) { + if (base::PathExists(file.Append(command[0]))) { found = true; break; } diff --git a/chrome/browser/upload_list.cc b/chrome/browser/upload_list.cc index 52c42a7..3f618aa 100644 --- a/chrome/browser/upload_list.cc +++ b/chrome/browser/upload_list.cc @@ -49,7 +49,7 @@ void UploadList::LoadUploadListAndInformDelegateOfCompletion() { } void UploadList::LoadUploadList() { - if (file_util::PathExists(upload_log_path_)) { + if (base::PathExists(upload_log_path_)) { std::string contents; file_util::ReadFileToString(upload_log_path_, &contents); std::vector<std::string> log_entries; diff --git a/chrome/browser/user_data_dir_extractor_win.cc b/chrome/browser/user_data_dir_extractor_win.cc index 793991a..e295885 100644 --- a/chrome/browser/user_data_dir_extractor_win.cc +++ b/chrome/browser/user_data_dir_extractor_win.cc @@ -45,7 +45,7 @@ base::FilePath GetUserDataDir(const content::MainFunctionParams& parameters) { // prompt the user to pick a different directory, and restart chrome with // the new dir. // http://code.google.com/p/chromium/issues/detail?id=11510 - if (!file_util::PathExists(user_data_dir)) { + if (!base::PathExists(user_data_dir)) { #if defined(USE_AURA) // TODO(beng): NOTIMPLEMENTED(); diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc index dd7ab40..3ab2660 100644 --- a/chrome/browser/user_style_sheet_watcher.cc +++ b/chrome/browser/user_style_sheet_watcher.cc @@ -109,7 +109,7 @@ void UserStyleSheetLoader::LoadStyleSheet( return; } // Create the file if it doesn't exist. - if (!file_util::PathExists(style_sheet_file)) + if (!base::PathExists(style_sheet_file)) file_util::WriteFile(style_sheet_file, "", 0); std::string css; diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index 354eaec..c085638 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -166,7 +166,7 @@ void LaunchShimOnFileThread( DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); base::FilePath shim_path = web_app::GetAppInstallPath(shortcut_info); - if (shim_path.empty() || !file_util::PathExists(shim_path)) { + if (shim_path.empty() || !base::PathExists(shim_path)) { // The user may have deleted the copy in the Applications folder, use the // one in the web app's app_data_path. base::FilePath app_data_path = web_app::GetWebAppDataDirectory( @@ -174,7 +174,7 @@ void LaunchShimOnFileThread( shim_path = app_data_path.Append(shim_path.BaseName()); } - if (!file_util::PathExists(shim_path)) + if (!base::PathExists(shim_path)) return; CommandLine command_line(CommandLine::NO_PROGRAM); @@ -377,7 +377,7 @@ bool WebAppShortcutCreator::UpdateShortcuts() { // If the path does not exist, check if a matching bundle can be found // elsewhere. - if (dst_path.empty() || !file_util::PathExists(app_path)) + if (dst_path.empty() || !base::PathExists(app_path)) app_path = GetAppBundleById(GetBundleIdentifier()); if (!app_path.empty()) { diff --git a/chrome/browser/web_applications/web_app_mac_unittest.mm b/chrome/browser/web_applications/web_app_mac_unittest.mm index a96ff4c..34ca570 100644 --- a/chrome/browser/web_applications/web_app_mac_unittest.mm +++ b/chrome/browser/web_applications/web_app_mac_unittest.mm @@ -85,8 +85,8 @@ TEST(WebAppShortcutCreatorTest, CreateShortcuts) { EXPECT_CALL(shortcut_creator, RevealAppShimInFinder()); EXPECT_TRUE(shortcut_creator.CreateShortcuts()); - EXPECT_TRUE(file_util::PathExists(app_in_app_data_path_path)); - EXPECT_TRUE(file_util::PathExists(dst_path)); + EXPECT_TRUE(base::PathExists(app_in_app_data_path_path)); + EXPECT_TRUE(base::PathExists(dst_path)); EXPECT_EQ(dst_path.BaseName(), shortcut_creator.GetShortcutName()); base::FilePath plist_path = dst_path.Append("Contents").Append("Info.plist"); @@ -143,8 +143,8 @@ TEST(WebAppShortcutCreatorTest, UpdateShortcuts) { other_folder.Append(app_name).Append("Contents"), true)); EXPECT_TRUE(shortcut_creator.UpdateShortcuts()); - EXPECT_FALSE(file_util::PathExists(dst_folder.Append(app_name))); - EXPECT_TRUE(file_util::PathExists( + EXPECT_FALSE(base::PathExists(dst_folder.Append(app_name))); + EXPECT_TRUE(base::PathExists( other_folder.Append(app_name).Append("Contents"))); // Also test case where GetAppBundleById fails. @@ -157,8 +157,8 @@ TEST(WebAppShortcutCreatorTest, UpdateShortcuts) { other_folder.Append(app_name).Append("Contents"), true)); EXPECT_FALSE(shortcut_creator.UpdateShortcuts()); - EXPECT_FALSE(file_util::PathExists(dst_folder.Append(app_name))); - EXPECT_FALSE(file_util::PathExists( + EXPECT_FALSE(base::PathExists(dst_folder.Append(app_name))); + EXPECT_FALSE(base::PathExists( other_folder.Append(app_name).Append("Contents"))); } @@ -200,7 +200,7 @@ TEST(WebAppShortcutCreatorTest, RunShortcut) { EXPECT_CALL(shortcut_creator, RevealAppShimInFinder()); EXPECT_TRUE(shortcut_creator.CreateShortcuts()); - EXPECT_TRUE(file_util::PathExists(dst_path)); + EXPECT_TRUE(base::PathExists(dst_path)); ssize_t status = getxattr( dst_path.value().c_str(), "com.apple.quarantine", NULL, 0, 0, 0); diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc index 6e19753..34205ff 100644 --- a/chrome/browser/web_applications/web_app_win.cc +++ b/chrome/browser/web_applications/web_app_win.cc @@ -75,8 +75,8 @@ bool ShouldUpdateIcon(const base::FilePath& icon_file, icon_file.ReplaceExtension(kIconChecksumFileExt)); // Returns true if icon_file or checksum file is missing. - if (!file_util::PathExists(icon_file) || - !file_util::PathExists(checksum_file)) + if (!base::PathExists(icon_file) || + !base::PathExists(checksum_file)) return true; base::MD5Digest persisted_image_checksum; @@ -143,7 +143,7 @@ std::vector<base::FilePath> FindAppShortcutsByProfileAndTitle( shortcut_file = shortcut_file.InsertBeforeExtensionASCII( base::StringPrintf(" (%d)", i)); } - if (file_util::PathExists(shortcut_file) && + if (base::PathExists(shortcut_file) && IsAppShortcutForProfile(shortcut_file, profile_path)) { shortcut_paths.push_back(shortcut_file); } @@ -166,7 +166,7 @@ bool CreateShortcutsInPaths( web_app::ShortcutCreationPolicy creation_policy, std::vector<base::FilePath>* out_filenames) { // Ensure web_app_path exists. - if (!file_util::PathExists(web_app_path) && + if (!base::PathExists(web_app_path) && !file_util::CreateDirectory(web_app_path)) { return false; } @@ -243,7 +243,7 @@ bool CreateShortcutsInPaths( shortcut_properties.set_icon(icon_file, 0); shortcut_properties.set_app_id(app_id); shortcut_properties.set_dual_mode(false); - if (!file_util::PathExists(shortcut_file.DirName()) && + if (!base::PathExists(shortcut_file.DirName()) && !file_util::CreateDirectory(shortcut_file.DirName())) { NOTREACHED(); return false; @@ -444,7 +444,7 @@ void UpdatePlatformShortcuts( // and let the shell know the icon has been modified. base::FilePath icon_file = web_app_path.Append(file_name).AddExtension( FILE_PATH_LITERAL(".ico")); - if (file_util::PathExists(icon_file)) { + if (base::PathExists(icon_file)) { web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon); } } diff --git a/chrome/common/chrome_content_client.cc b/chrome/common/chrome_content_client.cc index 44101fa..d20802d 100644 --- a/chrome/common/chrome_content_client.cc +++ b/chrome/common/chrome_content_client.cc @@ -137,7 +137,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { static bool skip_pdf_file_check = false; base::FilePath path; if (PathService::Get(chrome::FILE_PDF_PLUGIN, &path)) { - if (skip_pdf_file_check || file_util::PathExists(path)) { + if (skip_pdf_file_check || base::PathExists(path)) { content::PepperPluginInfo pdf; pdf.path = path; pdf.name = chrome::ChromeContentClient::kPDFPluginName; @@ -165,7 +165,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { // switch. static bool skip_nacl_file_check = false; if (PathService::Get(chrome::FILE_NACL_PLUGIN, &path)) { - if (skip_nacl_file_check || file_util::PathExists(path)) { + if (skip_nacl_file_check || base::PathExists(path)) { content::PepperPluginInfo nacl; nacl.path = path; nacl.name = chrome::ChromeContentClient::kNaClPluginName; @@ -190,7 +190,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { // entirely with o1d. static bool skip_o3d_file_check = false; if (PathService::Get(chrome::FILE_O3D_PLUGIN, &path)) { - if (skip_o3d_file_check || file_util::PathExists(path)) { + if (skip_o3d_file_check || base::PathExists(path)) { content::PepperPluginInfo o3d; o3d.path = path; o3d.name = kO3DPluginName; @@ -209,7 +209,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { static bool skip_o1d_file_check = false; if (PathService::Get(chrome::FILE_O1D_PLUGIN, &path)) { - if (skip_o1d_file_check || file_util::PathExists(path)) { + if (skip_o1d_file_check || base::PathExists(path)) { content::PepperPluginInfo o1d; o1d.path = path; o1d.name = kO1DPluginName; @@ -228,7 +228,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { static bool skip_gtalk_file_check = false; if (PathService::Get(chrome::FILE_GTALK_PLUGIN, &path)) { - if (skip_gtalk_file_check || file_util::PathExists(path)) { + if (skip_gtalk_file_check || base::PathExists(path)) { content::PepperPluginInfo gtalk; gtalk.path = path; gtalk.name = kGTalkPluginName; @@ -249,7 +249,7 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) { !defined(WIDEVINE_CDM_IS_COMPONENT) static bool skip_widevine_cdm_file_check = false; if (PathService::Get(chrome::FILE_WIDEVINE_CDM_ADAPTER, &path)) { - if (skip_widevine_cdm_file_check || file_util::PathExists(path)) { + if (skip_widevine_cdm_file_check || base::PathExists(path)) { content::PepperPluginInfo widevine_cdm; widevine_cdm.is_out_of_process = true; widevine_cdm.path = path; diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 9c20980..4375a13 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -408,7 +408,7 @@ bool PathProvider(int key, base::FilePath* result) { if (!PathService::Get(base::DIR_MODULE, &cur)) return false; cur = cur.Append(FILE_PATH_LITERAL("test_data")); - if (!file_util::PathExists(cur)) // We don't want to create this. + if (!base::PathExists(cur)) // We don't want to create this. return false; break; case chrome::DIR_TEST_DATA: @@ -417,7 +417,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("chrome")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // We don't want to create this. + if (!base::PathExists(cur)) // We don't want to create this. return false; break; case chrome::DIR_TEST_TOOLS: @@ -426,7 +426,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("chrome")); cur = cur.Append(FILE_PATH_LITERAL("tools")); cur = cur.Append(FILE_PATH_LITERAL("test")); - if (!file_util::PathExists(cur)) // We don't want to create this + if (!base::PathExists(cur)) // We don't want to create this return false; break; #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) @@ -448,7 +448,7 @@ bool PathProvider(int key, base::FilePath* result) { if (!login) return false; cur = cur.AppendASCII(login); - if (!file_util::PathExists(cur)) // We don't want to create this. + if (!base::PathExists(cur)) // We don't want to create this. return false; break; } @@ -500,7 +500,7 @@ bool PathProvider(int key, base::FilePath* result) { return false; } - if (create_dir && !file_util::PathExists(cur) && + if (create_dir && !base::PathExists(cur) && !file_util::CreateDirectory(cur)) return false; diff --git a/chrome/common/extensions/api/i18n/default_locale_handler.cc b/chrome/common/extensions/api/i18n/default_locale_handler.cc index 5ac7f16..363128f 100644 --- a/chrome/common/extensions/api/i18n/default_locale_handler.cc +++ b/chrome/common/extensions/api/i18n/default_locale_handler.cc @@ -54,7 +54,7 @@ bool DefaultLocaleHandler::Validate( std::vector<InstallWarning>* warnings) const { // default_locale and _locales have to be both present or both missing. const base::FilePath path = extension->path().Append(kLocaleFolder); - bool path_exists = file_util::PathExists(path); + bool path_exists = base::PathExists(path); std::string default_locale = extensions::LocaleInfo::GetDefaultLocale(extension); @@ -87,7 +87,7 @@ bool DefaultLocaleHandler::Validate( base::FilePath messages_path = locale_path.Append(kMessagesFilename); - if (!file_util::PathExists(messages_path)) { + if (!base::PathExists(messages_path)) { *error = base::StringPrintf( "%s %s", errors::kLocalesMessagesFileMissing, UTF16ToUTF8(messages_path.LossyDisplayName()).c_str()); diff --git a/chrome/common/extensions/api/plugins/plugins_handler.cc b/chrome/common/extensions/api/plugins/plugins_handler.cc index b918c5e..d8decf6 100644 --- a/chrome/common/extensions/api/plugins/plugins_handler.cc +++ b/chrome/common/extensions/api/plugins/plugins_handler.cc @@ -136,7 +136,7 @@ bool PluginsHandler::Validate(const Extension* extension, for (std::vector<extensions::PluginInfo>::const_iterator plugin = plugins->begin(); plugin != plugins->end(); ++plugin) { - if (!file_util::PathExists(plugin->path)) { + if (!base::PathExists(plugin->path)) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_PLUGIN_PATH_FAILED, plugin->path.LossyDisplayName()); diff --git a/chrome/common/extensions/background_info.cc b/chrome/common/extensions/background_info.cc index c82b3a1..8d21f5d 100644 --- a/chrome/common/extensions/background_info.cc +++ b/chrome/common/extensions/background_info.cc @@ -264,7 +264,7 @@ bool BackgroundManifestHandler::Validate( const std::vector<std::string>& background_scripts = extensions::BackgroundInfo::GetBackgroundScripts(extension); for (size_t i = 0; i < background_scripts.size(); ++i) { - if (!file_util::PathExists( + if (!base::PathExists( extension->GetResource(background_scripts[i]).GetFilePath())) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_BACKGROUND_SCRIPT_FAILED, @@ -282,7 +282,7 @@ bool BackgroundManifestHandler::Validate( extension_file_util::ExtensionURLToRelativeFilePath( extensions::BackgroundInfo::GetBackgroundURL(extension)); const base::FilePath path = extension->GetResource(page_path).GetFilePath(); - if (path.empty() || !file_util::PathExists(path)) { + if (path.empty() || !base::PathExists(path)) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_BACKGROUND_PAGE_FAILED, diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 188abc4..37137fd 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -72,7 +72,7 @@ base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir, base::FilePath version_dir; // Create the extension directory if it doesn't exist already. - if (!file_util::PathExists(extension_dir)) { + if (!base::PathExists(extension_dir)) { if (!file_util::CreateDirectory(extension_dir)) return base::FilePath(); } @@ -99,7 +99,7 @@ base::FilePath InstallExtension(const base::FilePath& unpacked_source_dir, for (int i = 0; i < kMaxAttempts; ++i) { base::FilePath candidate = extension_dir.AppendASCII( base::StringPrintf("%s_%u", version.c_str(), i)); - if (!file_util::PathExists(candidate)) { + if (!base::PathExists(candidate)) { version_dir = candidate; break; } @@ -170,7 +170,7 @@ base::DictionaryValue* LoadManifest(const base::FilePath& extension_path, std::string* error) { base::FilePath manifest_path = extension_path.Append(extensions::kManifestFilename); - if (!file_util::PathExists(manifest_path)) { + if (!base::PathExists(manifest_path)) { *error = l10n_util::GetStringUTF8(IDS_EXTENSION_MANIFEST_UNREADABLE); return NULL; } @@ -229,7 +229,7 @@ std::vector<base::FilePath> FindPrivateKeyFiles( bool ValidateFilePath(const base::FilePath& path) { int64 size = 0; - if (!file_util::PathExists(path) || + if (!base::PathExists(path) || !file_util::GetFileSize(path, &size) || size == 0) { return false; @@ -409,7 +409,7 @@ extensions::MessageBundle* LoadMessageBundle( error->clear(); // Load locale information if available. base::FilePath locale_path = extension_path.Append(extensions::kLocaleFolder); - if (!file_util::PathExists(locale_path)) + if (!base::PathExists(locale_path)) return NULL; std::set<std::string> locales; @@ -529,7 +529,7 @@ base::FilePath ExtensionResourceURLToFilePath(const GURL& url, return base::FilePath(); base::FilePath path = root.AppendASCII(host).Append(relative_path); - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::FilePath(); path = base::MakeAbsoluteFilePath(path); if (path.empty() || !root.IsParent(path)) @@ -548,7 +548,7 @@ base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir) { // This guarantees it is on the same file system as the extension's eventual // install target. base::FilePath temp_path = extensions_dir.Append(kTempDirectoryName); - if (file_util::PathExists(temp_path)) { + if (base::PathExists(temp_path)) { if (!file_util::DirectoryExists(temp_path)) { DLOG(WARNING) << "Not a directory: " << temp_path.value(); return base::FilePath(); diff --git a/chrome/common/extensions/extension_l10n_util.cc b/chrome/common/extensions/extension_l10n_util.cc index c31adb0..ac4b4ba 100644 --- a/chrome/common/extensions/extension_l10n_util.cc +++ b/chrome/common/extensions/extension_l10n_util.cc @@ -211,7 +211,7 @@ bool AddLocale(const std::set<std::string>& chrome_locales, return true; } // Check if messages file is actually present (but don't check content). - if (file_util::PathExists( + if (base::PathExists( locale_folder.Append(extensions::kMessagesFilename))) { valid_locales->insert(locale_name); } else { diff --git a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc index 0041df9..8ff7eba 100644 --- a/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc +++ b/chrome/common/extensions/manifest_handlers/content_scripts_handler.cc @@ -296,7 +296,7 @@ static bool IsScriptValid(const base::FilePath& path, int message_id, std::string* error) { std::string content; - if (!file_util::PathExists(path) || + if (!base::PathExists(path) || !file_util::ReadFileToString(path, &content)) { *error = l10n_util::GetStringFUTF8( message_id, diff --git a/chrome/common/extensions/manifest_handlers/theme_handler.cc b/chrome/common/extensions/manifest_handlers/theme_handler.cc index 19e2e57..f5c8799 100644 --- a/chrome/common/extensions/manifest_handlers/theme_handler.cc +++ b/chrome/common/extensions/manifest_handlers/theme_handler.cc @@ -202,7 +202,7 @@ bool ThemeHandler::Validate(const Extension* extension, if (iter.value().GetAsString(&val)) { base::FilePath image_path = extension->path().Append( base::FilePath::FromUTF8Unsafe(val)); - if (!file_util::PathExists(image_path)) { + if (!base::PathExists(image_path)) { *error = l10n_util::GetStringFUTF8(IDS_EXTENSION_INVALID_IMAGE_PATH, image_path.LossyDisplayName()); diff --git a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc index b768970..845bf0a 100644 --- a/chrome/common/extensions/manifest_tests/extension_manifest_test.cc +++ b/chrome/common/extensions/manifest_tests/extension_manifest_test.cc @@ -28,7 +28,7 @@ base::DictionaryValue* LoadManifestFile(const base::FilePath& filename_path, manifest_path = manifest_path.Append(filename_path); extension_path = manifest_path.DirName(); - EXPECT_TRUE(file_util::PathExists(manifest_path)) << + EXPECT_TRUE(base::PathExists(manifest_path)) << "Couldn't find " << manifest_path.value(); JSONFileValueSerializer serializer(manifest_path); diff --git a/chrome/common/extensions/manifest_url_handler.cc b/chrome/common/extensions/manifest_url_handler.cc index 8b1847d..e1fe5ff 100644 --- a/chrome/common/extensions/manifest_url_handler.cc +++ b/chrome/common/extensions/manifest_url_handler.cc @@ -240,7 +240,7 @@ bool OptionsPageHandler::Validate(const Extension* extension, extensions::ManifestURL::GetOptionsPage(extension)); const base::FilePath path = extension->GetResource(options_path).GetFilePath(); - if (path.empty() || !file_util::PathExists(path)) { + if (path.empty() || !base::PathExists(path)) { *error = l10n_util::GetStringFUTF8( IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED, diff --git a/chrome/common/json_schema/json_schema_validator_unittest_base.cc b/chrome/common/json_schema/json_schema_validator_unittest_base.cc index 50af16a8..0f87a48 100644 --- a/chrome/common/json_schema/json_schema_validator_unittest_base.cc +++ b/chrome/common/json_schema/json_schema_validator_unittest_base.cc @@ -29,7 +29,7 @@ base::Value* LoadValue(const std::string& filename) { base::FilePath path; PathService::Get(chrome::DIR_TEST_DATA, &path); path = path.AppendASCII("json_schema_validator").AppendASCII(filename); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); std::string error_message; JSONFileValueSerializer serializer(path); diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index e588ccc..ceef7c93 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -167,7 +167,7 @@ base::FilePath SetUpSymlinkIfNeeded(const base::FilePath& symlink_path, // starting a new log, then delete the old symlink and make a new // one to a fresh log file. base::FilePath target_path; - bool symlink_exists = file_util::PathExists(symlink_path); + bool symlink_exists = base::PathExists(symlink_path); if (new_log || !symlink_exists) { target_path = GenerateTimestampedName(symlink_path, base::Time::Now()); diff --git a/chrome/common/mac/app_mode_chrome_locator_unittest.mm b/chrome/common/mac/app_mode_chrome_locator_unittest.mm index c924111..f3c7e4d 100644 --- a/chrome/common/mac/app_mode_chrome_locator_unittest.mm +++ b/chrome/common/mac/app_mode_chrome_locator_unittest.mm @@ -64,5 +64,5 @@ TEST(ChromeLocatorTest, GetChromeBundleInfo) { &raw_version, &version_path, &framework_path)); EXPECT_GT(raw_version.size(), 0U); EXPECT_TRUE(file_util::DirectoryExists(version_path)); - EXPECT_TRUE(file_util::PathExists(framework_path)); + EXPECT_TRUE(base::PathExists(framework_path)); } diff --git a/chrome/installer/launcher_support/chrome_launcher_support.cc b/chrome/installer/launcher_support/chrome_launcher_support.cc index 181007d..09a65b3 100644 --- a/chrome/installer/launcher_support/chrome_launcher_support.cc +++ b/chrome/installer/launcher_support/chrome_launcher_support.cc @@ -50,7 +50,7 @@ base::FilePath GetDevelopmentExe(const wchar_t* exe_file) { base::FilePath current_directory; if (PathService::Get(base::DIR_EXE, ¤t_directory)) { base::FilePath chrome_exe_path(current_directory.Append(exe_file)); - if (file_util::PathExists(chrome_exe_path)) + if (base::PathExists(chrome_exe_path)) return chrome_exe_path; } return base::FilePath(); @@ -113,7 +113,7 @@ base::FilePath GetSetupExeFromRegistry(InstallationLevel level, string16 uninstall; if (GetClientStateValue(level, app_guid, kUninstallStringField, &uninstall)) { base::FilePath setup_exe_path(uninstall); - if (file_util::PathExists(setup_exe_path)) + if (base::PathExists(setup_exe_path)) return setup_exe_path; } return base::FilePath(); @@ -130,12 +130,12 @@ base::FilePath FindExeRelativeToSetupExe(const base::FilePath setup_exe_path, // name) and look for chrome.exe from there. base::FilePath exe_path( setup_exe_path.DirName().DirName().DirName().Append(exe_file)); - if (file_util::PathExists(exe_path)) + if (base::PathExists(exe_path)) return exe_path; // By way of mild future proofing, look up one to see if there's a // |exe_file| in the version directory exe_path = setup_exe_path.DirName().DirName().Append(exe_file); - if (file_util::PathExists(exe_path)) + if (base::PathExists(exe_path)) return exe_path; } return base::FilePath(); diff --git a/chrome/installer/setup/install.cc b/chrome/installer/setup/install.cc index 6897373..43750d1 100644 --- a/chrome/installer/setup/install.cc +++ b/chrome/installer/setup/install.cc @@ -201,7 +201,7 @@ installer::InstallStatus InstallNewVersion( if (!install_list->Do()) { installer_state.UpdateStage(installer::ROLLINGBACK); installer::InstallStatus result = - file_util::PathExists(new_chrome_exe) && current_version->get() && + base::PathExists(new_chrome_exe) && current_version->get() && new_version.Equals(*current_version->get()) ? installer::SAME_VERSION_REPAIR_FAILED : installer::INSTALL_FAILED; @@ -226,7 +226,7 @@ installer::InstallStatus InstallNewVersion( } if (new_version.CompareTo(**current_version) > 0) { - if (file_util::PathExists(new_chrome_exe)) { + if (base::PathExists(new_chrome_exe)) { VLOG(1) << "Version updated to " << new_version.GetString() << " while running " << (*current_version)->GetString(); return installer::IN_USE_UPDATED; @@ -302,7 +302,7 @@ bool CreateVisualElementsManifest(const base::FilePath& src_path, // Some distributions of Chromium may not include visual elements. Only // proceed if this distribution does. - if (!file_util::PathExists(src_path.Append(elements_dir))) { + if (!base::PathExists(src_path.Append(elements_dir))) { VLOG(1) << "No visual elements found, not writing " << installer::kVisualElementsManifest << " to " << src_path.value(); return true; @@ -673,7 +673,7 @@ void HandleActiveSetupForBrowser(const base::FilePath& installation_root, // shortcuts; if the decision is to create them, only shortcuts whose matching // all-users shortcut isn't present on the system will be created. InstallShortcutOperation install_operation = - (!force && file_util::PathExists(first_run_sentinel) ? + (!force && base::PathExists(first_run_sentinel) ? INSTALL_SHORTCUT_REPLACE_EXISTING : INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); diff --git a/chrome/installer/setup/install_unittest.cc b/chrome/installer/setup/install_unittest.cc index f8e5e83..e992aa9 100644 --- a/chrome/installer/setup/install_unittest.cc +++ b/chrome/installer/setup/install_unittest.cc @@ -215,7 +215,7 @@ class InstallShortcutTest : public testing::Test { TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestNotCreated) { ASSERT_TRUE( installer::CreateVisualElementsManifest(test_dir_.path(), version_)); - ASSERT_FALSE(file_util::PathExists(manifest_path_)); + ASSERT_FALSE(base::PathExists(manifest_path_)); } // Test that VisualElementsManifest.xml is created with the correct content when @@ -225,7 +225,7 @@ TEST_F(CreateVisualElementsManifestTest, VisualElementsManifestCreated) { version_dir_.Append(installer::kVisualElements))); ASSERT_TRUE( installer::CreateVisualElementsManifest(test_dir_.path(), version_)); - ASSERT_TRUE(file_util::PathExists(manifest_path_)); + ASSERT_TRUE(base::PathExists(manifest_path_)); std::string read_manifest; ASSERT_TRUE(file_util::ReadFileToString(manifest_path_, &read_manifest)); @@ -289,7 +289,7 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButDesktopShortcut) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_no_desktop, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_ALL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); base::win::ValidateShortcut(user_start_menu_shortcut_, @@ -303,7 +303,7 @@ TEST_F(InstallShortcutTest, CreateAllShortcutsButQuickLaunchShortcut) { chrome_exe_, *product_, *prefs_no_ql, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_ALL); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); base::win::ValidateShortcut(user_start_menu_shortcut_, expected_start_menu_properties_); } @@ -358,8 +358,8 @@ TEST_F(InstallShortcutTest, ReplaceExisting) { chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_REPLACE_EXISTING); base::win::ValidateShortcut(user_desktop_shortcut_, expected_properties_); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_start_menu_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); } TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { @@ -384,9 +384,9 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelAllSystemShortcutsExist) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_quick_launch_shortcut_)); - ASSERT_FALSE(file_util::PathExists(user_start_menu_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_quick_launch_shortcut_)); + ASSERT_FALSE(base::PathExists(user_start_menu_shortcut_)); } TEST_F(InstallShortcutTest, CreateIfNoSystemLevelNoSystemShortcutsExist) { @@ -414,7 +414,7 @@ TEST_F(InstallShortcutTest, CreateIfNoSystemLevelSomeSystemShortcutsExist) { installer::CreateOrUpdateShortcuts( chrome_exe_, *product_, *prefs_, installer::CURRENT_USER, installer::INSTALL_SHORTCUT_CREATE_EACH_IF_NO_SYSTEM_LEVEL); - ASSERT_FALSE(file_util::PathExists(user_desktop_shortcut_)); + ASSERT_FALSE(base::PathExists(user_desktop_shortcut_)); base::win::ValidateShortcut(user_quick_launch_shortcut_, expected_properties_); base::win::ValidateShortcut(user_start_menu_shortcut_, diff --git a/chrome/installer/setup/install_worker.cc b/chrome/installer/setup/install_worker.cc index f9f19fa..b625954 100644 --- a/chrome/installer/setup/install_worker.cc +++ b/chrome/installer/setup/install_worker.cc @@ -518,7 +518,7 @@ void AddChromeWorkItems(const InstallationState& original_state, // Install kVisualElementsManifest if it is present in |src_path|. No need to // make this a conditional work item as if the file is not there now, it will // never be. - if (file_util::PathExists( + if (base::PathExists( src_path.Append(installer::kVisualElementsManifest))) { install_list->AddMoveTreeWorkItem( src_path.Append(installer::kVisualElementsManifest).value(), diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index 7259c4d..36eb491 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -121,7 +121,7 @@ DWORD UnPackArchive(const base::FilePath& archive, // Check if this is differential update and if it is, patch it to the // installer archive that should already be on the machine. We assume // it is a differential installer if chrome.7z is not found. - if (!file_util::PathExists(uncompressed_archive)) { + if (!base::PathExists(uncompressed_archive)) { *archive_type = installer::INCREMENTAL_ARCHIVE_TYPE; VLOG(1) << "Differential patch found. Applying to existing archive."; if (!archive_version.get()) { @@ -683,7 +683,7 @@ installer::InstallStatus InstallProductsHelper( // We want to keep uncompressed archive (chrome.7z) that we get after // uncompressing and binary patching. Get the location for this file. base::FilePath archive_to_copy; - if (file_util::PathExists(archive)) { + if (base::PathExists(archive)) { VLOG(1) << "Archive found to install Chrome " << archive.value(); if (UnPackArchive(archive, installer_state, temp_path.path(), unpack_path, archive_type)) { @@ -701,7 +701,7 @@ installer::InstallStatus InstallProductsHelper( base::FilePath uncompressed_archive(cmd_line.GetProgram().DirName().Append( installer::kChromeArchive)); - if (file_util::PathExists(uncompressed_archive)) { + if (base::PathExists(uncompressed_archive)) { VLOG(1) << "Uncompressed archive found to install Chrome " << uncompressed_archive.value(); *archive_type = installer::FULL_ARCHIVE_TYPE; @@ -1057,7 +1057,7 @@ installer::InstallStatus UninstallProducts( base::FilePath first_run_sentinel; InstallUtil::GetSentinelFilePath( chrome::kFirstRunSentinel, dist, &first_run_sentinel); - if (file_util::PathExists(first_run_sentinel)) { + if (base::PathExists(first_run_sentinel)) { // If the Chrome being self-destructed has already undergone First Run, // trigger Active Setup and make sure the system-level Chrome doesn't go // through first run. @@ -1204,7 +1204,7 @@ installer::InstallStatus RegisterDevChrome( chrome_exe = base::MakeAbsoluteFilePath(chrome_exe); installer::InstallStatus status = installer::FIRST_INSTALL_SUCCESS; - if (file_util::PathExists(chrome_exe)) { + if (base::PathExists(chrome_exe)) { Product chrome(chrome_dist); // Create the Start menu shortcut and pin it to the taskbar. diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index ce3e13c..5cc08b1 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -29,7 +29,7 @@ class SetupUtilTestWithDir : public testing::Test { virtual void SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("installer"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(base::PathExists(data_dir_)); // Create a temp directory for testing. ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); @@ -98,9 +98,9 @@ bool CurrentProcessHasPrivilege(const wchar_t* privilege_name) { TEST_F(SetupUtilTestWithDir, ApplyDiffPatchTest) { base::FilePath work_dir(test_dir_.path()); work_dir = work_dir.AppendASCII("ApplyDiffPatchTest"); - ASSERT_FALSE(file_util::PathExists(work_dir)); + ASSERT_FALSE(base::PathExists(work_dir)); EXPECT_TRUE(file_util::CreateDirectory(work_dir)); - ASSERT_TRUE(file_util::PathExists(work_dir)); + ASSERT_TRUE(base::PathExists(work_dir)); base::FilePath src = data_dir_.AppendASCII("archive1.7z"); base::FilePath patch = data_dir_.AppendASCII("archive.diff"); @@ -119,33 +119,33 @@ TEST_F(SetupUtilTestWithDir, GetMaxVersionFromArchiveDirTest) { // Create a version dir base::FilePath chrome_dir = test_dir_.path().AppendASCII("1.0.0.0"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); scoped_ptr<Version> version( installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "1.0.0.0"); base::Delete(chrome_dir, true); - ASSERT_FALSE(file_util::PathExists(chrome_dir)); + ASSERT_FALSE(base::PathExists(chrome_dir)); ASSERT_TRUE(installer::GetMaxVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("ABC"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); ASSERT_TRUE(installer::GetMaxVersionFromArchiveDir(test_dir_.path()) == NULL); chrome_dir = test_dir_.path().AppendASCII("2.3.4.5"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "2.3.4.5"); // Create multiple version dirs, ensure that we select the greatest. chrome_dir = test_dir_.path().AppendASCII("9.9.9.9"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); chrome_dir = test_dir_.path().AppendASCII("1.1.1.1"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); version.reset(installer::GetMaxVersionFromArchiveDir(test_dir_.path())); ASSERT_EQ(version->GetString(), "9.9.9.9"); @@ -154,11 +154,11 @@ TEST_F(SetupUtilTestWithDir, GetMaxVersionFromArchiveDirTest) { TEST_F(SetupUtilTestWithDir, DeleteFileFromTempProcess) { base::FilePath test_file; file_util::CreateTemporaryFileInDir(test_dir_.path(), &test_file); - ASSERT_TRUE(file_util::PathExists(test_file)); + ASSERT_TRUE(base::PathExists(test_file)); file_util::WriteFile(test_file, "foo", 3); EXPECT_TRUE(installer::DeleteFileFromTempProcess(test_file, 0)); base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); - EXPECT_FALSE(file_util::PathExists(test_file)); + EXPECT_FALSE(base::PathExists(test_file)); } // Note: This test is only valid when run at high integrity (i.e. it will fail diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 246c860..2b7610f 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -427,7 +427,7 @@ base::FilePath BackupLocalStateFile( const base::FilePath& local_state_folder = local_state_folders[i]; base::FilePath state_file( local_state_folder.Append(chrome::kLocalStateFilename)); - if (!file_util::PathExists(state_file)) + if (!base::PathExists(state_file)) continue; if (!file_util::CreateTemporaryFile(&backup)) LOG(ERROR) << "Failed to create temporary file for Local State."; diff --git a/chrome/installer/test/alternate_version_generator_main.cc b/chrome/installer/test/alternate_version_generator_main.cc index 2227e74..85d925c 100644 --- a/chrome/installer/test/alternate_version_generator_main.cc +++ b/chrome/installer/test/alternate_version_generator_main.cc @@ -140,7 +140,7 @@ int wmain(int argc, wchar_t *argv[]) { return EXIT_FAILURE; } - if (!file_util::PathExists(mini_installer)) { + if (!base::PathExists(mini_installer)) { DumpUsage(*cmd_line, errors::MINI_INSTALLER_NOT_FOUND, mini_installer.value()); return EXIT_FAILURE; @@ -148,7 +148,7 @@ int wmain(int argc, wchar_t *argv[]) { base::FilePath out; GetOutPath(*cmd_line, &out); - if (!cmd_line->HasSwitch(switches::kForce) && file_util::PathExists(out)) { + if (!cmd_line->HasSwitch(switches::kForce) && base::PathExists(out)) { DumpUsage(*cmd_line, errors::OUT_FILE_EXISTS, out.value()); return EXIT_FAILURE; } diff --git a/chrome/installer/util/chrome_browser_operations.cc b/chrome/installer/util/chrome_browser_operations.cc index 01a106b..59757e4 100644 --- a/chrome/installer/util/chrome_browser_operations.cc +++ b/chrome/installer/util/chrome_browser_operations.cc @@ -115,7 +115,7 @@ void ChromeBrowserOperations::AddDefaultShortcutProperties( int icon_index = dist->GetIconIndex(); base::FilePath prefs_path(target_exe.DirName().AppendASCII( installer::kDefaultMasterPrefs)); - if (file_util::PathExists(prefs_path)) { + if (base::PathExists(prefs_path)) { installer::MasterPreferences prefs(prefs_path); prefs.GetInt(installer::master_preferences::kChromeShortcutIconIndex, &icon_index); diff --git a/chrome/installer/util/conditional_work_item_list.cc b/chrome/installer/util/conditional_work_item_list.cc index 9e8d5bf..56c8617 100644 --- a/chrome/installer/util/conditional_work_item_list.cc +++ b/chrome/installer/util/conditional_work_item_list.cc @@ -32,7 +32,7 @@ void ConditionalWorkItemList::Rollback() { // Pre-defined conditions: //------------------------------------------------------------------------------ bool ConditionRunIfFileExists::ShouldRun() const { - return file_util::PathExists(key_path_); + return base::PathExists(key_path_); } bool Not::ShouldRun() const { diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index ea14ea1..6f44e59 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -29,12 +29,12 @@ CopyTreeWorkItem::CopyTreeWorkItem(const base::FilePath& source_path, } bool CopyTreeWorkItem::Do() { - if (!file_util::PathExists(source_path_)) { + if (!base::PathExists(source_path_)) { LOG(ERROR) << source_path_.value() << " does not exist"; return false; } - bool dest_exist = file_util::PathExists(dest_path_); + bool dest_exist = base::PathExists(dest_path_); // handle overwrite_option_ = IF_DIFFERENT case. if ((dest_exist) && (overwrite_option_ == WorkItem::IF_DIFFERENT) && // only for single file @@ -52,7 +52,7 @@ bool CopyTreeWorkItem::Do() { (IsFileInUse(dest_path_))) { // handle overwrite_option_ = NEW_NAME_IF_IN_USE case. if (alternative_path_.empty() || - file_util::PathExists(alternative_path_) || + base::PathExists(alternative_path_) || !base::CopyFile(source_path_, alternative_path_)) { LOG(ERROR) << "failed to copy " << source_path_.value() << " to " << alternative_path_.value(); @@ -126,7 +126,7 @@ void CopyTreeWorkItem::Rollback() { } bool CopyTreeWorkItem::IsFileInUse(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return false; HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index accd12a..981e54e 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc @@ -47,7 +47,7 @@ namespace { } bool IsFileInUse(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return false; HANDLE handle = ::CreateFile(path.value().c_str(), FILE_ALL_ACCESS, @@ -80,13 +80,13 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination path base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); @@ -101,15 +101,15 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_TRUE(file_util::ContentsEqual(file_name_from, file_name_to)); // test rollback() work_item->Rollback(); - EXPECT_FALSE(file_util::PathExists(file_name_to)); - EXPECT_TRUE(file_util::PathExists(file_name_from)); + EXPECT_FALSE(base::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); } // Copy one file, overwriting the existing one in destination. @@ -120,18 +120,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // test Do() with always_overwrite being true. scoped_ptr<CopyTreeWorkItem> work_item( @@ -143,16 +143,16 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_2)); @@ -167,16 +167,16 @@ TEST_F(CopyTreeWorkItemTest, CopyFileOverwrite) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_2)); } @@ -190,18 +190,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // test Do() with always_overwrite being true. scoped_ptr<CopyTreeWorkItem> work_item( @@ -218,24 +218,24 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // we verify the file is overwritten by checking the existence of backup // file. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_EQ(0, ReadTextFile(backup_file.value()).compare(text_content_1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test Do() with always_overwrite being false. nothing should change. work_item.reset( @@ -247,22 +247,22 @@ TEST_F(CopyTreeWorkItemTest, CopyFileSameContent) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // we verify the file is not overwritten by checking that the backup // file does not exist. - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback(). nothing should happen here. work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file and without rollback. Verify all temporary files are deleted. @@ -271,18 +271,18 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From.txt"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create destination file base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To.txt"); CreateTextFile(file_name_to.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); base::FilePath backup_file; @@ -302,17 +302,17 @@ TEST_F(CopyTreeWorkItemTest, CopyFileAndCleanup) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_EQ(0, ReadTextFile(backup_file.value()).compare(text_content_2)); } // verify the backup file is cleaned up as well. - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file, with the existing one in destination being used with @@ -323,7 +323,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -333,12 +333,12 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -366,23 +366,23 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -402,7 +402,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -412,13 +412,13 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to), alternate_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); alternate_to = alternate_to.AppendASCII("Alternate_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -441,8 +441,8 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // verify that the backup path does not exist @@ -452,13 +452,13 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); EXPECT_TRUE(work_item->backup_path_.path().empty()); // the alternate file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_FALSE(base::PathExists(alternate_to)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -482,24 +482,24 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(file_name_from, file_name_to)); // verify that the backup path does exist - EXPECT_TRUE(file_util::PathExists(backup_file)); - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_TRUE(base::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(alternate_to)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback - EXPECT_FALSE(file_util::PathExists(backup_file)); - EXPECT_FALSE(file_util::PathExists(alternate_to)); + EXPECT_FALSE(base::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(alternate_to)); } // Test overwrite option IF_NOT_PRESENT: @@ -513,7 +513,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -523,11 +523,11 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); // Get the path of backup file base::FilePath backup_file(temp_dir_.path()); @@ -544,22 +544,22 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { // verify that the source, destination have not changed and backup path // does not exist - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback() work_item->Rollback(); // verify that the source, destination have not changed and backup path // does not exist after rollback also - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, file_name_to)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // Now delete the destination and try copying the file again. base::Delete(file_name_to, true); @@ -571,20 +571,20 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { // verify that the source, destination are the same and backup path // does not exist - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); // test rollback() work_item->Rollback(); // verify that the destination does not exist anymore - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_FALSE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_FALSE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); - EXPECT_FALSE(file_util::PathExists(backup_file)); + EXPECT_FALSE(base::PathExists(backup_file)); } // Copy one file without rollback. The existing one in destination is in use. @@ -595,7 +595,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { base::FilePath file_name_from(test_dir_.path()); file_name_from = file_name_from.AppendASCII("File_From"); CreateTextFile(file_name_from.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from)); + ASSERT_TRUE(base::PathExists(file_name_from)); // Create an executable in destination path by copying ourself to it. wchar_t exe_full_path_str[MAX_PATH]; @@ -605,12 +605,12 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("Copy_To_Subdir"); file_util::CreateDirectory(dir_name_to); - ASSERT_TRUE(file_util::PathExists(dir_name_to)); + ASSERT_TRUE(base::PathExists(dir_name_to)); base::FilePath file_name_to(dir_name_to); file_name_to = file_name_to.AppendASCII("File_To"); base::CopyFile(exe_full_path, file_name_to); - ASSERT_TRUE(file_util::PathExists(file_name_to)); + ASSERT_TRUE(base::PathExists(file_name_to)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << file_name_to.value(); @@ -641,17 +641,17 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { EXPECT_FALSE(backup_file.empty()); backup_file = backup_file.AppendASCII("File_To"); - EXPECT_TRUE(file_util::PathExists(file_name_from)); - EXPECT_TRUE(file_util::PathExists(file_name_to)); + EXPECT_TRUE(base::PathExists(file_name_from)); + EXPECT_TRUE(base::PathExists(file_name_to)); EXPECT_EQ(0, ReadTextFile(file_name_from.value()).compare(text_content_1)); EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); } // verify the file in used should be still at the backup place. - EXPECT_TRUE(file_util::PathExists(backup_file)); + EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); TerminateProcess(pi.hProcess, 0); @@ -668,27 +668,27 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath dir_name_from(test_dir_.path()); dir_name_from = dir_name_from.AppendASCII("from"); file_util::CreateDirectory(dir_name_from); - ASSERT_TRUE(file_util::PathExists(dir_name_from)); + ASSERT_TRUE(base::PathExists(dir_name_from)); base::FilePath dir_name_from_1(dir_name_from); dir_name_from_1 = dir_name_from_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_from_1); - ASSERT_TRUE(file_util::PathExists(dir_name_from_1)); + ASSERT_TRUE(base::PathExists(dir_name_from_1)); base::FilePath dir_name_from_2(dir_name_from); dir_name_from_2 = dir_name_from_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_from_2); - ASSERT_TRUE(file_util::PathExists(dir_name_from_2)); + ASSERT_TRUE(base::PathExists(dir_name_from_2)); base::FilePath file_name_from_1(dir_name_from_1); file_name_from_1 = file_name_from_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_from_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from_1)); + ASSERT_TRUE(base::PathExists(file_name_from_1)); base::FilePath file_name_from_2(dir_name_from_2); file_name_from_2 = file_name_from_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_from_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_from_2)); + ASSERT_TRUE(base::PathExists(file_name_from_2)); base::FilePath dir_name_to(test_dir_.path()); dir_name_to = dir_name_to.AppendASCII("to"); @@ -708,7 +708,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath file_name_to_1(dir_name_to); file_name_to_1 = file_name_to_1.AppendASCII("1"); file_name_to_1 = file_name_to_1.AppendASCII("File_1.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_to_1)); + EXPECT_TRUE(base::PathExists(file_name_to_1)); VLOG(1) << "compare " << file_name_from_1.value() << " and " << file_name_to_1.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_1, file_name_to_1)); @@ -716,7 +716,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { base::FilePath file_name_to_2(dir_name_to); file_name_to_2 = file_name_to_2.AppendASCII("2"); file_name_to_2 = file_name_to_2.AppendASCII("File_2.txt"); - EXPECT_TRUE(file_util::PathExists(file_name_to_2)); + EXPECT_TRUE(base::PathExists(file_name_to_2)); VLOG(1) << "compare " << file_name_from_2.value() << " and " << file_name_to_2.value(); EXPECT_TRUE(file_util::ContentsEqual(file_name_from_2, file_name_to_2)); diff --git a/chrome/installer/util/create_dir_work_item.cc b/chrome/installer/util/create_dir_work_item.cc index a21d3eb..2e1ffa3 100644 --- a/chrome/installer/util/create_dir_work_item.cc +++ b/chrome/installer/util/create_dir_work_item.cc @@ -16,7 +16,7 @@ CreateDirWorkItem::CreateDirWorkItem(const base::FilePath& path) } void CreateDirWorkItem::GetTopDirToCreate() { - if (file_util::PathExists(path_)) { + if (base::PathExists(path_)) { top_path_ = base::FilePath(); return; } @@ -25,7 +25,7 @@ void CreateDirWorkItem::GetTopDirToCreate() { do { top_path_ = parent_dir; parent_dir = parent_dir.DirName(); - } while ((parent_dir != top_path_) && !file_util::PathExists(parent_dir)); + } while ((parent_dir != top_path_) && !base::PathExists(parent_dir)); return; } @@ -56,7 +56,7 @@ void CreateDirWorkItem::Rollback() { base::FilePath path_to_delete(path_); while (1) { - if (file_util::PathExists(path_to_delete)) { + if (base::PathExists(path_to_delete)) { if (!RemoveDirectory(path_to_delete.value().c_str())) break; } diff --git a/chrome/installer/util/create_dir_work_item_unittest.cc b/chrome/installer/util/create_dir_work_item_unittest.cc index 1dce3ec..ba3e81b 100644 --- a/chrome/installer/util/create_dir_work_item_unittest.cc +++ b/chrome/installer/util/create_dir_work_item_unittest.cc @@ -29,7 +29,7 @@ TEST_F(CreateDirWorkItemTest, CreatePath) { base::FilePath parent_dir(temp_dir_.path()); parent_dir = parent_dir.AppendASCII("a"); file_util::CreateDirectory(parent_dir); - ASSERT_TRUE(file_util::PathExists(parent_dir)); + ASSERT_TRUE(base::PathExists(parent_dir)); base::FilePath top_dir_to_create(parent_dir); top_dir_to_create = top_dir_to_create.AppendASCII("b"); @@ -43,33 +43,33 @@ TEST_F(CreateDirWorkItemTest, CreatePath) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item->Rollback(); // Rollback should delete all the paths up to top_dir_to_create. - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); - EXPECT_TRUE(file_util::PathExists(parent_dir)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); + EXPECT_TRUE(base::PathExists(parent_dir)); } TEST_F(CreateDirWorkItemTest, CreateExistingPath) { base::FilePath dir_to_create(temp_dir_.path()); dir_to_create = dir_to_create.AppendASCII("aa"); file_util::CreateDirectory(dir_to_create); - ASSERT_TRUE(file_util::PathExists(dir_to_create)); + ASSERT_TRUE(base::PathExists(dir_to_create)); scoped_ptr<CreateDirWorkItem> work_item( WorkItem::CreateCreateDirWorkItem(dir_to_create)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item->Rollback(); // Rollback should not remove the path since it exists before // the CreateDirWorkItem is called. - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); } TEST_F(CreateDirWorkItemTest, CreateSharedPath) { @@ -87,22 +87,22 @@ TEST_F(CreateDirWorkItemTest, CreateSharedPath) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create_3)); + EXPECT_TRUE(base::PathExists(dir_to_create_3)); // Create another directory under dir_to_create_2 base::FilePath dir_to_create_4(dir_to_create_2); dir_to_create_4 = dir_to_create_4.AppendASCII("ddd"); file_util::CreateDirectory(dir_to_create_4); - ASSERT_TRUE(file_util::PathExists(dir_to_create_4)); + ASSERT_TRUE(base::PathExists(dir_to_create_4)); work_item->Rollback(); // Rollback should delete dir_to_create_3. - EXPECT_FALSE(file_util::PathExists(dir_to_create_3)); + EXPECT_FALSE(base::PathExists(dir_to_create_3)); // Rollback should not delete dir_to_create_2 as it is shared. - EXPECT_TRUE(file_util::PathExists(dir_to_create_2)); - EXPECT_TRUE(file_util::PathExists(dir_to_create_4)); + EXPECT_TRUE(base::PathExists(dir_to_create_2)); + EXPECT_TRUE(base::PathExists(dir_to_create_4)); } TEST_F(CreateDirWorkItemTest, RollbackWithMissingDir) { @@ -120,14 +120,14 @@ TEST_F(CreateDirWorkItemTest, RollbackWithMissingDir) { EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(dir_to_create_3)); + EXPECT_TRUE(base::PathExists(dir_to_create_3)); RemoveDirectory(dir_to_create_3.value().c_str()); - ASSERT_FALSE(file_util::PathExists(dir_to_create_3)); + ASSERT_FALSE(base::PathExists(dir_to_create_3)); work_item->Rollback(); // dir_to_create_3 has already been deleted, Rollback should delete // the rest. - EXPECT_FALSE(file_util::PathExists(dir_to_create_1)); + EXPECT_FALSE(base::PathExists(dir_to_create_1)); } diff --git a/chrome/installer/util/delete_tree_work_item.cc b/chrome/installer/util/delete_tree_work_item.cc index 7c32654..1bf69de 100644 --- a/chrome/installer/util/delete_tree_work_item.cc +++ b/chrome/installer/util/delete_tree_work_item.cc @@ -108,7 +108,7 @@ bool DeleteTreeWorkItem::Do() { } // Now that we've taken care of the key files, take care of the rest. - if (!root_path_.empty() && file_util::PathExists(root_path_)) { + if (!root_path_.empty() && base::PathExists(root_path_)) { if (!ignore_failure_) { if (!backup_path_.CreateUniqueTempDirUnderPath(temp_path_)) { PLOG(ERROR) << "Failed to get backup path in folder " @@ -143,7 +143,7 @@ void DeleteTreeWorkItem::Rollback() { if (copied_to_backup_) { DCHECK(!backup_path_.path().empty()); base::FilePath backup = backup_path_.path().Append(root_path_.BaseName()); - if (file_util::PathExists(backup)) + if (base::PathExists(backup)) base::Move(backup, root_path_); } @@ -153,7 +153,7 @@ void DeleteTreeWorkItem::Rollback() { base::FilePath& key_file = key_paths_[i]; base::FilePath backup_file = backup_dir.path().Append(key_file.BaseName()); - if (file_util::PathExists(backup_file) && + if (base::PathExists(backup_file) && !base::Move(backup_file, key_file)) { // This could happen if we could not delete the key file to begin with. PLOG(WARNING) << "Rollback: Failed to move backup file back in place: " diff --git a/chrome/installer/util/delete_tree_work_item_unittest.cc b/chrome/installer/util/delete_tree_work_item_unittest.cc index 190e0d9..3181c53 100644 --- a/chrome/installer/util/delete_tree_work_item_unittest.cc +++ b/chrome/installer/util/delete_tree_work_item_unittest.cc @@ -49,27 +49,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // Test Do(). base::ScopedTempDir temp_dir; @@ -82,15 +82,15 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeNoKeyPath) { EXPECT_TRUE(work_item->Do()); // everything should be gone - EXPECT_FALSE(file_util::PathExists(file_name_delete_1)); - EXPECT_FALSE(file_util::PathExists(file_name_delete_2)); - EXPECT_FALSE(file_util::PathExists(dir_name_delete)); + EXPECT_FALSE(base::PathExists(file_name_delete_1)); + EXPECT_FALSE(base::PathExists(file_name_delete_2)); + EXPECT_FALSE(base::PathExists(dir_name_delete)); work_item->Rollback(); // everything should come back - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); - EXPECT_TRUE(file_util::PathExists(dir_name_delete)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(dir_name_delete)); } @@ -101,27 +101,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // test Do() base::ScopedTempDir temp_dir; @@ -134,15 +134,15 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTree) { EXPECT_TRUE(work_item->Do()); // everything should be gone - EXPECT_FALSE(file_util::PathExists(file_name_delete_1)); - EXPECT_FALSE(file_util::PathExists(file_name_delete_2)); - EXPECT_FALSE(file_util::PathExists(dir_name_delete)); + EXPECT_FALSE(base::PathExists(file_name_delete_1)); + EXPECT_FALSE(base::PathExists(file_name_delete_2)); + EXPECT_FALSE(base::PathExists(dir_name_delete)); work_item->Rollback(); // everything should come back - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); - EXPECT_TRUE(file_util::PathExists(dir_name_delete)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(dir_name_delete)); } // Delete a tree with key_path in use. Everything should still be there. @@ -151,27 +151,27 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { base::FilePath dir_name_delete(temp_dir_.path()); dir_name_delete = dir_name_delete.AppendASCII("to_be_delete"); file_util::CreateDirectory(dir_name_delete); - ASSERT_TRUE(file_util::PathExists(dir_name_delete)); + ASSERT_TRUE(base::PathExists(dir_name_delete)); base::FilePath dir_name_delete_1(dir_name_delete); dir_name_delete_1 = dir_name_delete_1.AppendASCII("1"); file_util::CreateDirectory(dir_name_delete_1); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_1)); + ASSERT_TRUE(base::PathExists(dir_name_delete_1)); base::FilePath dir_name_delete_2(dir_name_delete); dir_name_delete_2 = dir_name_delete_2.AppendASCII("2"); file_util::CreateDirectory(dir_name_delete_2); - ASSERT_TRUE(file_util::PathExists(dir_name_delete_2)); + ASSERT_TRUE(base::PathExists(dir_name_delete_2)); base::FilePath file_name_delete_1(dir_name_delete_1); file_name_delete_1 = file_name_delete_1.AppendASCII("File_1.txt"); CreateTextFile(file_name_delete_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_1)); + ASSERT_TRUE(base::PathExists(file_name_delete_1)); base::FilePath file_name_delete_2(dir_name_delete_2); file_name_delete_2 = file_name_delete_2.AppendASCII("File_2.txt"); CreateTextFile(file_name_delete_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(file_name_delete_2)); + ASSERT_TRUE(base::PathExists(file_name_delete_2)); // Create a key path file. base::FilePath key_path(dir_name_delete); @@ -182,7 +182,7 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { base::FilePath exe_full_path(exe_full_path_str); base::CopyFile(exe_full_path, key_path); - ASSERT_TRUE(file_util::PathExists(key_path)); + ASSERT_TRUE(base::PathExists(key_path)); VLOG(1) << "copy ourself from " << exe_full_path.value() << " to " << key_path.value(); @@ -210,9 +210,9 @@ TEST_F(DeleteTreeWorkItemTest, DeleteTreeInUse) { } // verify everything is still there. - EXPECT_TRUE(file_util::PathExists(key_path)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_1)); - EXPECT_TRUE(file_util::PathExists(file_name_delete_2)); + EXPECT_TRUE(base::PathExists(key_path)); + EXPECT_TRUE(base::PathExists(file_name_delete_1)); + EXPECT_TRUE(base::PathExists(file_name_delete_2)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. diff --git a/chrome/installer/util/duplicate_tree_detector_unittest.cc b/chrome/installer/util/duplicate_tree_detector_unittest.cc index 0607b98..6a97d84 100644 --- a/chrome/installer/util/duplicate_tree_detector_unittest.cc +++ b/chrome/installer/util/duplicate_tree_detector_unittest.cc @@ -40,22 +40,22 @@ class DuplicateTreeDetectorTest : public testing::Test { base::FilePath d1(first_root); d1 = d1.AppendASCII("D1"); file_util::CreateDirectory(d1); - ASSERT_TRUE(file_util::PathExists(d1)); + ASSERT_TRUE(base::PathExists(d1)); base::FilePath f1(d1); f1 = f1.AppendASCII("F1"); CreateTextFile(f1.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(f1)); + ASSERT_TRUE(base::PathExists(f1)); base::FilePath d2(d1); d2 = d2.AppendASCII("D2"); file_util::CreateDirectory(d2); - ASSERT_TRUE(file_util::PathExists(d2)); + ASSERT_TRUE(base::PathExists(d2)); base::FilePath f2(d2); f2 = f2.AppendASCII("F2"); CreateTextFile(f2.MaybeAsASCII(), text_content_2_); - ASSERT_TRUE(file_util::PathExists(f2)); + ASSERT_TRUE(base::PathExists(f2)); ASSERT_TRUE(installer::test::CopyFileHierarchy(d1, second_root)); } @@ -94,7 +94,7 @@ TEST_F(DuplicateTreeDetectorTest, TestSourceContainsDest) { base::FilePath new_file(temp_source_dir_.path()); new_file = new_file.AppendASCII("FNew"); CreateTextFile(new_file.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(new_file)); + ASSERT_TRUE(base::PathExists(new_file)); EXPECT_FALSE(installer::IsIdenticalFileHierarchy(temp_source_dir_.path(), temp_dest_dir_.path())); @@ -108,7 +108,7 @@ TEST_F(DuplicateTreeDetectorTest, TestDestContainsSource) { base::FilePath new_file(temp_dest_dir_.path()); new_file = new_file.AppendASCII("FNew"); CreateTextFile(new_file.MaybeAsASCII(), text_content_1_); - ASSERT_TRUE(file_util::PathExists(new_file)); + ASSERT_TRUE(base::PathExists(new_file)); EXPECT_TRUE(installer::IsIdenticalFileHierarchy(temp_source_dir_.path(), temp_dest_dir_.path())); diff --git a/chrome/installer/util/eula_util.cc b/chrome/installer/util/eula_util.cc index 8fee493..25bcba8 100644 --- a/chrome/installer/util/eula_util.cc +++ b/chrome/installer/util/eula_util.cc @@ -26,7 +26,7 @@ bool IsChromeFirstRunPending(BrowserDistribution* dist) { return InstallUtil::GetSentinelFilePath(chrome::kFirstRunSentinel, dist, &first_run_sentinel) - && !file_util::PathExists(first_run_sentinel); + && !base::PathExists(first_run_sentinel); } bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) { @@ -37,7 +37,7 @@ bool IsEULAAcceptanceFlagged(BrowserDistribution* dist) { return InstallUtil::GetSentinelFilePath(kEULASentinelFile, dist, &eula_sentinel) - && file_util::PathExists(eula_sentinel); + && base::PathExists(eula_sentinel); } scoped_ptr<MasterPreferences> GetMasterPrefs(const ProductState& prod_state) { diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc index 07a2b0c..424acef 100644 --- a/chrome/installer/util/install_util.cc +++ b/chrome/installer/util/install_util.cc @@ -385,11 +385,11 @@ bool InstallUtil::GetSentinelFilePath(const base::FilePath::CharType* file, if (IsPerUserInstall(exe_path.value().c_str())) { const base::FilePath maybe_product_dir(exe_path.DirName().DirName()); - if (file_util::PathExists(exe_path.Append(installer::kChromeExe))) { + if (base::PathExists(exe_path.Append(installer::kChromeExe))) { // DIR_EXE is most likely Chrome's directory in which case |exe_path| is // the user-level sentinel path. *path = exe_path; - } else if (file_util::PathExists( + } else if (base::PathExists( maybe_product_dir.Append(installer::kChromeExe))) { // DIR_EXE can also be the Installer directory if this is called from a // setup.exe running from Application\<version>\Installer (see diff --git a/chrome/installer/util/installer_state.cc b/chrome/installer/util/installer_state.cc index 5fd81bc..ad8c053 100644 --- a/chrome/installer/util/installer_state.cc +++ b/chrome/installer/util/installer_state.cc @@ -552,7 +552,7 @@ Version* InstallerState::GetCurrentVersion( // Be aware that there might be a pending "new_chrome.exe" already in the // installation path. If so, we use old_version, which holds the version of // "chrome.exe" itself. - if (file_util::PathExists(target_path().Append(kChromeNewExe))) + if (base::PathExists(target_path().Append(kChromeNewExe))) version = product_state->old_version(); if (version == NULL) @@ -590,7 +590,7 @@ bool InstallerState::IsChromeFrameRunning( base::FilePath cf_install_path( target_path().AppendASCII(current_version->GetString()) .Append(kChromeFrameDll)); - in_use = file_util::PathExists(cf_install_path) && + in_use = base::PathExists(cf_install_path) && IsFileInUse(cf_install_path); } return in_use; diff --git a/chrome/installer/util/installer_state_unittest.cc b/chrome/installer/util/installer_state_unittest.cc index 1d5fbb5..a5142b3 100644 --- a/chrome/installer/util/installer_state_unittest.cc +++ b/chrome/installer/util/installer_state_unittest.cc @@ -99,47 +99,47 @@ TEST_F(InstallerStateTest, Delete) { base::FilePath chrome_dir(test_dir_.path()); chrome_dir = chrome_dir.AppendASCII("chrome"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); base::FilePath chrome_dir_1(chrome_dir); chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); file_util::CreateDirectory(chrome_dir_1); - ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); + ASSERT_TRUE(base::PathExists(chrome_dir_1)); base::FilePath chrome_dir_2(chrome_dir); chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); file_util::CreateDirectory(chrome_dir_2); - ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); + ASSERT_TRUE(base::PathExists(chrome_dir_2)); base::FilePath chrome_dir_3(chrome_dir); chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); file_util::CreateDirectory(chrome_dir_3); - ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); + ASSERT_TRUE(base::PathExists(chrome_dir_3)); base::FilePath chrome_dir_4(chrome_dir); chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); file_util::CreateDirectory(chrome_dir_4); - ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); + ASSERT_TRUE(base::PathExists(chrome_dir_4)); base::FilePath chrome_dll_1(chrome_dir_1); chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); + ASSERT_TRUE(base::PathExists(chrome_dll_1)); base::FilePath chrome_dll_2(chrome_dir_2); chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); + ASSERT_TRUE(base::PathExists(chrome_dll_2)); base::FilePath chrome_dll_3(chrome_dir_3); chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_3.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); + ASSERT_TRUE(base::PathExists(chrome_dll_3)); base::FilePath chrome_dll_4(chrome_dir_4); chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_4.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); + ASSERT_TRUE(base::PathExists(chrome_dll_4)); MockInstallerState installer_state; BuildSingleChromeState(chrome_dir, &installer_state); @@ -152,11 +152,11 @@ TEST_F(InstallerStateTest, Delete) { } // old versions should be gone - EXPECT_FALSE(file_util::PathExists(chrome_dir_1)); - EXPECT_FALSE(file_util::PathExists(chrome_dir_2)); - EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); + EXPECT_FALSE(base::PathExists(chrome_dir_1)); + EXPECT_FALSE(base::PathExists(chrome_dir_2)); + EXPECT_FALSE(base::PathExists(chrome_dir_3)); // the latest version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); + EXPECT_TRUE(base::PathExists(chrome_dll_4)); } // Delete older version directories, keeping the one in used intact. @@ -165,37 +165,37 @@ TEST_F(InstallerStateTest, DeleteInUsed) { base::FilePath chrome_dir(test_dir_.path()); chrome_dir = chrome_dir.AppendASCII("chrome"); file_util::CreateDirectory(chrome_dir); - ASSERT_TRUE(file_util::PathExists(chrome_dir)); + ASSERT_TRUE(base::PathExists(chrome_dir)); base::FilePath chrome_dir_1(chrome_dir); chrome_dir_1 = chrome_dir_1.AppendASCII("1.0.1.0"); file_util::CreateDirectory(chrome_dir_1); - ASSERT_TRUE(file_util::PathExists(chrome_dir_1)); + ASSERT_TRUE(base::PathExists(chrome_dir_1)); base::FilePath chrome_dir_2(chrome_dir); chrome_dir_2 = chrome_dir_2.AppendASCII("1.0.2.0"); file_util::CreateDirectory(chrome_dir_2); - ASSERT_TRUE(file_util::PathExists(chrome_dir_2)); + ASSERT_TRUE(base::PathExists(chrome_dir_2)); base::FilePath chrome_dir_3(chrome_dir); chrome_dir_3 = chrome_dir_3.AppendASCII("1.0.3.0"); file_util::CreateDirectory(chrome_dir_3); - ASSERT_TRUE(file_util::PathExists(chrome_dir_3)); + ASSERT_TRUE(base::PathExists(chrome_dir_3)); base::FilePath chrome_dir_4(chrome_dir); chrome_dir_4 = chrome_dir_4.AppendASCII("1.0.4.0"); file_util::CreateDirectory(chrome_dir_4); - ASSERT_TRUE(file_util::PathExists(chrome_dir_4)); + ASSERT_TRUE(base::PathExists(chrome_dir_4)); base::FilePath chrome_dll_1(chrome_dir_1); chrome_dll_1 = chrome_dll_1.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_1.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_1)); + ASSERT_TRUE(base::PathExists(chrome_dll_1)); base::FilePath chrome_dll_2(chrome_dir_2); chrome_dll_2 = chrome_dll_2.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_2.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_2)); + ASSERT_TRUE(base::PathExists(chrome_dll_2)); // Open the file to make it in use. std::ofstream file; @@ -204,22 +204,22 @@ TEST_F(InstallerStateTest, DeleteInUsed) { base::FilePath chrome_othera_2(chrome_dir_2); chrome_othera_2 = chrome_othera_2.AppendASCII("othera.dll"); CreateTextFile(chrome_othera_2.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(chrome_othera_2)); + ASSERT_TRUE(base::PathExists(chrome_othera_2)); base::FilePath chrome_otherb_2(chrome_dir_2); chrome_otherb_2 = chrome_otherb_2.AppendASCII("otherb.dll"); CreateTextFile(chrome_otherb_2.value(), text_content_2); - ASSERT_TRUE(file_util::PathExists(chrome_otherb_2)); + ASSERT_TRUE(base::PathExists(chrome_otherb_2)); base::FilePath chrome_dll_3(chrome_dir_3); chrome_dll_3 = chrome_dll_3.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_3.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_3)); + ASSERT_TRUE(base::PathExists(chrome_dll_3)); base::FilePath chrome_dll_4(chrome_dir_4); chrome_dll_4 = chrome_dll_4.AppendASCII("chrome.dll"); CreateTextFile(chrome_dll_4.value(), text_content_1); - ASSERT_TRUE(file_util::PathExists(chrome_dll_4)); + ASSERT_TRUE(base::PathExists(chrome_dll_4)); MockInstallerState installer_state; BuildSingleChromeState(chrome_dir, &installer_state); @@ -234,16 +234,16 @@ TEST_F(InstallerStateTest, DeleteInUsed) { } // the version defined as the existing version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dir_1)); + EXPECT_TRUE(base::PathExists(chrome_dir_1)); // old versions not in used should be gone - EXPECT_FALSE(file_util::PathExists(chrome_dir_3)); + EXPECT_FALSE(base::PathExists(chrome_dir_3)); // every thing under in used version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dir_2)); - EXPECT_TRUE(file_util::PathExists(chrome_dll_2)); - EXPECT_TRUE(file_util::PathExists(chrome_othera_2)); - EXPECT_TRUE(file_util::PathExists(chrome_otherb_2)); + EXPECT_TRUE(base::PathExists(chrome_dir_2)); + EXPECT_TRUE(base::PathExists(chrome_dll_2)); + EXPECT_TRUE(base::PathExists(chrome_othera_2)); + EXPECT_TRUE(base::PathExists(chrome_otherb_2)); // the latest version should stay - EXPECT_TRUE(file_util::PathExists(chrome_dll_4)); + EXPECT_TRUE(base::PathExists(chrome_dll_4)); } // Tests a few basic things of the Package class. Makes sure that the path @@ -281,20 +281,20 @@ TEST_F(InstallerStateTest, Basic) { base::FilePath old_version_dir(installer_state.target_path().Append( UTF8ToWide(old_version.GetString()))); - EXPECT_FALSE(file_util::PathExists(new_version_dir)); - EXPECT_FALSE(file_util::PathExists(old_version_dir)); + EXPECT_FALSE(base::PathExists(new_version_dir)); + EXPECT_FALSE(base::PathExists(old_version_dir)); - EXPECT_FALSE(file_util::PathExists(installer_dir)); + EXPECT_FALSE(base::PathExists(installer_dir)); file_util::CreateDirectory(installer_dir); - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); file_util::CreateDirectory(old_version_dir); - EXPECT_TRUE(file_util::PathExists(old_version_dir)); + EXPECT_TRUE(base::PathExists(old_version_dir)); // Create a fake chrome.dll key file in the old version directory. This // should prevent the old version directory from getting deleted. base::FilePath old_chrome_dll(old_version_dir.Append(installer::kChromeDll)); - EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); + EXPECT_FALSE(base::PathExists(old_chrome_dll)); // Hold on to the file exclusively to prevent the directory from // being deleted. @@ -302,7 +302,7 @@ TEST_F(InstallerStateTest, Basic) { ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, 0, NULL, OPEN_ALWAYS, 0, NULL)); EXPECT_TRUE(file.IsValid()); - EXPECT_TRUE(file_util::PathExists(old_chrome_dll)); + EXPECT_TRUE(base::PathExists(old_chrome_dll)); base::ScopedTempDir temp_dir; ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); @@ -314,8 +314,8 @@ TEST_F(InstallerStateTest, Basic) { temp_dir.path()); // The old directory should still exist. - EXPECT_TRUE(file_util::PathExists(old_version_dir)); - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(old_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); // Now close the file handle to make it possible to delete our key file. file.Close(); @@ -324,11 +324,11 @@ TEST_F(InstallerStateTest, Basic) { NULL, temp_dir.path()); // The new directory should still exist. - EXPECT_TRUE(file_util::PathExists(new_version_dir)); + EXPECT_TRUE(base::PathExists(new_version_dir)); // Now, the old directory and key file should be gone. - EXPECT_FALSE(file_util::PathExists(old_chrome_dll)); - EXPECT_FALSE(file_util::PathExists(old_version_dir)); + EXPECT_FALSE(base::PathExists(old_chrome_dll)); + EXPECT_FALSE(base::PathExists(old_version_dir)); } TEST_F(InstallerStateTest, WithProduct) { @@ -536,7 +536,7 @@ TEST_F(InstallerStateTest, RemoveOldVersionDirs) { // Create the version directories. for (int i = 0; i < arraysize(version_dirs); i++) { file_util::CreateDirectory(version_dirs[i]); - EXPECT_TRUE(file_util::PathExists(version_dirs[i])); + EXPECT_TRUE(base::PathExists(version_dirs[i])); } // Create exes with the appropriate version resource. diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index adb0172..3116415 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -59,7 +59,7 @@ TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) { (bytes_read == file_util::WriteFile(log_file, &old_log_data[0], bytes_read) || - file_util::PathExists(log_file))) { + base::PathExists(log_file))) { result = LOGFILE_TRUNCATED; } } diff --git a/chrome/installer/util/logging_installer_unittest.cc b/chrome/installer/util/logging_installer_unittest.cc index 722897e..c605be6 100644 --- a/chrome/installer/util/logging_installer_unittest.cc +++ b/chrome/installer/util/logging_installer_unittest.cc @@ -21,7 +21,7 @@ TEST(LoggingInstallerTest, TestTruncate) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); @@ -34,7 +34,7 @@ TEST(LoggingInstallerTest, TestTruncate) { EXPECT_EQ(installer::kTruncatedInstallerLogFileSize , file_size); // Check that the temporary file was deleted. - EXPECT_FALSE(file_util::PathExists(temp_file.Append(L".tmp"))); + EXPECT_FALSE(base::PathExists(temp_file.Append(L".tmp"))); } TEST(LoggingInstallerTest, TestTruncationNotNeeded) { @@ -46,7 +46,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); @@ -54,7 +54,7 @@ TEST(LoggingInstallerTest, TestTruncationNotNeeded) { EXPECT_EQ(installer::LOGFILE_UNTOUCHED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); } @@ -68,7 +68,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); @@ -83,7 +83,7 @@ TEST(LoggingInstallerTest, TestInUseNeedsTruncation) { EXPECT_EQ(installer::LOGFILE_UNTOUCHED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_TRUE(file_util::PathExists(temp_file)); + EXPECT_TRUE(base::PathExists(temp_file)); EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); } @@ -97,7 +97,7 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { base::FilePath temp_file = temp_dir.path().Append(L"temp"); EXPECT_EQ(test_data.size(), file_util::WriteFile(temp_file, &test_data[0], test_data.size())); - ASSERT_TRUE(file_util::PathExists(temp_file)); + ASSERT_TRUE(base::PathExists(temp_file)); int64 file_size = 0; EXPECT_TRUE(file_util::GetFileSize(temp_file, &file_size)); EXPECT_EQ(test_data.size(), file_size); @@ -115,5 +115,5 @@ TEST(LoggingInstallerTest, TestMoveFailsNeedsTruncation) { EXPECT_EQ(installer::LOGFILE_DELETED, installer::TruncateLogFileIfNeeded(temp_file)); - EXPECT_FALSE(file_util::PathExists(temp_file)); + EXPECT_FALSE(base::PathExists(temp_file)); } diff --git a/chrome/installer/util/lzma_util_unittest.cc b/chrome/installer/util/lzma_util_unittest.cc index a2fe6eb..668f42c 100644 --- a/chrome/installer/util/lzma_util_unittest.cc +++ b/chrome/installer/util/lzma_util_unittest.cc @@ -18,7 +18,7 @@ class LzmaUtilTest : public testing::Test { virtual void SetUp() { ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_dir_)); data_dir_ = data_dir_.AppendASCII("installer"); - ASSERT_TRUE(file_util::PathExists(data_dir_)); + ASSERT_TRUE(base::PathExists(data_dir_)); ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } @@ -55,9 +55,9 @@ TEST_F(LzmaUtilTest, OpenArchiveTest) { TEST_F(LzmaUtilTest, UnPackTest) { base::FilePath extract_dir(temp_dir_.path()); extract_dir = extract_dir.AppendASCII("UnPackTest"); - ASSERT_FALSE(file_util::PathExists(extract_dir)); + ASSERT_FALSE(base::PathExists(extract_dir)); EXPECT_TRUE(file_util::CreateDirectory(extract_dir)); - ASSERT_TRUE(file_util::PathExists(extract_dir)); + ASSERT_TRUE(base::PathExists(extract_dir)); base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); LzmaUtil lzma_util; @@ -65,14 +65,14 @@ TEST_F(LzmaUtilTest, UnPackTest) { std::wstring unpacked_file; EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("a.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); lzma_util.CloseArchive(); @@ -87,8 +87,8 @@ TEST_F(LzmaUtilTest, UnPackTest) { EXPECT_EQ(lzma_util.OpenArchive(archive.value()), NO_ERROR); EXPECT_EQ(lzma_util.UnPack(extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); - EXPECT_TRUE(file_util::PathExists( + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("archive\\a.exe"))); + EXPECT_TRUE(base::PathExists( extract_dir.AppendASCII("archive\\sub_dir\\text.txt"))); } @@ -96,21 +96,21 @@ TEST_F(LzmaUtilTest, UnPackTest) { TEST_F(LzmaUtilTest, UnPackArchiveTest) { base::FilePath extract_dir(temp_dir_.path()); extract_dir = extract_dir.AppendASCII("UnPackArchiveTest"); - ASSERT_FALSE(file_util::PathExists(extract_dir)); + ASSERT_FALSE(base::PathExists(extract_dir)); EXPECT_TRUE(file_util::CreateDirectory(extract_dir)); - ASSERT_TRUE(file_util::PathExists(extract_dir)); + ASSERT_TRUE(base::PathExists(extract_dir)); base::FilePath archive = data_dir_.AppendASCII("archive1.7z"); std::wstring unpacked_file; EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("a.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("a.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("a.exe").value()); archive = data_dir_.AppendASCII("archive2.7z"); EXPECT_EQ(LzmaUtil::UnPackArchive(archive.value(), extract_dir.value(), &unpacked_file), NO_ERROR); - EXPECT_TRUE(file_util::PathExists(extract_dir.AppendASCII("b.exe"))); + EXPECT_TRUE(base::PathExists(extract_dir.AppendASCII("b.exe"))); EXPECT_TRUE(unpacked_file == extract_dir.AppendASCII("b.exe").value()); archive = data_dir_.AppendASCII("invalid_archive.7z"); diff --git a/chrome/installer/util/master_preferences.cc b/chrome/installer/util/master_preferences.cc index 6e8a94f..d345e95 100644 --- a/chrome/installer/util/master_preferences.cc +++ b/chrome/installer/util/master_preferences.cc @@ -101,7 +101,7 @@ MasterPreferences::MasterPreferences(const base::FilePath& prefs_path) // Failure to read the file is ignored as |json_data| will be the empty string // and the remainder of this MasterPreferences object should still be // initialized as best as possible. - if (file_util::PathExists(prefs_path) && + if (base::PathExists(prefs_path) && !file_util::ReadFileToString(prefs_path, &json_data)) { LOG(ERROR) << "Failed to read preferences from " << prefs_path.value(); } diff --git a/chrome/installer/util/move_tree_work_item.cc b/chrome/installer/util/move_tree_work_item.cc index ccbbf64..a1b7b03 100644 --- a/chrome/installer/util/move_tree_work_item.cc +++ b/chrome/installer/util/move_tree_work_item.cc @@ -28,7 +28,7 @@ MoveTreeWorkItem::MoveTreeWorkItem(const base::FilePath& source_path, } bool MoveTreeWorkItem::Do() { - if (!file_util::PathExists(source_path_)) { + if (!base::PathExists(source_path_)) { LOG(ERROR) << source_path_.value() << " does not exist"; return false; } @@ -41,7 +41,7 @@ bool MoveTreeWorkItem::Do() { // 2) If the contents of src_path_ are NOT fully contained in dest_path_, we // attempt to backup dest_path_ and replace it with src_path_. This will // fail if files in dest_path_ are in use. - if (file_util::PathExists(dest_path_)) { + if (base::PathExists(dest_path_)) { // Generate a backup path that can keep the original files under dest_path_. if (!backup_path_.CreateUniqueTempDirUnderPath(temp_dir_)) { PLOG(ERROR) << "Failed to get backup path in folder " diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc index 011f9ca..3402787 100644 --- a/chrome/installer/util/move_tree_work_item_unittest.cc +++ b/chrome/installer/util/move_tree_work_item_unittest.cc @@ -62,27 +62,27 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Generate destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); - ASSERT_FALSE(file_util::PathExists(to_dir)); + ASSERT_FALSE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("From_Dir2"); to_file = to_file.AppendASCII("From_File"); - ASSERT_FALSE(file_util::PathExists(to_file)); + ASSERT_FALSE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -92,16 +92,16 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectory) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_FALSE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(to_file)); + EXPECT_FALSE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(from_file)); - EXPECT_FALSE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(from_file)); + EXPECT_FALSE(base::PathExists(to_dir)); } // Move one directory from source to destination when destination already @@ -111,33 +111,33 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath orig_to_file(to_dir); orig_to_file = orig_to_file.AppendASCII("To_File"); CreateTextFile(orig_to_file.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(orig_to_file)); + ASSERT_TRUE(base::PathExists(orig_to_file)); base::FilePath new_to_file(to_dir); new_to_file = new_to_file.AppendASCII("From_Dir2"); new_to_file = new_to_file.AppendASCII("From_File"); - ASSERT_FALSE(file_util::PathExists(new_to_file)); + ASSERT_FALSE(base::PathExists(new_to_file)); // test Do(), don't check for duplicates. scoped_ptr<MoveTreeWorkItem> work_item( @@ -147,18 +147,18 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExists) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_FALSE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(new_to_file)); - EXPECT_FALSE(file_util::PathExists(orig_to_file)); + EXPECT_FALSE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(new_to_file)); + EXPECT_FALSE(base::PathExists(orig_to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_FALSE(file_util::PathExists(new_to_file)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_FALSE(base::PathExists(new_to_file)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent2)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -170,17 +170,17 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Generate destination file name base::FilePath to_file(temp_from_dir_.path()); to_file = to_file.AppendASCII("To_File"); - ASSERT_FALSE(file_util::PathExists(to_file)); + ASSERT_FALSE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -190,17 +190,17 @@ TEST_F(MoveTreeWorkItemTest, MoveAFile) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_TRUE(file_util::PathExists(from_file)); - EXPECT_FALSE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_file)); + EXPECT_FALSE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -211,23 +211,23 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); CreateTextFile(to_file.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // test Do() scoped_ptr<MoveTreeWorkItem> work_item( @@ -237,18 +237,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestExists) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_FALSE(file_util::PathExists(to_file)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_FALSE(base::PathExists(to_file)); EXPECT_EQ(0, ReadTextFile(to_dir).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent2)); } @@ -259,18 +259,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + 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()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); wchar_t exe_full_path_str[MAX_PATH]; ::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH); @@ -278,7 +278,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); base::CopyFile(exe_full_path, to_file); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // Run the executable in destination path STARTUPINFOW si = {sizeof(si)}; @@ -297,17 +297,17 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); TerminateProcess(pi.hProcess, 0); @@ -322,7 +322,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { base::FilePath from_dir(temp_from_dir_.path()); from_dir = from_dir.AppendASCII("From_Dir"); file_util::CreateDirectory(from_dir); - ASSERT_TRUE(file_util::PathExists(from_dir)); + ASSERT_TRUE(base::PathExists(from_dir)); wchar_t exe_full_path_str[MAX_PATH]; ::GetModuleFileName(NULL, exe_full_path_str, MAX_PATH); @@ -330,18 +330,18 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { base::FilePath from_file(from_dir); from_file = from_file.AppendASCII("From_File"); base::CopyFile(exe_full_path, from_file); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); // Create a destination source dir and generate destination file name. base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); base::FilePath to_file(to_dir); to_file = to_file.AppendASCII("To_File"); CreateTextFile(to_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(to_file)); + ASSERT_TRUE(base::PathExists(to_file)); // Run the executable in source path STARTUPINFOW si = {sizeof(si)}; @@ -360,9 +360,9 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { WorkItem::ALWAYS_MOVE)); EXPECT_TRUE(work_item->Do()); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); // Close the process and make sure all the conditions after Do() are @@ -372,17 +372,17 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { CloseHandle(pi.hProcess); CloseHandle(pi.hThread); - EXPECT_TRUE(file_util::PathExists(from_dir)); - EXPECT_FALSE(file_util::PathExists(from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); + EXPECT_FALSE(base::PathExists(from_file)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); // test rollback() work_item->Rollback(); - EXPECT_TRUE(file_util::PathExists(from_dir)); + EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); - EXPECT_TRUE(file_util::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); } @@ -393,17 +393,17 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + 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()); @@ -435,10 +435,10 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { // Make sure that we "moved" the files, i.e. that the source directory isn't // there anymore, - EXPECT_FALSE(file_util::PathExists(from_dir1)); + EXPECT_FALSE(base::PathExists(from_dir1)); // Make sure that the original directory structure and file are still present. - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); // Make sure that the backup path is not empty. EXPECT_FALSE(file_util::IsDirectoryEmpty(temp_to_dir_.path())); @@ -452,9 +452,9 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesFull) { // Once we rollback all the original files should still be there, as should // the source files. - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent1)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); } @@ -466,40 +466,40 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { base::FilePath from_dir1(temp_from_dir_.path()); from_dir1 = from_dir1.AppendASCII("From_Dir1"); file_util::CreateDirectory(from_dir1); - ASSERT_TRUE(file_util::PathExists(from_dir1)); + ASSERT_TRUE(base::PathExists(from_dir1)); base::FilePath from_dir2(from_dir1); from_dir2 = from_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(from_dir2); - ASSERT_TRUE(file_util::PathExists(from_dir2)); + ASSERT_TRUE(base::PathExists(from_dir2)); base::FilePath from_file(from_dir2); from_file = from_file.AppendASCII("From_File"); CreateTextFile(from_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(from_file)); + ASSERT_TRUE(base::PathExists(from_file)); base::FilePath from_file2(from_dir2); from_file2 = from_file2.AppendASCII("From_File2"); CreateTextFile(from_file2.value(), kTextContent2); - ASSERT_TRUE(file_util::PathExists(from_file2)); + ASSERT_TRUE(base::PathExists(from_file2)); // Create destination path base::FilePath to_dir(temp_from_dir_.path()); to_dir = to_dir.AppendASCII("To_Dir"); file_util::CreateDirectory(to_dir); - ASSERT_TRUE(file_util::PathExists(to_dir)); + ASSERT_TRUE(base::PathExists(to_dir)); // Create a sub-directory of the same name as in the source directory. base::FilePath to_dir2(to_dir); to_dir2 = to_dir2.AppendASCII("From_Dir2"); file_util::CreateDirectory(to_dir2); - ASSERT_TRUE(file_util::PathExists(to_dir2)); + ASSERT_TRUE(base::PathExists(to_dir2)); // Create one of the files in the to sub-directory, but not the other. base::FilePath orig_to_file(to_dir2); orig_to_file = orig_to_file.AppendASCII("From_File"); CreateTextFile(orig_to_file.value(), kTextContent1); - ASSERT_TRUE(file_util::PathExists(orig_to_file)); + ASSERT_TRUE(base::PathExists(orig_to_file)); // test Do(), check for duplicates. scoped_ptr<MoveTreeWorkItem> work_item( @@ -511,16 +511,16 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { // Make sure that we "moved" the files, i.e. that the source directory isn't // there anymore, - EXPECT_FALSE(file_util::PathExists(from_dir1)); + EXPECT_FALSE(base::PathExists(from_dir1)); // Make sure that the original directory structure and file are still present. - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); // Make sure that the backup path is not empty. EXPECT_FALSE(file_util::IsDirectoryEmpty(temp_to_dir_.path())); // 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"); - EXPECT_TRUE(file_util::PathExists(new_to_file2)); + EXPECT_TRUE(base::PathExists(new_to_file2)); // Check that the work item believes that this was a regular move. EXPECT_FALSE(work_item->source_moved_to_backup_); @@ -532,12 +532,12 @@ TEST_F(MoveTreeWorkItemTest, MoveDirectoryDestExistsCheckForDuplicatesPartial) { // Once we rollback all the original files should still be there, as should // the source files. - EXPECT_TRUE(file_util::PathExists(from_dir1)); - EXPECT_TRUE(file_util::PathExists(to_dir)); - EXPECT_TRUE(file_util::PathExists(orig_to_file)); + EXPECT_TRUE(base::PathExists(from_dir1)); + EXPECT_TRUE(base::PathExists(to_dir)); + EXPECT_TRUE(base::PathExists(orig_to_file)); EXPECT_EQ(0, ReadTextFile(orig_to_file).compare(kTextContent1)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); // Also, after rollback the new "to" file should be gone. - EXPECT_FALSE(file_util::PathExists(new_to_file2)); + EXPECT_FALSE(base::PathExists(new_to_file2)); } diff --git a/chrome/installer/util/self_cleaning_temp_dir.cc b/chrome/installer/util/self_cleaning_temp_dir.cc index bb2fd6c..8b85926 100644 --- a/chrome/installer/util/self_cleaning_temp_dir.cc +++ b/chrome/installer/util/self_cleaning_temp_dir.cc @@ -21,7 +21,7 @@ void SelfCleaningTempDir::GetTopDirToCreate( base::FilePath* base_dir) { DCHECK(base_dir); - if (file_util::PathExists(temp_parent_dir)) { + if (base::PathExists(temp_parent_dir)) { // Empty base_dir means that we didn't create any extra directories. base_dir->clear(); } else { @@ -29,7 +29,7 @@ void SelfCleaningTempDir::GetTopDirToCreate( do { *base_dir = parent_dir; parent_dir = parent_dir.DirName(); - } while (parent_dir != *base_dir && !file_util::PathExists(parent_dir)); + } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); LOG_IF(WARNING, !file_util::DirectoryExists(parent_dir)) << "A non-directory is at the base of the path leading to a desired " "temp directory location: " << parent_dir.value(); diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index 4a196ea..c7da3e7 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -692,7 +692,7 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, base::FilePath exe_path = base::FilePath::FromWStringHack(chrome_exe).DirName() .Append(installer::kSetupExe); - if (!file_util::PathExists(exe_path)) { + if (!base::PathExists(exe_path)) { HKEY reg_root = InstallUtil::IsPerUserInstall(chrome_exe.c_str()) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; RegKey key(reg_root, dist->GetUninstallRegPath().c_str(), KEY_READ); @@ -702,7 +702,7 @@ bool ElevateAndRegisterChrome(BrowserDistribution* dist, exe_path = command_line.GetProgram(); } - if (file_util::PathExists(exe_path)) { + if (base::PathExists(exe_path)) { CommandLine cmd(exe_path); cmd.AppendSwitchNative(installer::switches::kRegisterChromeBrowser, chrome_exe); @@ -1438,7 +1438,7 @@ bool ShellUtil::CreateOrUpdateShortcut( // Install the system-level shortcut if requested. chosen_path = &system_shortcut_path; } else if (operation != SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL || - !file_util::PathExists(system_shortcut_path)) { + !base::PathExists(system_shortcut_path)) { // Otherwise install the user-level shortcut, unless the system-level // variant of this shortcut is present on the machine and |operation| states // not to create a user-level shortcut in that case. diff --git a/chrome/installer/util/shell_util_unittest.cc b/chrome/installer/util/shell_util_unittest.cc index 73d2b27..45b5738 100644 --- a/chrome/installer/util/shell_util_unittest.cc +++ b/chrome/installer/util/shell_util_unittest.cc @@ -306,7 +306,7 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_common_desktop_.path().Append(shortcut_name))); test_properties_->level = ShellUtil::CURRENT_USER; @@ -314,7 +314,7 @@ TEST_F(ShellUtilShortcutTest, CreateIfNoSystemLevelWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_IF_NO_SYSTEM_LEVEL)); - ASSERT_FALSE(file_util::PathExists( + ASSERT_FALSE(base::PathExists( fake_user_desktop_.path().Append(shortcut_name))); } @@ -335,7 +335,7 @@ TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_common_desktop_.path().Append(shortcut_name))); test_properties_->level = ShellUtil::CURRENT_USER; @@ -343,7 +343,7 @@ TEST_F(ShellUtilShortcutTest, CreateAlwaysUserWithSystemLevelPresent) { ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, *test_properties_, ShellUtil::SHELL_SHORTCUT_CREATE_ALWAYS)); - ASSERT_TRUE(file_util::PathExists( + ASSERT_TRUE(base::PathExists( fake_user_desktop_.path().Append(shortcut_name))); } @@ -355,13 +355,13 @@ TEST_F(ShellUtilShortcutTest, RemoveChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { @@ -374,13 +374,13 @@ TEST_F(ShellUtilShortcutTest, RemoveSystemLevelChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::SYSTEM_LEVEL, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { @@ -396,7 +396,7 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { string16(kShortcutName1).append(installer::kLnkExt)); base::FilePath shortcut1_path( fake_user_desktop_.path().Append(shortcut1_name)); - ASSERT_TRUE(file_util::PathExists(shortcut1_path)); + ASSERT_TRUE(base::PathExists(shortcut1_path)); test_properties_->set_shortcut_name(kShortcutName2); test_properties_->set_arguments(L"--profile-directory=\"Profile 2\""); @@ -407,14 +407,14 @@ TEST_F(ShellUtilShortcutTest, RemoveMultipleChromeShortcuts) { string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); base::FilePath shortcut2_path( fake_user_desktop_.path().Append(shortcut2_name)); - ASSERT_TRUE(file_util::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut2_path)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut1_path)); - ASSERT_FALSE(file_util::PathExists(shortcut2_path)); - ASSERT_TRUE(file_util::PathExists(shortcut1_path.DirName())); + ASSERT_FALSE(base::PathExists(shortcut1_path)); + ASSERT_FALSE(base::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut1_path.DirName())); } TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { @@ -425,7 +425,7 @@ TEST_F(ShellUtilShortcutTest, UpdateChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -451,7 +451,7 @@ TEST_F(ShellUtilShortcutTest, UpdateSystemLevelChromeShortcut) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path( fake_common_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -491,7 +491,7 @@ TEST_F(ShellUtilShortcutTest, UpdateMultipleChromeShortcuts) { string16 shortcut2_name(string16(kShortcutName2).append(installer::kLnkExt)); base::FilePath shortcut2_path( fake_user_desktop_.path().Append(shortcut2_name)); - ASSERT_TRUE(file_util::PathExists(shortcut2_path)); + ASSERT_TRUE(base::PathExists(shortcut2_path)); base::FilePath new_exe = temp_dir_.path().Append(L"manganese.exe"); ShellUtil::ShortcutProperties updated_properties(ShellUtil::CURRENT_USER); @@ -534,11 +534,11 @@ TEST_F(ShellUtilShortcutTest, CreateMultipleStartMenuShortcutsAndRemoveFolder) { ++count; EXPECT_EQ(2, count); - ASSERT_TRUE(file_util::PathExists(shortcut_folder)); + ASSERT_TRUE(base::PathExists(shortcut_folder)); ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_START_MENU, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_FALSE(file_util::PathExists(shortcut_folder)); + ASSERT_FALSE(base::PathExists(shortcut_folder)); } TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { @@ -556,7 +556,7 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { string16 shortcut_name(dist_->GetAppShortCutName() + installer::kLnkExt); base::FilePath shortcut_path(fake_user_desktop_.path().Append(shortcut_name)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path)); // The shortcut shouldn't be removed as it was installed pointing to // |other_chrome_exe| and RemoveChromeShortcut() is being told that the @@ -564,8 +564,8 @@ TEST_F(ShellUtilShortcutTest, DontRemoveChromeShortcutIfPointsToAnotherChrome) { ASSERT_TRUE(ShellUtil::RemoveShortcuts( ShellUtil::SHORTCUT_LOCATION_DESKTOP, dist_, ShellUtil::CURRENT_USER, chrome_exe_)); - ASSERT_TRUE(file_util::PathExists(shortcut_path)); - ASSERT_TRUE(file_util::PathExists(shortcut_path.DirName())); + ASSERT_TRUE(base::PathExists(shortcut_path)); + ASSERT_TRUE(base::PathExists(shortcut_path.DirName())); } TEST(ShellUtilTest, BuildAppModelIdBasic) { diff --git a/chrome/installer/util/work_item_list_unittest.cc b/chrome/installer/util/work_item_list_unittest.cc index f6c2322..0944b07 100644 --- a/chrome/installer/util/work_item_list_unittest.cc +++ b/chrome/installer/util/work_item_list_unittest.cc @@ -59,7 +59,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -90,7 +90,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(name.c_str(), &read_out)); EXPECT_EQ(0, read_out.compare(kDataStr)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -99,7 +99,7 @@ TEST_F(WorkItemListTest, ExecutionSuccess) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } // Execute a WorkItem list. Fail in the middle. Rollback what has been done. @@ -111,7 +111,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -148,7 +148,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { EXPECT_EQ(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); // The last one should not be there. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, not_created_key.c_str(), KEY_READ)); @@ -158,7 +158,7 @@ TEST_F(WorkItemListTest, ExecutionFailAndRollback) { // Verify everything is rolled back. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { @@ -169,7 +169,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -205,7 +205,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { EXPECT_EQ(ERROR_SUCCESS, key.ReadValue(name.c_str(), &read_out)); EXPECT_EQ(0, read_out.compare(kDataStr)); key.Close(); - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -214,7 +214,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionSuccess) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { @@ -225,7 +225,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { top_dir_to_create = top_dir_to_create.AppendASCII("a"); base::FilePath dir_to_create(top_dir_to_create); dir_to_create = dir_to_create.AppendASCII("b"); - ASSERT_FALSE(file_util::PathExists(dir_to_create)); + ASSERT_FALSE(base::PathExists(dir_to_create)); work_item.reset(reinterpret_cast<WorkItem*>( WorkItem::CreateCreateDirWorkItem(dir_to_create))); @@ -263,7 +263,7 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { key.Close(); // Verify that the other work item was executed. - EXPECT_TRUE(file_util::PathExists(dir_to_create)); + EXPECT_TRUE(base::PathExists(dir_to_create)); work_item_list->Rollback(); @@ -272,5 +272,5 @@ TEST_F(WorkItemListTest, ConditionalExecutionConditionFailure) { // can not be deleted. EXPECT_NE(ERROR_SUCCESS, key.Open(HKEY_CURRENT_USER, key_to_create.c_str(), KEY_READ)); - EXPECT_FALSE(file_util::PathExists(top_dir_to_create)); + EXPECT_FALSE(base::PathExists(top_dir_to_create)); } diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc index 179308a..d7c8fca 100644 --- a/chrome/renderer/chrome_render_process_observer.cc +++ b/chrome/renderer/chrome_render_process_observer.cc @@ -289,7 +289,7 @@ ChromeRenderProcessObserver::ChromeRenderProcessObserver( // Need to patch a few functions for font loading to work correctly. base::FilePath pdf; if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && - file_util::PathExists(pdf)) { + base::PathExists(pdf)) { g_iat_patch_createdca.Patch( pdf.value().c_str(), "gdi32.dll", "CreateDCA", CreateDCAPatch); g_iat_patch_get_font_data.Patch( diff --git a/chrome/renderer/spellchecker/spellcheck_unittest.cc b/chrome/renderer/spellchecker/spellcheck_unittest.cc index 5f40d7ab..8162944 100644 --- a/chrome/renderer/spellchecker/spellcheck_unittest.cc +++ b/chrome/renderer/spellchecker/spellcheck_unittest.cc @@ -1291,7 +1291,7 @@ TEST_F(SpellCheckTest, DictionaryFiles) { for (size_t i = 0; i < spellcheck_languages.size(); ++i) { base::FilePath dict = chrome::spellcheck_common::GetVersionedFileName( spellcheck_languages[i], hunspell); - EXPECT_TRUE(file_util::PathExists(dict)) << dict.value() << " not found"; + EXPECT_TRUE(base::PathExists(dict)) << dict.value() << " not found"; } } diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc index 97e9d3c..004e32bd 100644 --- a/chrome/test/automation/proxy_launcher.cc +++ b/chrome/test/automation/proxy_launcher.cc @@ -82,7 +82,7 @@ void UpdateHistoryDates(const base::FilePath& user_data_dir) { base::FilePath history = user_data_dir.AppendASCII("Default").AppendASCII("History"); // Not all test profiles have a history file. - if (!file_util::PathExists(history)) + if (!base::PathExists(history)) return; ASSERT_TRUE(db.Open(history)); diff --git a/chrome/test/base/testing_profile.cc b/chrome/test/base/testing_profile.cc index d521860..c08433e 100644 --- a/chrome/test/base/testing_profile.cc +++ b/chrome/test/base/testing_profile.cc @@ -291,7 +291,7 @@ void TestingProfile::Init() { else CreateTestingPrefService(); - if (!file_util::PathExists(profile_path_)) + if (!base::PathExists(profile_path_)) file_util::CreateDirectory(profile_path_); // TODO(joaodasilva): remove this once this PKS isn't created in ProfileImpl diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc index 61f8b26..6fe7fec 100644 --- a/chrome/test/base/ui_test_utils.cc +++ b/chrome/test/base/ui_test_utils.cc @@ -109,14 +109,14 @@ base::FilePath GetSnapshotFileName(const base::FilePath& snapshot_directory) { the_time.hour, the_time.minute, the_time.second, kSnapshotExtension)); base::FilePath snapshot_file = snapshot_directory.AppendASCII(filename); - if (file_util::PathExists(snapshot_file)) { + if (base::PathExists(snapshot_file)) { int index = 0; std::string suffix; base::FilePath trial_file; do { suffix = base::StringPrintf(" (%d)", ++index); trial_file = snapshot_file.InsertBeforeExtensionASCII(suffix); - } while (file_util::PathExists(trial_file)); + } while (base::PathExists(trial_file)); snapshot_file = trial_file; } return snapshot_file; diff --git a/chrome/test/base/v8_unit_test.cc b/chrome/test/base/v8_unit_test.cc index 1103a5c..b60502cc 100644 --- a/chrome/test/base/v8_unit_test.cc +++ b/chrome/test/base/v8_unit_test.cc @@ -67,7 +67,7 @@ bool V8UnitTest::ExecuteJavascriptLibraries() { base::FilePath library_file(*user_libraries_iterator); if (!user_libraries_iterator->IsAbsolute()) { base::FilePath gen_file = gen_test_data_directory.Append(library_file); - library_file = file_util::PathExists(gen_file) ? gen_file : + library_file = base::PathExists(gen_file) ? gen_file : test_data_directory.Append(*user_libraries_iterator); } library_file = base::MakeAbsoluteFilePath(library_file); diff --git a/chrome/test/base/web_ui_browsertest.cc b/chrome/test/base/web_ui_browsertest.cc index e523d7c..b4f4690 100644 --- a/chrome/test/base/web_ui_browsertest.cc +++ b/chrome/test/base/web_ui_browsertest.cc @@ -432,7 +432,7 @@ GURL WebUIBrowserTest::WebUITestDataPathToURL( base::FilePath dir_test_data; EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); - EXPECT_TRUE(file_util::PathExists(test_path)); + EXPECT_TRUE(base::PathExists(test_path)); return net::FilePathToFileURL(test_path); } diff --git a/chrome/test/chromedriver/chrome/chrome_finder.cc b/chrome/test/chromedriver/chrome/chrome_finder.cc index 4006174..a6e9426 100644 --- a/chrome/test/chromedriver/chrome/chrome_finder.cc +++ b/chrome/test/chromedriver/chrome/chrome_finder.cc @@ -107,7 +107,7 @@ bool FindChrome(base::FilePath* browser_exe) { locations.push_back(module_dir); GetApplicationDirs(&locations); return internal::FindExe( - base::Bind(&file_util::PathExists), + base::Bind(&base::PathExists), browser_exes, locations, browser_exe); diff --git a/chrome/test/chromedriver/chrome_launcher.cc b/chrome/test/chromedriver/chrome_launcher.cc index f7fb437..f686261 100644 --- a/chrome/test/chromedriver/chrome_launcher.cc +++ b/chrome/test/chromedriver/chrome_launcher.cc @@ -76,7 +76,7 @@ Status PrepareCommandLine(int port, if (!FindChrome(&program)) return Status(kUnknownError, "cannot find Chrome binary"); command.SetProgram(program); - } else if (!file_util::PathExists(program)) { + } else if (!base::PathExists(program)) { return Status(kUnknownError, base::StringPrintf("no chrome binary at %" PRFilePath, program.value().c_str())); diff --git a/chrome/test/chromedriver/chrome_launcher_unittest.cc b/chrome/test/chromedriver/chrome_launcher_unittest.cc index 963d928..369fb9c 100644 --- a/chrome/test/chromedriver/chrome_launcher_unittest.cc +++ b/chrome/test/chromedriver/chrome_launcher_unittest.cc @@ -49,7 +49,7 @@ TEST(ProcessExtensions, SingleExtension) { ASSERT_TRUE(status.IsOk()); ASSERT_TRUE(command.HasSwitch("load-extension")); base::FilePath temp_ext_path = command.GetSwitchValuePath("load-extension"); - ASSERT_TRUE(file_util::PathExists(temp_ext_path)); + ASSERT_TRUE(base::PathExists(temp_ext_path)); } TEST(ProcessExtensions, MultipleExtensions) { @@ -84,8 +84,8 @@ TEST(ProcessExtensions, MultipleExtensions) { std::vector<CommandLine::StringType> ext_path_list; base::SplitString(ext_paths, FILE_PATH_LITERAL(','), &ext_path_list); ASSERT_EQ(2u, ext_path_list.size()); - ASSERT_TRUE(file_util::PathExists(base::FilePath(ext_path_list[0]))); - ASSERT_TRUE(file_util::PathExists(base::FilePath(ext_path_list[1]))); + ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[0]))); + ASSERT_TRUE(base::PathExists(base::FilePath(ext_path_list[1]))); } namespace { diff --git a/chrome/test/chromedriver/session_commands_unittest.cc b/chrome/test/chromedriver/session_commands_unittest.cc index 22c9128..33a748b 100644 --- a/chrome/test/chromedriver/session_commands_unittest.cc +++ b/chrome/test/chromedriver/session_commands_unittest.cc @@ -114,7 +114,7 @@ TEST(SessionCommandTest, FileUpload) { ASSERT_EQ(kOk, status.code()) << status.message(); base::FilePath::StringType path; ASSERT_TRUE(value->GetAsString(&path)); - ASSERT_TRUE(file_util::PathExists(base::FilePath(path))); + ASSERT_TRUE(base::PathExists(base::FilePath(path))); std::string data; ASSERT_TRUE(file_util::ReadFileToString(base::FilePath(path), &data)); ASSERT_STREQ("COW\n", data.c_str()); diff --git a/chrome/test/gpu/gpu_feature_browsertest.cc b/chrome/test/gpu/gpu_feature_browsertest.cc index 9223024..f65f799 100644 --- a/chrome/test/gpu/gpu_feature_browsertest.cc +++ b/chrome/test/gpu/gpu_feature_browsertest.cc @@ -91,7 +91,7 @@ class GpuFeatureTest : public InProcessBrowserTest { base::FilePath test_path; test_path = gpu_test_dir_.Append(url); - ASSERT_TRUE(file_util::PathExists(test_path)) + ASSERT_TRUE(base::PathExists(test_path)) << "Missing test file: " << test_path.value(); content::DOMMessageQueue message_queue; @@ -494,7 +494,7 @@ IN_PROC_BROWSER_TEST_F(GpuFeatureTest, IOSurfaceReuse) { const base::FilePath url( FILE_PATH_LITERAL("feature_compositing_static.html")); base::FilePath test_path = gpu_test_dir_.Append(url); - ASSERT_TRUE(file_util::PathExists(test_path)) + ASSERT_TRUE(base::PathExists(test_path)) << "Missing test file: " << test_path.value(); ui_test_utils::NavigateToURL(browser(), net::FilePathToFileURL(test_path)); diff --git a/chrome/test/mini_installer_test/installer_path_provider.cc b/chrome/test/mini_installer_test/installer_path_provider.cc index a4de037..5974661 100644 --- a/chrome/test/mini_installer_test/installer_path_provider.cc +++ b/chrome/test/mini_installer_test/installer_path_provider.cc @@ -110,7 +110,7 @@ bool InstallerPathProvider::GetMiniInstaller(base::FilePath* path) { // Use local copy of installer, else fall back to filer. base::FilePath mini_installer = PathFromExeDir( mini_installer_constants::kChromeMiniInstallerExecutable); - if (file_util::PathExists(mini_installer)) { + if (base::PathExists(mini_installer)) { *path = mini_installer; return true; } @@ -166,7 +166,7 @@ bool InstallerPathProvider::GetStandaloneInstaller(base::FilePath* path) { .Append(mini_installer_constants::kWinFolder) .AppendASCII(standalone_installer_filename); *path = standalone_installer; - return file_util::PathExists(standalone_installer); + return base::PathExists(standalone_installer); } bool InstallerPathProvider::GetSignedStandaloneInstaller(base::FilePath* path) { diff --git a/chrome/test/mini_installer_test/installer_test_util.cc b/chrome/test/mini_installer_test/installer_test_util.cc index 2d8e2d5..8b32f6a 100644 --- a/chrome/test/mini_installer_test/installer_test_util.cc +++ b/chrome/test/mini_installer_test/installer_test_util.cc @@ -59,7 +59,7 @@ bool DeleteInstallDirectory(bool system_level, bool has_install_dir = GetInstallDirectory(system_level, ToBrowserDistributionType(type), &path); - if (!has_install_dir || !file_util::PathExists(path)) + if (!has_install_dir || !base::PathExists(path)) return false; path = path.AppendASCII(version); return base::Delete(path, true); @@ -154,7 +154,7 @@ std::string GetVersion(InstallationValidator::InstallationType product) { } bool Install(const base::FilePath& installer) { - if (!file_util::PathExists(installer)) { + if (!base::PathExists(installer)) { LOG(ERROR) << "Installer does not exist: " << installer.MaybeAsASCII(); return false; } @@ -165,7 +165,7 @@ bool Install(const base::FilePath& installer) { } bool Install(const base::FilePath& installer, const SwitchBuilder& switches) { - if (!file_util::PathExists(installer)) { + if (!base::PathExists(installer)) { LOG(ERROR) << "Installer does not exist: " << installer.MaybeAsASCII(); return false; } @@ -279,7 +279,7 @@ bool Uninstall(bool system_level, bool RunAndWaitForCommandToFinish(CommandLine command) { - if (!file_util::PathExists(command.GetProgram())) { + if (!base::PathExists(command.GetProgram())) { LOG(ERROR) << "Command executable does not exist: " << command.GetProgram().MaybeAsASCII(); return false; diff --git a/chrome/test/mini_installer_test/run_all_unittests.cc b/chrome/test/mini_installer_test/run_all_unittests.cc index 0fd6b81..06a1c1d 100644 --- a/chrome/test/mini_installer_test/run_all_unittests.cc +++ b/chrome/test/mini_installer_test/run_all_unittests.cc @@ -29,10 +29,10 @@ void BackUpProfile(bool chrome_frame) { backup_path = backup_path.Append( mini_installer_constants::kChromeUserDataBackupDir); // Will check if User Data profile is available. - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { // Will check if User Data is already backed up. // If yes, will delete and create new one. - if (file_util::PathExists(backup_path)) + if (base::PathExists(backup_path)) base::Delete(backup_path, true); base::CopyDirectory(path, backup_path, true); } else { diff --git a/chrome/test/nacl/nacl_browsertest_util.cc b/chrome/test/nacl/nacl_browsertest_util.cc index 41cf217..a5b558c 100644 --- a/chrome/test/nacl/nacl_browsertest_util.cc +++ b/chrome/test/nacl/nacl_browsertest_util.cc @@ -202,7 +202,7 @@ void NaClBrowserTestBase::SetUpInProcessBrowserTestFixture() { // Sanity check. base::FilePath plugin_lib; ASSERT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); - ASSERT_TRUE(file_util::PathExists(plugin_lib)) << plugin_lib.value(); + ASSERT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value(); ASSERT_TRUE(StartTestServer()) << "Cannot start test server."; } diff --git a/chrome/test/perf/rendering/throughput_tests.cc b/chrome/test/perf/rendering/throughput_tests.cc index cbce083..e54c224 100644 --- a/chrome/test/perf/rendering/throughput_tests.cc +++ b/chrome/test/perf/rendering/throughput_tests.cc @@ -271,7 +271,7 @@ class ThroughputTest : public BrowserPerfTest { test_path = test_path.Append(FILE_PATH_LITERAL("throughput")); test_path = test_path.AppendASCII(test_name); test_path = test_path.Append(FILE_PATH_LITERAL("index.html")); - ASSERT_TRUE(file_util::PathExists(test_path)) + ASSERT_TRUE(base::PathExists(test_path)) << "Missing test file: " << test_path.value(); gurl_ = net::FilePathToFileURL(test_path); @@ -286,7 +286,7 @@ class ThroughputTest : public BrowserPerfTest { test_path = test_path.Append(FILE_PATH_LITERAL("perf")); test_path = test_path.Append(FILE_PATH_LITERAL("canvas_bench")); test_path = test_path.AppendASCII(test_name + ".html"); - ASSERT_TRUE(file_util::PathExists(test_path)) + ASSERT_TRUE(base::PathExists(test_path)) << "Missing test file: " << test_path.value(); gurl_ = net::FilePathToFileURL(test_path); diff --git a/chrome/test/perf/shutdown_test.cc b/chrome/test/perf/shutdown_test.cc index a078833..93495a0 100644 --- a/chrome/test/perf/shutdown_test.cc +++ b/chrome/test/perf/shutdown_test.cc @@ -57,7 +57,7 @@ class ShutdownTest : public UIPerfTest { }; for (size_t i = 0; i < arraysize(test_cases); i++) { - ASSERT_TRUE(file_util::PathExists(test_cases[i])); + ASSERT_TRUE(base::PathExists(test_cases[i])); for (size_t j = 0; j < 5; j++) { ASSERT_TRUE(browser_proxy->AppendTab( net::FilePathToFileURL(test_cases[i]))); diff --git a/chrome/test/perf/startup_test.cc b/chrome/test/perf/startup_test.cc index 72b39d2..6b3e62f 100644 --- a/chrome/test/perf/startup_test.cc +++ b/chrome/test/perf/startup_test.cc @@ -60,7 +60,7 @@ class StartupTest : public UIPerfTest { const base::FilePath file_url = ui_test_utils::GetTestFilePath( base::FilePath(base::FilePath::kCurrentDirectory), base::FilePath(FILE_PATH_LITERAL("simple.html"))); - ASSERT_TRUE(file_util::PathExists(file_url)); + ASSERT_TRUE(base::PathExists(file_url)); launch_arguments_.AppendArgPath(file_url); } diff --git a/chrome/test/ppapi/ppapi_test.cc b/chrome/test/ppapi/ppapi_test.cc index daed946..4c88158 100644 --- a/chrome/test/ppapi/ppapi_test.cc +++ b/chrome/test/ppapi/ppapi_test.cc @@ -152,7 +152,7 @@ GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) { test_path = test_path.Append(FILE_PATH_LITERAL("test_case.html")); // Sanity check the file name. - EXPECT_TRUE(file_util::PathExists(test_path)); + EXPECT_TRUE(base::PathExists(test_path)); GURL test_url = net::FilePathToFileURL(test_path); @@ -294,7 +294,7 @@ void PPAPITest::SetUpCommandLine(CommandLine* command_line) { EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); base::FilePath plugin_lib = plugin_dir.Append(library_name); - EXPECT_TRUE(file_util::PathExists(plugin_lib)); + EXPECT_TRUE(base::PathExists(plugin_lib)); base::FilePath::StringType pepper_plugin = plugin_lib.value(); pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, @@ -325,7 +325,7 @@ void PPAPINaClTest::SetUpCommandLine(CommandLine* command_line) { base::FilePath plugin_lib; EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); - EXPECT_TRUE(file_util::PathExists(plugin_lib)); + EXPECT_TRUE(base::PathExists(plugin_lib)); // Enable running NaCl outside of the store. command_line->AppendSwitch(switches::kEnableNaCl); @@ -362,7 +362,7 @@ void PPAPINaClTestDisallowedSockets::SetUpCommandLine( base::FilePath plugin_lib; EXPECT_TRUE(PathService::Get(chrome::FILE_NACL_PLUGIN, &plugin_lib)); - EXPECT_TRUE(file_util::PathExists(plugin_lib)); + EXPECT_TRUE(base::PathExists(plugin_lib)); // Enable running NaCl outside of the store. command_line->AppendSwitch(switches::kEnableNaCl); diff --git a/chrome/test/webdriver/commands/webelement_commands.cc b/chrome/test/webdriver/commands/webelement_commands.cc index 5ecff82..1bea1de 100644 --- a/chrome/test/webdriver/commands/webelement_commands.cc +++ b/chrome/test/webdriver/commands/webelement_commands.cc @@ -561,7 +561,7 @@ Error* ElementValueCommand::DragAndDropFilePaths() const { // Check the files exist. for (size_t i = 0; i < paths.size(); ++i) { - if (!file_util::PathExists(base::FilePath(paths[i]))) { + if (!base::PathExists(base::FilePath(paths[i]))) { return new Error( kBadRequest, base::StringPrintf("'%s' does not exist on the file system", diff --git a/chrome/test/webdriver/webdriver_automation.cc b/chrome/test/webdriver/webdriver_automation.cc index 418e0b2..1fa60ab 100644 --- a/chrome/test/webdriver/webdriver_automation.cc +++ b/chrome/test/webdriver/webdriver_automation.cc @@ -54,7 +54,7 @@ bool CheckForChromeExe(const std::vector<base::FilePath>& browser_exes, for (size_t i = 0; i < browser_exes.size(); ++i) { for (size_t j = 0; j < locations.size(); ++j) { base::FilePath path = locations[j].Append(browser_exes[i]); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { *browser_exe = path; return true; } @@ -97,7 +97,7 @@ bool GetDefaultChromeExe(base::FilePath* browser_exe) { if (PathService::Get(base::DIR_MODULE, &module_dir)) { for (size_t j = 0; j < browser_exes.size(); ++j) { base::FilePath path = module_dir.Append(browser_exes[j]); - if (file_util::PathExists(path)) { + if (base::PathExists(path)) { *browser_exe = path; return true; } @@ -411,7 +411,7 @@ void Automation::Init( } command.SetProgram(browser_exe); } - if (!file_util::PathExists(command.GetProgram())) { + if (!base::PathExists(command.GetProgram())) { std::string message = base::StringPrintf( "Could not find Chrome binary at: %" PRFilePath, command.GetProgram().value().c_str()); diff --git a/chrome/tools/crash_service/main.cc b/chrome/tools/crash_service/main.cc index de4b37a..c4889c7 100644 --- a/chrome/tools/crash_service/main.cc +++ b/chrome/tools/crash_service/main.cc @@ -22,7 +22,7 @@ bool GetCrashServiceDirectory(base::FilePath* dir) { if (!file_util::GetTempDir(&temp_dir)) return false; temp_dir = temp_dir.Append(L"chrome_crashes"); - if (!file_util::PathExists(temp_dir)) { + if (!base::PathExists(temp_dir)) { if (!file_util::CreateDirectory(temp_dir)) return false; } diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc index 7a7a275..eab9651 100644 --- a/chrome/utility/chrome_content_utility_client.cc +++ b/chrome/utility/chrome_content_utility_client.cc @@ -81,7 +81,7 @@ void ChromeContentUtilityClient::UtilityThreadStarted() { // only because we need this DLL only on Windows. base::FilePath pdf; if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && - file_util::PathExists(pdf)) { + base::PathExists(pdf)) { bool rv = !!LoadLibrary(pdf.value().c_str()); DCHECK(rv) << "Couldn't load PDF plugin"; } diff --git a/chrome/utility/extensions/unpacker.cc b/chrome/utility/extensions/unpacker.cc index 5ae1808..4ae8853 100644 --- a/chrome/utility/extensions/unpacker.cc +++ b/chrome/utility/extensions/unpacker.cc @@ -47,7 +47,7 @@ const int kMaxImageCanvas = 4096 * 4096; SkBitmap DecodeImage(const base::FilePath& path) { // Read the file from disk. std::string file_contents; - if (!file_util::PathExists(path) || + if (!base::PathExists(path) || !file_util::ReadFileToString(path, &file_contents)) { return SkBitmap(); } @@ -110,7 +110,7 @@ Unpacker::~Unpacker() { base::DictionaryValue* Unpacker::ReadManifest() { base::FilePath manifest_path = temp_install_dir_.Append(kManifestFilename); - if (!file_util::PathExists(manifest_path)) { + if (!base::PathExists(manifest_path)) { SetError(errors::kInvalidManifest); return NULL; } diff --git a/chrome/utility/extensions/unpacker_unittest.cc b/chrome/utility/extensions/unpacker_unittest.cc index 1c0c256..3a66b29 100644 --- a/chrome/utility/extensions/unpacker_unittest.cc +++ b/chrome/utility/extensions/unpacker_unittest.cc @@ -36,7 +36,7 @@ public: original_path = original_path.AppendASCII("extensions") .AppendASCII("unpacker") .AppendASCII(crx_name); - ASSERT_TRUE(file_util::PathExists(original_path)) << original_path.value(); + ASSERT_TRUE(base::PathExists(original_path)) << original_path.value(); // Try bots won't let us write into DIR_TEST_DATA, so we have to create // a temp folder to play in. diff --git a/chrome_frame/chrome_launcher_utils.cc b/chrome_frame/chrome_launcher_utils.cc index b120a94..fbfa66d 100644 --- a/chrome_frame/chrome_launcher_utils.cc +++ b/chrome_frame/chrome_launcher_utils.cc @@ -34,7 +34,7 @@ bool CreateChromeLauncherCommandLine(scoped_ptr<CommandLine>* command_line) { base::FilePath current_dir = module_path.DirName(); base::FilePath chrome_launcher = current_dir.Append( chrome_launcher::kLauncherExeBaseName); - if (file_util::PathExists(chrome_launcher)) { + if (base::PathExists(chrome_launcher)) { command_line->reset(new CommandLine(chrome_launcher)); success = true; } @@ -98,7 +98,7 @@ base::FilePath GetChromeExecutablePath() { // sub-folder one down from the Chrome executable. If we fail to find // chrome.exe in the current path, try looking one up and launching that // instead. - if (!file_util::PathExists(cur_path)) { + if (!base::PathExists(cur_path)) { PathService::Get(base::DIR_MODULE, &cur_path); cur_path = cur_path.DirName().Append(chrome::kBrowserProcessExecutableName); } diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc index a563ded..177b9ac 100644 --- a/chrome_frame/chrome_tab.cc +++ b/chrome_frame/chrome_tab.cc @@ -344,12 +344,12 @@ HRESULT SetupUserLevelHelper() { if (PathService::Get(base::FILE_MODULE, &module_path)) { module_path = module_path.DirName(); helper_path = module_path.Append(kChromeFrameHelperExe); - if (!file_util::PathExists(helper_path)) { + if (!base::PathExists(helper_path)) { // If we can't find the helper in the current directory, try looking // one up (this is the layout in the build output folder). module_path = module_path.DirName(); helper_path = module_path.Append(kChromeFrameHelperExe); - DCHECK(file_util::PathExists(helper_path)) << + DCHECK(base::PathExists(helper_path)) << "Could not find chrome_frame_helper.exe."; } @@ -357,7 +357,7 @@ HRESULT SetupUserLevelHelper() { HWND old_window = FindWindow(kChromeFrameHelperWindowClassName, kChromeFrameHelperWindowName); - if (file_util::PathExists(helper_path)) { + if (base::PathExists(helper_path)) { std::wstring helper_path_cmd(L"\""); helper_path_cmd += helper_path.value(); helper_path_cmd += L"\" "; diff --git a/chrome_frame/simple_resource_loader.cc b/chrome_frame/simple_resource_loader.cc index 187e0b7..3d4426a 100644 --- a/chrome_frame/simple_resource_loader.cc +++ b/chrome_frame/simple_resource_loader.cc @@ -205,8 +205,8 @@ bool SimpleResourceLoader::LoadLocalePack( locales_path.Append(*scan + pack_suffix); base::FilePath dll_path = locales_path.Append(*scan + dll_suffix); - if (file_util::PathExists(resource_pack_path) && - file_util::PathExists(dll_path)) { + if (base::PathExists(resource_pack_path) && + base::PathExists(dll_path)) { scoped_ptr<ui::DataPack> cur_data_pack( new ui::DataPack(ui::SCALE_FACTOR_100P)); if (!cur_data_pack->LoadFromPath(resource_pack_path)) diff --git a/chrome_frame/test/dll_redirector_loading_test.cc b/chrome_frame/test/dll_redirector_loading_test.cc index 404db0e..9040204 100644 --- a/chrome_frame/test/dll_redirector_loading_test.cc +++ b/chrome_frame/test/dll_redirector_loading_test.cc @@ -39,7 +39,7 @@ class DllRedirectorLoadingTest : public testing::Test { static void SetUpTestCase() { // First ensure that we can find the built Chrome Frame DLL. base::FilePath build_chrome_frame_dll = GetChromeFrameBuildPath(); - ASSERT_TRUE(file_util::PathExists(build_chrome_frame_dll)); + ASSERT_TRUE(base::PathExists(build_chrome_frame_dll)); // Then grab its version. scoped_ptr<FileVersionInfo> original_version_info( @@ -63,7 +63,7 @@ class DllRedirectorLoadingTest : public testing::Test { original_version_dir.Append(build_chrome_frame_dll.BaseName()); ASSERT_TRUE(base::CopyFile(build_chrome_frame_dll, original_chrome_frame_dll_)); - ASSERT_TRUE(file_util::PathExists(original_chrome_frame_dll_)); + ASSERT_TRUE(base::PathExists(original_chrome_frame_dll_)); // Temporary location for the new Chrome Frame DLL. base::FilePath temporary_new_chrome_frame_dll( @@ -95,7 +95,7 @@ class DllRedirectorLoadingTest : public testing::Test { new_version_dir.Append(build_chrome_frame_dll.BaseName()); ASSERT_TRUE(base::Move(temporary_new_chrome_frame_dll, new_chrome_frame_dll_)); - ASSERT_TRUE(file_util::PathExists(new_chrome_frame_dll_)); + ASSERT_TRUE(base::PathExists(new_chrome_frame_dll_)); } static void TearDownTestCase() { diff --git a/chrome_frame/test/mock_ie_event_sink_actions.h b/chrome_frame/test/mock_ie_event_sink_actions.h index d952c81..9c8f4c7 100644 --- a/chrome_frame/test/mock_ie_event_sink_actions.h +++ b/chrome_frame/test/mock_ie_event_sink_actions.h @@ -385,7 +385,7 @@ ACTION_P(VerifySelectedText, expected_text) { ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { base::Time start = base::Time::Now(); - while (!file_util::PathExists(file)) { + while (!base::PathExists(file)) { if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { ADD_FAILURE() << "File was not saved within timeout"; TakeSnapshotAndLog(); @@ -398,7 +398,7 @@ ACTION_P3(CloseWhenFileSaved, mock, file, timeout_ms) { ACTION_P2(WaitForFileSave, file, timeout_ms) { base::Time start = base::Time::Now(); - while (!file_util::PathExists(file)) { + while (!base::PathExists(file)) { base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(200)); if ((base::Time::Now() - start).InMilliseconds() > timeout_ms) { ADD_FAILURE() << "File was not saved within timeout"; diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index f67baaf..d3e3140 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -480,7 +480,7 @@ BOOL SupplyProxyCredentials::EnumChildren(HWND hwnd, LPARAM param) { FakeExternalTab::FakeExternalTab() { user_data_dir_ = chrome_frame_test::GetProfilePathForIE(); - if (file_util::PathExists(user_data_dir_)) { + if (base::PathExists(user_data_dir_)) { VLOG(1) << __FUNCTION__ << " deleting IE Profile user data directory " << user_data_dir_.value(); bool deleted = base::Delete(user_data_dir_, true); diff --git a/chrome_frame/test/test_scrubber.cc b/chrome_frame/test/test_scrubber.cc index 9699a17..37abcc3 100644 --- a/chrome_frame/test/test_scrubber.cc +++ b/chrome_frame/test/test_scrubber.cc @@ -112,7 +112,7 @@ void TestScrubber::CleanUpFromTestRun() { default_data_directory_ : data_directory_override_); - VLOG_IF(1, file_util::PathExists(data_directory)) + VLOG_IF(1, base::PathExists(data_directory)) << __FUNCTION__ << " deleting user data directory " << data_directory.value(); bool deleted = base::Delete(data_directory, true); diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index 7ffb836..9c93a377 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -399,10 +399,10 @@ void MockWebServer::SendResponseHelper( std::string headers, body; std::string content_type; - if (file_util::PathExists(file_path) && + if (base::PathExists(file_path) && !file_util::DirectoryExists(file_path)) { base::FilePath mock_http_headers(file_path.value() + L".mock-http-headers"); - if (file_util::PathExists(mock_http_headers)) { + if (base::PathExists(mock_http_headers)) { headers = GetMockHttpHeaders(mock_http_headers); content_type = http_utils::GetHttpHeaderFromHeaderList("Content-type", headers); diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc index 0b99896..a473732 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -36,12 +36,12 @@ base::FilePath GetChromeFrameBuildPath() { base::FilePath dll_path = build_path.Append(kChromeFrameDllName); - if (!file_util::PathExists(dll_path)) { + if (!base::PathExists(dll_path)) { // Well, dang.. try looking in the current directory. dll_path = build_path.Append(kChromeFrameDllName); } - if (!file_util::PathExists(dll_path)) { + if (!base::PathExists(dll_path)) { // No luck, return something empty. dll_path = base::FilePath(); } diff --git a/chromeos/chromeos_test_utils.cc b/chromeos/chromeos_test_utils.cc index eee9af6..f728ff7 100644 --- a/chromeos/chromeos_test_utils.cc +++ b/chromeos/chromeos_test_utils.cc @@ -20,7 +20,7 @@ bool GetTestDataPath(const std::string& component, path = path.Append(FILE_PATH_LITERAL("chromeos")); path = path.Append(FILE_PATH_LITERAL("test")); path = path.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(path)) // We don't want to create this. + if (!base::PathExists(path)) // We don't want to create this. return false; DCHECK(data_dir); path = path.Append(component); diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc index ea4687d..a7a4354 100644 --- a/chromeos/dbus/cros_disks_client.cc +++ b/chromeos/dbus/cros_disks_client.cc @@ -456,7 +456,7 @@ class CrosDisksClientStubImpl : public CrosDisksClient { static MountError PerformFakeMount(const std::string& source_path, const base::FilePath& mounted_path) { // Check the source path exists. - if (!file_util::PathExists(base::FilePath::FromUTF8Unsafe(source_path))) { + if (!base::PathExists(base::FilePath::FromUTF8Unsafe(source_path))) { DLOG(ERROR) << "Source does not exist at " << source_path; return MOUNT_ERROR_INVALID_PATH; } diff --git a/chromeos/system/name_value_pairs_parser.cc b/chromeos/system/name_value_pairs_parser.cc index e537c0d..d476520 100644 --- a/chromeos/system/name_value_pairs_parser.cc +++ b/chromeos/system/name_value_pairs_parser.cc @@ -24,7 +24,7 @@ const char kTrimChars[] = "\" "; bool GetToolOutput(int argc, const char* argv[], std::string& output) { DCHECK_GE(argc, 1); - if (!file_util::PathExists(base::FilePath(argv[0]))) { + if (!base::PathExists(base::FilePath(argv[0]))) { LOG(WARNING) << "Tool for statistics not found: " << argv[0]; return false; } diff --git a/cloud_print/service/win/service_controller.cc b/cloud_print/service/win/service_controller.cc index e67d5a2..c4b35e4 100644 --- a/cloud_print/service/win/service_controller.cc +++ b/cloud_print/service/win/service_controller.cc @@ -162,7 +162,7 @@ HRESULT ServiceController::InstallService(const string16& user, return hr; base::FilePath service_path = GetBinary(); - if (!file_util::PathExists(service_path)) + if (!base::PathExists(service_path)) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); CommandLine command_line(service_path); command_line.AppendSwitch(run_switch); @@ -246,7 +246,7 @@ HRESULT ServiceController::UpdateBinaryPath() { return hr; base::FilePath service_path = GetBinary(); - if (!file_util::PathExists(service_path)) + if (!base::PathExists(service_path)) return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND); command_line_.SetProgram(service_path); diff --git a/cloud_print/service/win/service_listener.cc b/cloud_print/service/win/service_listener.cc index 51d9c93..2b35b62 100644 --- a/cloud_print/service/win/service_listener.cc +++ b/cloud_print/service/win/service_listener.cc @@ -40,7 +40,7 @@ std::string GetEnvironment(const base::FilePath& user_data_dir) { if (file_util::CreateDirectory(user_data_dir)) { base::FilePath temp_file; if (file_util::CreateTemporaryFileInDir(user_data_dir, &temp_file)) { - DCHECK(file_util::PathExists(temp_file)); + DCHECK(base::PathExists(temp_file)); environment.SetString(SetupListener::kUserDataDirJsonValueName, user_data_dir.value()); base::Delete(temp_file, false); diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc index 85591ee..e5a249e 100644 --- a/cloud_print/virtual_driver/win/install/setup.cc +++ b/cloud_print/virtual_driver/win/install/setup.cc @@ -116,7 +116,7 @@ HRESULT RegisterPortMonitor(bool install, const base::FilePath& install_path) { source_path.value() << " to " << target_path.value(); return GetLastHResult(); } - } else if (!file_util::PathExists(target_path)) { + } else if (!base::PathExists(target_path)) { // Already removed. Just "succeed" silently. return S_OK; } @@ -237,9 +237,9 @@ void ReadyDriverDependencies(const base::FilePath& destination) { driver_cache_path = driver_cache_path.Append(L"Driver Cache\\i386"); for (size_t i = 0; i < arraysize(kDependencyList); ++i) { base::FilePath dst_path = destination.Append(kDependencyList[i]); - if (!file_util::PathExists(dst_path)) { + if (!base::PathExists(dst_path)) { base::FilePath src_path = driver_cache_path.Append(kDependencyList[i]); - if (!file_util::PathExists(src_path)) + if (!base::PathExists(src_path)) src_path = GetSystemPath(kDependencyList[i]); base::CopyFile(src_path, dst_path); } @@ -257,7 +257,7 @@ HRESULT InstallDriver(const base::FilePath& install_path) { // Add all files. AddPrinterDriverEx will removes unnecessary. for (size_t i = 0; i < arraysize(kDependencyList); ++i) { base::FilePath file_path = temp_path.path().Append(kDependencyList[i]); - if (file_util::PathExists(file_path)) + if (base::PathExists(file_path)) dependent_array.push_back(file_path.value()); else LOG(WARNING) << "File is missing: " << file_path.BaseName().value(); @@ -269,7 +269,7 @@ HRESULT InstallDriver(const base::FilePath& install_path) { base::FilePath ui_path = temp_path.path().Append(kUiDriverName); base::FilePath ui_help_path = temp_path.path().Append(kHelpName); - if (!file_util::PathExists(xps_path)) { + if (!base::PathExists(xps_path)) { SetGoogleUpdateError(kGoogleUpdateProductId, LoadLocalString(IDS_ERROR_NO_XPS)); return HRESULT_FROM_WIN32(ERROR_BAD_DRIVER); diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index 657cfef..ad43c8f 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -288,7 +288,7 @@ base::FilePath ReadPathFromRegistry(HKEY root, const wchar_t* path_name) { base::win::RegKey gcp_key(HKEY_CURRENT_USER, kCloudPrintRegKey, KEY_READ); string16 data; if (SUCCEEDED(gcp_key.ReadValue(path_name, &data)) && - file_util::PathExists(base::FilePath(data))) { + base::PathExists(base::FilePath(data))) { return base::FilePath(data); } return base::FilePath(); diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc index 6bc5962..6790a78 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_dll.cc @@ -45,7 +45,7 @@ bool XpsIsInstalled() { return false; } xps_path = xps_path.Append(L"mxdwdrv.dll"); - if (!file_util::PathExists(xps_path)) { + if (!base::PathExists(xps_path)) { return false; } return true; diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc index 985b386..4849842 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor_unittest.cc @@ -99,7 +99,7 @@ TEST_F(PortMonitorTest, GetChromeExePathTest) { EXPECT_FALSE(chrome_path.empty()); EXPECT_TRUE( chrome_path.value().rfind(kAlternateChromeExePath) != std::string::npos); - EXPECT_TRUE(file_util::PathExists(chrome_path)); + EXPECT_TRUE(base::PathExists(chrome_path)); DeleteChromeExeRegistry(); chrome_path = cloud_print::GetChromeExePath(); // No Chrome or regular chrome path. diff --git a/components/webdata/common/web_database_migration_unittest.cc b/components/webdata/common/web_database_migration_unittest.cc index fed5d5a..da845f0 100644 --- a/components/webdata/common/web_database_migration_unittest.cc +++ b/components/webdata/common/web_database_migration_unittest.cc @@ -217,7 +217,7 @@ class WebDatabaseMigrationTest : public testing::Test { source_path = source_path.AppendASCII("data"); source_path = source_path.AppendASCII("web_database"); source_path = source_path.Append(file); - return file_util::PathExists(source_path) && + return base::PathExists(source_path) && file_util::ReadFileToString(source_path, contents); } diff --git a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc index 073e9ef..7219be6 100644 --- a/content/browser/accessibility/dump_accessibility_tree_browsertest.cc +++ b/content/browser/accessibility/dump_accessibility_tree_browsertest.cc @@ -130,7 +130,7 @@ void DumpAccessibilityTreeTest::RunTest( ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &dir_test_data)); base::FilePath test_path( dir_test_data.Append(FILE_PATH_LITERAL("accessibility"))); - ASSERT_TRUE(file_util::PathExists(test_path)) + ASSERT_TRUE(base::PathExists(test_path)) << test_path.LossyDisplayName(); base::FilePath html_file = test_path.Append(base::FilePath(file_path)); @@ -216,7 +216,7 @@ void DumpAccessibilityTreeTest::RunTest( printf("%s\n", actual_contents.c_str()); } - if (!file_util::PathExists(expected_file)) { + if (!base::PathExists(expected_file)) { base::FilePath actual_file = base::FilePath(html_file.RemoveExtension().value() + AccessibilityTreeFormatter::GetActualFileSuffix()); diff --git a/content/browser/appcache/chrome_appcache_service_unittest.cc b/content/browser/appcache/chrome_appcache_service_unittest.cc index ebcca07..11d736e 100644 --- a/content/browser/appcache/chrome_appcache_service_unittest.cc +++ b/content/browser/appcache/chrome_appcache_service_unittest.cc @@ -154,8 +154,8 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) { // Create a ChromeAppCacheService and insert data into it scoped_refptr<ChromeAppCacheService> appcache_service = CreateAppCacheService(appcache_path, true); - ASSERT_TRUE(file_util::PathExists(appcache_path)); - ASSERT_TRUE(file_util::PathExists(appcache_path.AppendASCII("Index"))); + ASSERT_TRUE(base::PathExists(appcache_path)); + ASSERT_TRUE(base::PathExists(appcache_path.AppendASCII("Index"))); InsertDataIntoAppCache(appcache_service.get()); // Test: delete the ChromeAppCacheService @@ -166,7 +166,7 @@ TEST_F(ChromeAppCacheServiceTest, KeepOnDestruction) { appcache_service = CreateAppCacheService(appcache_path, false); // The directory is still there - ASSERT_TRUE(file_util::PathExists(appcache_path)); + ASSERT_TRUE(base::PathExists(appcache_path)); // The appcache data is also there, except the session-only origin. AppCacheTestHelper appcache_helper; @@ -191,8 +191,8 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) { // Create a ChromeAppCacheService and insert data into it scoped_refptr<ChromeAppCacheService> appcache_service = CreateAppCacheService(appcache_path, true); - ASSERT_TRUE(file_util::PathExists(appcache_path)); - ASSERT_TRUE(file_util::PathExists(appcache_path.AppendASCII("Index"))); + ASSERT_TRUE(base::PathExists(appcache_path)); + ASSERT_TRUE(base::PathExists(appcache_path.AppendASCII("Index"))); InsertDataIntoAppCache(appcache_service.get()); // Save session state. This should bypass the destruction-time deletion. @@ -206,7 +206,7 @@ TEST_F(ChromeAppCacheServiceTest, SaveSessionState) { appcache_service = CreateAppCacheService(appcache_path, false); // The directory is still there - ASSERT_TRUE(file_util::PathExists(appcache_path)); + ASSERT_TRUE(base::PathExists(appcache_path)); // No appcache data was deleted. AppCacheTestHelper appcache_helper; diff --git a/content/browser/download/base_file_posix.cc b/content/browser/download/base_file_posix.cc index 1900942..dd664af 100644 --- a/content/browser/download/base_file_posix.cc +++ b/content/browser/download/base_file_posix.cc @@ -17,7 +17,7 @@ DownloadInterruptReason BaseFile::MoveFileAndAdjustPermissions( struct stat st; // First check the file existence and create an empty file if it doesn't // exist. - if (!file_util::PathExists(new_path)) { + if (!base::PathExists(new_path)) { int write_error = file_util::WriteFile(new_path, "", 0); if (write_error < 0) return LogSystemError("WriteFile", errno); diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 8f37f59..415d756 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -79,7 +79,7 @@ class BaseFileTest : public testing::Test { // thread checks inside it. base_file_.reset(); - EXPECT_EQ(expect_file_survives_, file_util::PathExists(full_path)); + EXPECT_EQ(expect_file_survives_, base::PathExists(full_path)); } void ResetHash() { @@ -239,9 +239,9 @@ TEST_F(BaseFileTest, CreateDestroy) { // Cancel the download explicitly. TEST_F(BaseFileTest, Cancel) { ASSERT_TRUE(InitializeFile()); - EXPECT_TRUE(file_util::PathExists(base_file_->full_path())); + EXPECT_TRUE(base::PathExists(base_file_->full_path())); base_file_->Cancel(); - EXPECT_FALSE(file_util::PathExists(base_file_->full_path())); + EXPECT_FALSE(base::PathExists(base_file_->full_path())); EXPECT_NE(base::FilePath().value(), base_file_->full_path().value()); } @@ -284,15 +284,15 @@ TEST_F(BaseFileTest, WriteThenRenameAndDetach) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); base_file_->Finish(); base_file_->Detach(); @@ -422,16 +422,16 @@ TEST_F(BaseFileTest, WriteThenRename) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); base_file_->Finish(); } @@ -441,16 +441,16 @@ TEST_F(BaseFileTest, RenameWhileInProgress) { ASSERT_TRUE(InitializeFile()); base::FilePath initial_path(base_file_->full_path()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath new_path(temp_dir_.path().AppendASCII("NewFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData1)); EXPECT_TRUE(base_file_->in_progress()); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, base_file_->Rename(new_path)); - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(new_path)); ASSERT_TRUE(AppendDataToFile(kTestData2)); @@ -467,7 +467,7 @@ TEST_F(BaseFileTest, RenameWithError) { ASSERT_TRUE(file_util::CreateDirectory(test_dir)); base::FilePath new_path(test_dir.AppendASCII("TestFile")); - EXPECT_FALSE(file_util::PathExists(new_path)); + EXPECT_FALSE(base::PathExists(new_path)); { file_util::PermissionRestorer restore_permissions_for(test_dir); diff --git a/content/browser/download/base_file_win.cc b/content/browser/download/base_file_win.cc index 449134e..398e5fc 100644 --- a/content/browser/download/base_file_win.cc +++ b/content/browser/download/base_file_win.cc @@ -339,7 +339,7 @@ DownloadInterruptReason BaseFile::AnnotateWithSourceInformation() { // If the file is still there, then the error could be due to AES not being // available or some other error during the AES invocation. In either case, // we don't surface the error to the user. - if (!file_util::PathExists(full_path_)) { + if (!base::PathExists(full_path_)) { DCHECK(FAILED(hr)); result = MapScanAndSaveErrorCodeToInterruptReason(hr); if (result == DOWNLOAD_INTERRUPT_REASON_NONE) { diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 2cc7cfd..cba13f0 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -664,7 +664,7 @@ class DownloadContentTest : public ContentBrowserTest { download->GetFullPath().BaseName().value()); EXPECT_EQ(file_exists, (!download->GetFullPath().empty() && - file_util::PathExists(download->GetFullPath()))); + base::PathExists(download->GetFullPath()))); if (file_exists) { std::string file_contents; @@ -1412,14 +1412,14 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelInterruptedDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); download->Cancel(true /* user_cancel */); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The intermediate file should now be gone. - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); EXPECT_TRUE(download->GetFullPath().empty()); } @@ -1444,14 +1444,14 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); download->Remove(); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The intermediate file should now be gone. - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); } // A completed download shouldn't delete the downloaded file when it is @@ -1467,13 +1467,13 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveDownload) { // The target path should exist. base::FilePath target_path(download->GetTargetFilePath()); - EXPECT_TRUE(file_util::PathExists(target_path)); + EXPECT_TRUE(base::PathExists(target_path)); download->Remove(); RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); // The file should still exist. - EXPECT_TRUE(file_util::PathExists(target_path)); + EXPECT_TRUE(base::PathExists(target_path)); } } @@ -1502,7 +1502,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveResumingDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); // Resume and remove download. We expect only a single OnDownloadCreated() // call, and that's for the second download created below. @@ -1513,7 +1513,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, RemoveResumingDownload) { // The intermediate file should now be gone. RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); // Start the second download and wait until it's done. The test server is // single threaded. The response to this download request should follow the @@ -1549,7 +1549,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelResumingDownload) { base::FilePath intermediate_path(download->GetFullPath()); ASSERT_FALSE(intermediate_path.empty()); - EXPECT_TRUE(file_util::PathExists(intermediate_path)); + EXPECT_TRUE(base::PathExists(intermediate_path)); // Resume and cancel download. We expect only a single OnDownloadCreated() // call, and that's for the second download created below. @@ -1560,7 +1560,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelResumingDownload) { // The intermediate file should now be gone. RunAllPendingInMessageLoop(BrowserThread::FILE); RunAllPendingInMessageLoop(); - EXPECT_FALSE(file_util::PathExists(intermediate_path)); + EXPECT_FALSE(base::PathExists(intermediate_path)); EXPECT_TRUE(download->GetFullPath().empty()); // Start the second download and wait until it's done. The test server is diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 604baa4..3f8209b 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -340,7 +340,7 @@ const int DownloadFileTest::kDummyRequestId = 67; TEST_F(DownloadFileTest, RenameFileFinal) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); base::FilePath path_2(initial_path.InsertBeforeExtensionASCII("_2")); base::FilePath path_3(initial_path.InsertBeforeExtensionASCII("_3")); @@ -356,8 +356,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_1, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(initial_path)); - EXPECT_TRUE(file_util::PathExists(path_1)); + EXPECT_FALSE(base::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(path_1)); // Download the data. const char* chunks1[] = { kTestData1, kTestData2 }; @@ -371,8 +371,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_2, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_1)); - EXPECT_TRUE(file_util::PathExists(path_2)); + EXPECT_FALSE(base::PathExists(path_1)); + EXPECT_TRUE(base::PathExists(path_2)); const char* chunks2[] = { kTestData3 }; AppendDataToFile(chunks2, 1); @@ -385,8 +385,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_3, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_2)); - EXPECT_TRUE(file_util::PathExists(path_3)); + EXPECT_FALSE(base::PathExists(path_2)); + EXPECT_TRUE(base::PathExists(path_3)); // Should not be able to get the hash until the file is closed. std::string hash; @@ -402,8 +402,8 @@ TEST_F(DownloadFileTest, RenameFileFinal) { EXPECT_EQ(path_4, output_path); // Check the files. - EXPECT_FALSE(file_util::PathExists(path_3)); - EXPECT_TRUE(file_util::PathExists(path_4)); + EXPECT_FALSE(base::PathExists(path_3)); + EXPECT_TRUE(base::PathExists(path_4)); // Check the hash. EXPECT_TRUE(download_file_->GetHash(&hash)); @@ -411,11 +411,11 @@ TEST_F(DownloadFileTest, RenameFileFinal) { // Check that a rename with overwrite to an existing file succeeds. std::string file_contents; - ASSERT_FALSE(file_util::PathExists(path_5)); + ASSERT_FALSE(base::PathExists(path_5)); static const char file_data[] = "xyzzy"; ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); - ASSERT_TRUE(file_util::PathExists(path_5)); + ASSERT_TRUE(base::PathExists(path_5)); EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); EXPECT_EQ(std::string(file_data), file_contents); @@ -435,18 +435,18 @@ TEST_F(DownloadFileTest, RenameFileFinal) { TEST_F(DownloadFileTest, RenameUniquifies) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); base::FilePath path_1_suffixed(path_1.InsertBeforeExtensionASCII(" (1)")); - ASSERT_FALSE(file_util::PathExists(path_1)); + ASSERT_FALSE(base::PathExists(path_1)); static const char file_data[] = "xyzzy"; ASSERT_EQ(static_cast<int>(sizeof(file_data)), file_util::WriteFile(path_1, file_data, sizeof(file_data))); - ASSERT_TRUE(file_util::PathExists(path_1)); + ASSERT_TRUE(base::PathExists(path_1)); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, RenameAndUniquify(path_1, NULL)); - EXPECT_TRUE(file_util::PathExists(path_1_suffixed)); + EXPECT_TRUE(base::PathExists(path_1_suffixed)); FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); loop_.RunUntilIdle(); @@ -467,8 +467,8 @@ TEST_F(DownloadFileTest, RenameError) { // Targets base::FilePath target_path_suffixed( target_path.InsertBeforeExtensionASCII(" (1)")); - ASSERT_FALSE(file_util::PathExists(target_path)); - ASSERT_FALSE(file_util::PathExists(target_path_suffixed)); + ASSERT_FALSE(base::PathExists(target_path)); + ASSERT_FALSE(base::PathExists(target_path_suffixed)); // Make the directory unwritable and try to rename within it. { @@ -479,7 +479,7 @@ TEST_F(DownloadFileTest, RenameError) { EXPECT_CALL(*input_stream_, RegisterCallback(IsNullCallback())); EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, RenameAndAnnotate(target_path, NULL)); - EXPECT_FALSE(file_util::PathExists(target_path_suffixed)); + EXPECT_FALSE(base::PathExists(target_path_suffixed)); } FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); @@ -491,7 +491,7 @@ TEST_F(DownloadFileTest, RenameError) { TEST_F(DownloadFileTest, StreamEmptySuccess) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); // Test that calling the sink_callback_ on an empty stream shouldn't // do anything. @@ -509,7 +509,7 @@ TEST_F(DownloadFileTest, StreamEmptySuccess) { TEST_F(DownloadFileTest, StreamEmptyError) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); // Finish the download in error and make sure we see it on the // observer. @@ -536,7 +536,7 @@ TEST_F(DownloadFileTest, StreamEmptyError) { TEST_F(DownloadFileTest, StreamNonEmptySuccess) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); const char* chunks1[] = { kTestData1, kTestData2 }; ::testing::Sequence s1; @@ -552,7 +552,7 @@ TEST_F(DownloadFileTest, StreamNonEmptySuccess) { TEST_F(DownloadFileTest, StreamNonEmptyError) { ASSERT_TRUE(CreateDownloadFile(0, true)); base::FilePath initial_path(download_file_->FullPath()); - EXPECT_TRUE(file_util::PathExists(initial_path)); + EXPECT_TRUE(base::PathExists(initial_path)); const char* chunks1[] = { kTestData1, kTestData2 }; ::testing::Sequence s1; diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc index a5ff841..41bff06 100644 --- a/content/browser/download/drag_download_util.cc +++ b/content/browser/download/drag_download_util.cc @@ -82,7 +82,7 @@ FileStream* CreateFileStreamForDrop(base::FilePath* file_path, // Explicitly (and redundantly check) for file -- despite the fact that our // open won't overwrite -- just to avoid log spew. - if (!file_util::PathExists(new_file_path) && + if (!base::PathExists(new_file_path) && file_stream->OpenSync(new_file_path, base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE) == net::OK) { *file_path = new_file_path; diff --git a/content/browser/download/save_file_manager.cc b/content/browser/download/save_file_manager.cc index 36ba5a1..3dab9d8 100644 --- a/content/browser/download/save_file_manager.cc +++ b/content/browser/download/save_file_manager.cc @@ -481,7 +481,7 @@ void SaveFileManager::RenameAllFiles( int save_package_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (!resource_dir.empty() && !file_util::PathExists(resource_dir)) + if (!resource_dir.empty() && !base::PathExists(resource_dir)) file_util::CreateDirectory(resource_dir); for (FinalNameList::const_iterator i = final_names.begin(); diff --git a/content/browser/gpu/webgl_conformance_test.cc b/content/browser/gpu/webgl_conformance_test.cc index 1468b2d..70ffd94 100644 --- a/content/browser/gpu/webgl_conformance_test.cc +++ b/content/browser/gpu/webgl_conformance_test.cc @@ -56,7 +56,7 @@ class WebGLConformanceTest : public ContentBrowserTest { ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &path)); path = path.Append(FILE_PATH_LITERAL("gpu")) .Append(FILE_PATH_LITERAL("webgl_conformance_test_expectations.txt")); - ASSERT_TRUE(file_util::PathExists(path)); + ASSERT_TRUE(base::PathExists(path)); ASSERT_TRUE(test_expectations_.LoadTestExpectations(path)); } diff --git a/content/browser/media/encrypted_media_browsertest.cc b/content/browser/media/encrypted_media_browsertest.cc index fbed0f9..615fba9 100644 --- a/content/browser/media/encrypted_media_browsertest.cc +++ b/content/browser/media/encrypted_media_browsertest.cc @@ -118,7 +118,7 @@ class EncryptedMediaTest : public content::MediaBrowserTest, base::FilePath plugin_dir; EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir)); base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name); - EXPECT_TRUE(file_util::PathExists(plugin_lib)); + EXPECT_TRUE(base::PathExists(plugin_lib)); base::FilePath::StringType pepper_plugin = plugin_lib.value(); pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;")); #if defined(OS_WIN) diff --git a/content/browser/net/sqlite_persistent_cookie_store.cc b/content/browser/net/sqlite_persistent_cookie_store.cc index fe7a147..e4eb78a 100644 --- a/content/browser/net/sqlite_persistent_cookie_store.cc +++ b/content/browser/net/sqlite_persistent_cookie_store.cc @@ -545,7 +545,7 @@ bool SQLitePersistentCookieStore::Backend::InitializeDatabase() { base::Time start = base::Time::Now(); const base::FilePath dir = path_.DirName(); - if (!file_util::PathExists(dir) && !file_util::CreateDirectory(dir)) { + if (!base::PathExists(dir) && !file_util::CreateDirectory(dir)) { return false; } diff --git a/content/browser/plugin_browsertest.cc b/content/browser/plugin_browsertest.cc index 0f18ae9..24c695a 100644 --- a/content/browser/plugin_browsertest.cc +++ b/content/browser/plugin_browsertest.cc @@ -113,7 +113,7 @@ class PluginTest : public ContentBrowserTest { void TestPlugin(const char* filename) { base::FilePath path = GetTestFilePath("plugin", filename); - if (!file_util::PathExists(path)) { + if (!base::PathExists(path)) { const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); LOG(INFO) << "PluginTest." << test_info->name() << diff --git a/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc b/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc index 7e9a6be..fed67d5 100644 --- a/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc +++ b/content/browser/renderer_host/gtk_key_bindings_handler_unittest.cc @@ -34,7 +34,7 @@ class GtkKeyBindingsHandlerTest : public testing::Test { base::FilePath gtkrc; PathService::Get(DIR_TEST_DATA, >krc); gtkrc = gtkrc.AppendASCII("gtk_key_bindings_test_gtkrc"); - EXPECT_TRUE(file_util::PathExists(gtkrc)); + EXPECT_TRUE(base::PathExists(gtkrc)); gtk_rc_parse(gtkrc.value().c_str()); diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 3750a723..1915baf 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -259,7 +259,7 @@ void BlockingObliteratePath( // Early exit required because MakeAbsoluteFilePath() will fail on POSIX // if |unnormalized_root| does not exist. This is safe because there is // nothing to do in this situation anwyays. - if (!file_util::PathExists(unnormalized_root)) { + if (!base::PathExists(unnormalized_root)) { return; } @@ -277,7 +277,7 @@ void BlockingObliteratePath( for (std::vector<base::FilePath>::const_iterator it = paths_to_keep.begin(); it != paths_to_keep.end(); ++it) { - if (root.IsParent(*it) && file_util::PathExists(*it)) + if (root.IsParent(*it) && base::PathExists(*it)) valid_paths_to_keep.push_back(*it); } diff --git a/content/browser/web_contents/navigation_controller_impl_unittest.cc b/content/browser/web_contents/navigation_controller_impl_unittest.cc index 6fb3062..785ae32 100644 --- a/content/browser/web_contents/navigation_controller_impl_unittest.cc +++ b/content/browser/web_contents/navigation_controller_impl_unittest.cc @@ -3768,7 +3768,7 @@ class NavigationControllerHistoryTest : public NavigationControllerTest { NavigationControllerTest::TearDown(); ASSERT_TRUE(base::Delete(test_dir_, true)); - ASSERT_FALSE(file_util::PathExists(test_dir_)); + ASSERT_FALSE(base::PathExists(test_dir_)); } // Deletes the current profile manager and creates a new one. Indirectly this diff --git a/content/browser/web_contents/web_drag_source_mac.mm b/content/browser/web_contents/web_drag_source_mac.mm index 0c20d22..0b86cca 100644 --- a/content/browser/web_contents/web_drag_source_mac.mm +++ b/content/browser/web_contents/web_drag_source_mac.mm @@ -369,7 +369,7 @@ NSString* GetDropLocation(NSPasteboard* pboard) { base::FilePath filePath(SysNSStringToUTF8(path)); filePath = filePath.Append(downloadFileName_); - // CreateFileStreamForDrop() will call file_util::PathExists(), + // CreateFileStreamForDrop() will call base::PathExists(), // which is blocking. Since this operation is already blocking the // UI thread on OSX, it should be reasonable to let it happen. base::ThreadRestrictions::ScopedAllowIO allowIO; diff --git a/content/common/content_paths.cc b/content/common/content_paths.cc index 0c85636..acea89a 100644 --- a/content/common/content_paths.cc +++ b/content/common/content_paths.cc @@ -21,7 +21,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("content")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // we don't want to create this + if (!base::PathExists(cur)) // we don't want to create this return false; *result = cur; diff --git a/content/renderer/media/webrtc_audio_device_unittest.cc b/content/renderer/media/webrtc_audio_device_unittest.cc index 7b99ad5..3ee59ea 100644 --- a/content/renderer/media/webrtc_audio_device_unittest.cc +++ b/content/renderer/media/webrtc_audio_device_unittest.cc @@ -268,7 +268,7 @@ void ReadDataFromSpeechFile(char* data, int length) { .Append(FILE_PATH_LITERAL("test")) .Append(FILE_PATH_LITERAL("data")) .Append(FILE_PATH_LITERAL("speech_16b_stereo_48kHz.raw")); - DCHECK(file_util::PathExists(data_file)); + DCHECK(base::PathExists(data_file)); int64 data_file_size64 = 0; DCHECK(file_util::GetFileSize(data_file, &data_file_size64)); EXPECT_EQ(length, file_util::ReadFile(data_file, data, length)); diff --git a/content/renderer/renderer_main_platform_delegate_linux.cc b/content/renderer/renderer_main_platform_delegate_linux.cc index 52b0ea2..e473ad8 100644 --- a/content/renderer/renderer_main_platform_delegate_linux.cc +++ b/content/renderer/renderer_main_platform_delegate_linux.cc @@ -76,7 +76,7 @@ void RendererMainPlatformDelegate::RunSandboxTests(bool no_sandbox) { // Under the setuid sandbox, we should not be able to open any file via the // filesystem. if (linux_sandbox->GetStatus() & kSandboxLinuxSUID) { - CHECK(!file_util::PathExists(base::FilePath("/proc/cpuinfo"))); + CHECK(!base::PathExists(base::FilePath("/proc/cpuinfo"))); } #if defined(__x86_64__) diff --git a/content/shell/common/webkit_test_helpers.cc b/content/shell/common/webkit_test_helpers.cc index 0426ac4..5dafad7 100644 --- a/content/shell/common/webkit_test_helpers.cc +++ b/content/shell/common/webkit_test_helpers.cc @@ -114,15 +114,15 @@ void ApplyLayoutTestDefaultPreferences(WebPreferences* prefs) { base::FilePath GetWebKitRootDirFilePath() { base::FilePath base_path; PathService::Get(base::DIR_SOURCE_ROOT, &base_path); - if (file_util::PathExists( + if (base::PathExists( base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { // We're in a WebKit-in-chrome checkout. return base_path.Append(FILE_PATH_LITERAL("third_party/WebKit")); - } else if (file_util::PathExists( + } else if (base::PathExists( base_path.Append(FILE_PATH_LITERAL("chromium")))) { // We're in a WebKit-only checkout on Windows. return base_path.Append(FILE_PATH_LITERAL("../..")); - } else if (file_util::PathExists( + } else if (base::PathExists( base_path.Append(FILE_PATH_LITERAL("webkit/support")))) { // We're in a WebKit-only/xcodebuild checkout on Mac return base_path.Append(FILE_PATH_LITERAL("../../..")); @@ -134,7 +134,7 @@ base::FilePath GetWebKitRootDirFilePath() { base::FilePath GetChromiumRootDirFilePath() { base::FilePath webkit_path = GetWebKitRootDirFilePath(); - if (file_util::PathExists(webkit_path.Append( + if (base::PathExists(webkit_path.Append( FILE_PATH_LITERAL("Source/WebKit/chromium/webkit/support")))) { // We're in a WebKit-only checkout. return webkit_path.Append(FILE_PATH_LITERAL("Source/WebKit/chromium")); diff --git a/content/shell/shell_browser_context.cc b/content/shell/shell_browser_context.cc index 721d7c8..5915285 100644 --- a/content/shell/shell_browser_context.cc +++ b/content/shell/shell_browser_context.cc @@ -100,7 +100,7 @@ void ShellBrowserContext::InitWhileIOAllowed() { NOTIMPLEMENTED(); #endif - if (!file_util::PathExists(path_)) + if (!base::PathExists(path_)) file_util::CreateDirectory(path_); } diff --git a/content/shell/shell_browser_main.cc b/content/shell/shell_browser_main.cc index 44f09f9..a6cee64 100644 --- a/content/shell/shell_browser_main.cc +++ b/content/shell/shell_browser_main.cc @@ -73,7 +73,7 @@ GURL GetURLForLayoutTest(const std::string& test_name, #else base::FilePath local_file(path_or_url); #endif - if (!file_util::PathExists(local_file)) { + if (!base::PathExists(local_file)) { local_file = content::GetWebKitRootDirFilePath() .Append(FILE_PATH_LITERAL("LayoutTests")).Append(local_file); } diff --git a/content/shell/shell_download_manager_delegate.cc b/content/shell/shell_download_manager_delegate.cc index 5d16db7..424b1de 100644 --- a/content/shell/shell_download_manager_delegate.cc +++ b/content/shell/shell_download_manager_delegate.cc @@ -105,7 +105,7 @@ void ShellDownloadManagerDelegate::GenerateFilename( const base::FilePath& generated_name, const base::FilePath& suggested_directory) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); - if (!file_util::PathExists(suggested_directory)) + if (!base::PathExists(suggested_directory)) file_util::CreateDirectory(suggested_directory); base::FilePath suggested_path(suggested_directory.Append(generated_name)); diff --git a/content/test/image_decoder_test.cc b/content/test/image_decoder_test.cc index efb1548..8824c67 100644 --- a/content/test/image_decoder_test.cc +++ b/content/test/image_decoder_test.cc @@ -109,7 +109,7 @@ void ImageDecoderTest::SetUp() { data_dir_ = data_dir.AppendASCII("webkit"). AppendASCII("data"). AppendASCII(format_ + "_decoder"); - if (!file_util::PathExists(data_dir_)) { + if (!base::PathExists(data_dir_)) { const testing::TestInfo* const test_info = testing::UnitTest::GetInstance()->current_test_info(); LOG(INFO) << test_info->name() << diff --git a/content/test/net/url_request_prepackaged_interceptor.cc b/content/test/net/url_request_prepackaged_interceptor.cc index 9150a7e..75d2ffc 100644 --- a/content/test/net/url_request_prepackaged_interceptor.cc +++ b/content/test/net/url_request_prepackaged_interceptor.cc @@ -65,7 +65,7 @@ class URLRequestPrepackagedInterceptor::Delegate // It's ok to do a blocking disk access on this thread; this class // is just used for tests. base::ThreadRestrictions::ScopedAllowIO allow_io; - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); if (ignore_query) { ignore_query_responses_[url] = path; } else { diff --git a/content/test/webrtc_audio_device_test.cc b/content/test/webrtc_audio_device_test.cc index 3b52451..f39a686 100644 --- a/content/test/webrtc_audio_device_test.cc +++ b/content/test/webrtc_audio_device_test.cc @@ -342,7 +342,7 @@ std::string WebRTCAudioDeviceTest::GetTestDataPath( base::FilePath path; EXPECT_TRUE(PathService::Get(DIR_TEST_DATA, &path)); path = path.Append(file_name); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); #if defined(OS_WIN) return WideToUTF8(path.value()); #else diff --git a/extensions/common/extension_paths.cc b/extensions/common/extension_paths.cc index deec7d9..1e0c461 100644 --- a/extensions/common/extension_paths.cc +++ b/extensions/common/extension_paths.cc @@ -18,7 +18,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("extensions")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // we don't want to create this + if (!base::PathExists(cur)) // we don't want to create this return false; *result = cur; diff --git a/extensions/common/extension_resource.cc b/extensions/common/extension_resource.cc index cdd7fce..e660544 100644 --- a/extensions/common/extension_resource.cc +++ b/extensions/common/extension_resource.cc @@ -88,7 +88,7 @@ base::FilePath ExtensionResource::GetFilePath( // unfortunately. // TODO(mad): Fix this once MakeAbsoluteFilePath is unified. full_path = base::MakeAbsoluteFilePath(full_path); - if (file_util::PathExists(full_path) && + if (base::PathExists(full_path) && (symlink_policy == FOLLOW_SYMLINKS_ANYWHERE || clean_extension_root.IsParent(full_path))) { return full_path; diff --git a/gpu/config/gpu_info_collector_x11.cc b/gpu/config/gpu_info_collector_x11.cc index d3a1b65..84decdb 100644 --- a/gpu/config/gpu_info_collector_x11.cc +++ b/gpu/config/gpu_info_collector_x11.cc @@ -35,8 +35,8 @@ namespace { bool IsPciSupported() { const base::FilePath pci_path("/sys/bus/pci/"); const base::FilePath pcie_path("/sys/bus/pci_express/"); - return (file_util::PathExists(pci_path) || - file_util::PathExists(pcie_path)); + return (base::PathExists(pci_path) || + base::PathExists(pcie_path)); } // Scan /etc/ati/amdpcsdb.default for "ReleaseVersion". @@ -45,7 +45,7 @@ std::string CollectDriverVersionATI() { const base::FilePath::CharType kATIFileName[] = FILE_PATH_LITERAL("/etc/ati/amdpcsdb.default"); base::FilePath ati_file_path(kATIFileName); - if (!file_util::PathExists(ati_file_path)) + if (!base::PathExists(ati_file_path)) return std::string(); std::string contents; if (!file_util::ReadFileToString(ati_file_path, &contents)) diff --git a/gpu/tools/compositor_model_bench/compositor_model_bench.cc b/gpu/tools/compositor_model_bench/compositor_model_bench.cc index 5c21ac0..f6bbb83 100644 --- a/gpu/tools/compositor_model_bench/compositor_model_bench.cc +++ b/gpu/tools/compositor_model_bench/compositor_model_bench.cc @@ -41,7 +41,7 @@ using base::TimeTicks; using file_util::CloseFile; using file_util::DirectoryExists; using file_util::OpenFile; -using file_util::PathExists; +using base::PathExists; using std::queue; using std::string; diff --git a/ipc/ipc_channel_posix.cc b/ipc/ipc_channel_posix.cc index d637232..f685dc0 100644 --- a/ipc/ipc_channel_posix.cc +++ b/ipc/ipc_channel_posix.cc @@ -580,7 +580,7 @@ void Channel::ChannelImpl::ResetToAcceptingConnectionState() { // static bool Channel::ChannelImpl::IsNamedServerInitialized( const std::string& channel_id) { - return file_util::PathExists(base::FilePath(channel_id)); + return base::PathExists(base::FilePath(channel_id)); } #if defined(OS_LINUX) diff --git a/media/ffmpeg/ffmpeg_unittest.cc b/media/ffmpeg/ffmpeg_unittest.cc index 6e8cee9..d774a06 100644 --- a/media/ffmpeg/ffmpeg_unittest.cc +++ b/media/ffmpeg/ffmpeg_unittest.cc @@ -112,7 +112,7 @@ class FFmpegTest : public testing::TestWithParam<const char*> { .AppendASCII("data") .AppendASCII("content") .AppendASCII(name.c_str()); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); CHECK(file_data_.Initialize(path)); protocol_.reset(new InMemoryUrlProtocol( diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 5a61ca3..47e80d0 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -2950,7 +2950,7 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenMissingFile) { // Delete one of the files in the entry. base::FilePath to_delete_file = cache_path_.AppendASCII( disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, 0)); - EXPECT_TRUE(file_util::PathExists(to_delete_file)); + EXPECT_TRUE(base::PathExists(to_delete_file)); EXPECT_TRUE(disk_cache::DeleteCacheFile(to_delete_file)); // Failing to open the entry should delete the rest of these files. @@ -2961,7 +2961,7 @@ TEST_F(DiskCacheBackendTest, SimpleCacheOpenMissingFile) { base::FilePath should_be_gone_file(cache_path_.AppendASCII( disk_cache::simple_util::GetFilenameFromKeyAndIndex(key, i))); - EXPECT_FALSE(file_util::PathExists(should_be_gone_file)); + EXPECT_FALSE(base::PathExists(should_be_gone_file)); } } diff --git a/net/disk_cache/cache_util.cc b/net/disk_cache/cache_util.cc index 0504559..2457553 100644 --- a/net/disk_cache/cache_util.cc +++ b/net/disk_cache/cache_util.cc @@ -41,7 +41,7 @@ base::FilePath GetTempCacheName(const base::FilePath& path, // We'll attempt to have up to kMaxOldFolders folders for deletion. for (int i = 0; i < kMaxOldFolders; i++) { base::FilePath to_delete = GetPrefixedName(path, name, i); - if (!file_util::PathExists(to_delete)) + if (!base::PathExists(to_delete)) return to_delete; } return base::FilePath(); diff --git a/net/disk_cache/cache_util_unittest.cc b/net/disk_cache/cache_util_unittest.cc index 74ae365..aebd268 100644 --- a/net/disk_cache/cache_util_unittest.cc +++ b/net/disk_cache/cache_util_unittest.cc @@ -48,18 +48,18 @@ class CacheUtilTest : public PlatformTest { TEST_F(CacheUtilTest, MoveCache) { EXPECT_TRUE(disk_cache::MoveCache(cache_dir_, dest_dir_)); - EXPECT_TRUE(file_util::PathExists(dest_dir_)); - EXPECT_TRUE(file_util::PathExists(dest_file1_)); - EXPECT_TRUE(file_util::PathExists(dest_file2_)); - EXPECT_TRUE(file_util::PathExists(dest_dir1_)); + EXPECT_TRUE(base::PathExists(dest_dir_)); + EXPECT_TRUE(base::PathExists(dest_file1_)); + EXPECT_TRUE(base::PathExists(dest_file2_)); + EXPECT_TRUE(base::PathExists(dest_dir1_)); #if defined(OS_CHROMEOS) - EXPECT_TRUE(file_util::PathExists(cache_dir_)); // old cache dir stays + EXPECT_TRUE(base::PathExists(cache_dir_)); // old cache dir stays #else - EXPECT_FALSE(file_util::PathExists(cache_dir_)); // old cache is gone + EXPECT_FALSE(base::PathExists(cache_dir_)); // old cache is gone #endif - EXPECT_FALSE(file_util::PathExists(file1_)); - EXPECT_FALSE(file_util::PathExists(file2_)); - EXPECT_FALSE(file_util::PathExists(dir1_)); + EXPECT_FALSE(base::PathExists(file1_)); + EXPECT_FALSE(base::PathExists(file2_)); + EXPECT_FALSE(base::PathExists(dir1_)); } TEST_F(CacheUtilTest, DeleteCache) { @@ -67,9 +67,9 @@ TEST_F(CacheUtilTest, DeleteCache) { // one around. base::Delete(dir1_, false); disk_cache::DeleteCache(cache_dir_, false); - EXPECT_TRUE(file_util::PathExists(cache_dir_)); // cache dir stays - EXPECT_FALSE(file_util::PathExists(file1_)); - EXPECT_FALSE(file_util::PathExists(file2_)); + EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays + EXPECT_FALSE(base::PathExists(file1_)); + EXPECT_FALSE(base::PathExists(file2_)); } TEST_F(CacheUtilTest, DeleteCacheAndDir) { @@ -77,15 +77,15 @@ TEST_F(CacheUtilTest, DeleteCacheAndDir) { // one around. base::Delete(dir1_, false); disk_cache::DeleteCache(cache_dir_, true); - EXPECT_FALSE(file_util::PathExists(cache_dir_)); // cache dir is gone - EXPECT_FALSE(file_util::PathExists(file1_)); - EXPECT_FALSE(file_util::PathExists(file2_)); + EXPECT_FALSE(base::PathExists(cache_dir_)); // cache dir is gone + EXPECT_FALSE(base::PathExists(file1_)); + EXPECT_FALSE(base::PathExists(file2_)); } TEST_F(CacheUtilTest, DeleteCacheFile) { EXPECT_TRUE(disk_cache::DeleteCacheFile(file1_)); - EXPECT_FALSE(file_util::PathExists(file1_)); - EXPECT_TRUE(file_util::PathExists(cache_dir_)); // cache dir stays + EXPECT_FALSE(base::PathExists(file1_)); + EXPECT_TRUE(base::PathExists(cache_dir_)); // cache dir stays } } // namespace disk_cache diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index 16c77ed..1302054 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc @@ -94,7 +94,7 @@ void DeleteBackendImpl(disk_cache::Backend** backend, // 2. The Simple Backend has pickled file format for the index making it hacky // to have the magic in the right place. bool FileStructureConsistent(const base::FilePath& path) { - if (!file_util::PathExists(path) && !file_util::CreateDirectory(path)) { + if (!base::PathExists(path) && !file_util::CreateDirectory(path)) { LOG(ERROR) << "Failed to create directory: " << path.LossyDisplayName(); return false; } diff --git a/net/disk_cache/simple/simple_index_file.cc b/net/disk_cache/simple/simple_index_file.cc index 067e9c6..e154553 100644 --- a/net/disk_cache/simple/simple_index_file.cc +++ b/net/disk_cache/simple/simple_index_file.cc @@ -165,7 +165,7 @@ void SimpleIndexFile::SyncLoadIndexEntries( // TODO(felipeg): probably could load a stale index and use it for something. scoped_ptr<SimpleIndex::EntrySet> index_file_entries; - const bool index_file_exists = file_util::PathExists(index_file_path); + const bool index_file_exists = base::PathExists(index_file_path); // Only load if the index is not stale. const bool index_stale = IsIndexFileStale(index_file_path); diff --git a/net/disk_cache/simple/simple_index_file_unittest.cc b/net/disk_cache/simple/simple_index_file_unittest.cc index 8e5b88d..e2493f9 100644 --- a/net/disk_cache/simple/simple_index_file_unittest.cc +++ b/net/disk_cache/simple/simple_index_file_unittest.cc @@ -196,7 +196,7 @@ TEST_F(SimpleIndexFileTest, WriteThenLoadIndex) { simple_index_file.WriteToDisk(entries, kCacheSize, base::TimeTicks(), false); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(index_path)); + EXPECT_TRUE(base::PathExists(index_path)); } WrappedSimpleIndexFile simple_index_file(temp_dir.path()); @@ -204,7 +204,7 @@ TEST_F(SimpleIndexFileTest, WriteThenLoadIndex) { GetCallback()); base::RunLoop().RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(index_path)); + EXPECT_TRUE(base::PathExists(index_path)); ASSERT_TRUE(callback_result()); EXPECT_FALSE(callback_result()->force_index_flush); const SimpleIndex::EntrySet* read_entries = @@ -235,7 +235,7 @@ TEST_F(SimpleIndexFileTest, LoadCorruptIndex) { GetCallback()); base::RunLoop().RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(index_path)); + EXPECT_FALSE(base::PathExists(index_path)); ASSERT_TRUE(callback_result()); EXPECT_TRUE(callback_result()->force_index_flush); EXPECT_TRUE(callback_result()->index_file_entries); diff --git a/net/dns/dns_hosts.cc b/net/dns/dns_hosts.cc index 5aa4aaa..e0a40a1 100644 --- a/net/dns/dns_hosts.cc +++ b/net/dns/dns_hosts.cc @@ -139,7 +139,7 @@ void ParseHosts(const std::string& contents, DnsHosts* dns_hosts) { bool ParseHostsFile(const base::FilePath& path, DnsHosts* dns_hosts) { dns_hosts->clear(); // Missing file indicates empty HOSTS. - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return true; int64 size; diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index 7b8a408..a38a37a 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -826,7 +826,7 @@ bool SettingGetterImplGSettings::LoadAndCheckVersion( Tokenize(path, ":", &paths); for (size_t i = 0; i < paths.size(); ++i) { base::FilePath file(paths[i]); - if (file_util::PathExists(file.Append("gnome-network-properties"))) { + if (base::PathExists(file.Append("gnome-network-properties"))) { VLOG(1) << "Found gnome-network-properties. Will fall back to gconf."; return false; } diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 45f6ae3..53419ab 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -1550,7 +1550,7 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { // Note that its timestamp will be at least as new as the .kde one. file_util::CreateDirectory(kde4_config_); file_util::WriteFile(kioslaverc4_, slaverc4.c_str(), slaverc4.length()); - CHECK(file_util::PathExists(kioslaverc4_)); + CHECK(base::PathExists(kioslaverc4_)); { SCOPED_TRACE("KDE4, .kde4 directory present, use it"); MockEnvironment* env = new MockEnvironment; diff --git a/net/test/embedded_test_server/embedded_test_server.cc b/net/test/embedded_test_server/embedded_test_server.cc index 9cdf21b..9175d6c 100644 --- a/net/test/embedded_test_server/embedded_test_server.cc +++ b/net/test/embedded_test_server/embedded_test_server.cc @@ -65,7 +65,7 @@ scoped_ptr<HttpResponse> HandleFileRequest( base::FilePath headers_path( file_path.AddExtension(FILE_PATH_LITERAL("mock-http-headers"))); - if (file_util::PathExists(headers_path)) { + if (base::PathExists(headers_path)) { std::string headers_contents; if (!file_util::ReadFileToString(headers_path, &headers_contents)) return scoped_ptr<HttpResponse>(); diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc index 4598128..4a276b6 100644 --- a/net/test/spawned_test_server/base_test_server.cc +++ b/net/test/spawned_test_server/base_test_server.cc @@ -340,7 +340,7 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { if (!certificate_file.value().empty()) { certificate_path = certificate_path.Append(certificate_file); if (certificate_path.IsAbsolute() && - !file_util::PathExists(certificate_path)) { + !base::PathExists(certificate_path)) { LOG(ERROR) << "Certificate path " << certificate_path.value() << " doesn't exist. Can't launch https server."; return false; @@ -356,7 +356,7 @@ bool BaseTestServer::GenerateArguments(base::DictionaryValue* arguments) const { std::vector<base::FilePath>::const_iterator it; for (it = ssl_options_.client_authorities.begin(); it != ssl_options_.client_authorities.end(); ++it) { - if (it->IsAbsolute() && !file_util::PathExists(*it)) { + if (it->IsAbsolute() && !base::PathExists(*it)) { LOG(ERROR) << "Client authority path " << it->value() << " doesn't exist. Can't launch https server."; return false; diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc index 5613d0d..7072864 100644 --- a/net/tools/crash_cache/crash_cache.cc +++ b/net/tools/crash_cache/crash_cache.cc @@ -118,7 +118,7 @@ bool CreateTargetFolder(const base::FilePath& path, RankCrashes action, *full_path = path.AppendASCII(folders[action]); - if (file_util::PathExists(*full_path)) + if (base::PathExists(*full_path)) return false; return file_util::CreateDirectory(*full_path); diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 4e42ed4..1a70ed4 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -1369,7 +1369,7 @@ TEST_F(URLFetcherFileTest, SmallGet) { base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). - ASSERT_FALSE(file_util::PathExists(file_path_)) + ASSERT_FALSE(base::PathExists(file_path_)) << file_path_.value() << " not removed."; } @@ -1417,7 +1417,7 @@ TEST_F(URLFetcherFileTest, SavedOutputFileOwnerhisp) { base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). base::MessageLoop::current()->RunUntilIdle(); - ASSERT_EQ(kTake[i], file_util::PathExists(file_path_)) << + ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << "FilePath: " << file_path_.value(); } } @@ -1437,7 +1437,7 @@ TEST_F(URLFetcherFileTest, OverwriteExistingFile) { file_path_ = temp_dir.path().AppendASCII(kFileToFetch); ASSERT_EQ(static_cast<int>(data.size()), file_util::WriteFile(file_path_, data.data(), data.size())); - ASSERT_TRUE(file_util::PathExists(file_path_)); + ASSERT_TRUE(base::PathExists(file_path_)); expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch); ASSERT_FALSE(file_util::ContentsEqual(file_path_, expected_file_)); @@ -1462,7 +1462,7 @@ TEST_F(URLFetcherFileTest, TryToOverwriteDirectory) { static const char kFileToFetch[] = "simple.html"; file_path_ = temp_dir.path().AppendASCII(kFileToFetch); ASSERT_TRUE(file_util::CreateDirectory(file_path_)); - ASSERT_TRUE(file_util::PathExists(file_path_)); + ASSERT_TRUE(base::PathExists(file_path_)); // Get a small file. expected_file_error_ = ERR_ACCESS_DENIED; @@ -1490,7 +1490,7 @@ TEST_F(URLFetcherFileTest, SmallGetToTempFile) { base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). - ASSERT_FALSE(file_util::PathExists(file_path_)) + ASSERT_FALSE(base::PathExists(file_path_)) << file_path_.value() << " not removed."; } @@ -1531,7 +1531,7 @@ TEST_F(URLFetcherFileTest, SavedOutputTempFileOwnerhisp) { base::MessageLoop::current()->Run(); // OnURLFetchComplete() will Quit(). base::MessageLoop::current()->RunUntilIdle(); - ASSERT_EQ(kTake[i], file_util::PathExists(file_path_)) << + ASSERT_EQ(kTake[i], base::PathExists(file_path_)) << "FilePath: " << file_path_.value(); } } diff --git a/sql/connection.cc b/sql/connection.cc index f04eb3b..ac8c0cd 100644 --- a/sql/connection.cc +++ b/sql/connection.cc @@ -449,9 +449,9 @@ bool Connection::Delete(const base::FilePath& path) { base::Delete(wal_path, false); base::Delete(path, false); - return !file_util::PathExists(journal_path) && - !file_util::PathExists(wal_path) && - !file_util::PathExists(path); + return !base::PathExists(journal_path) && + !base::PathExists(wal_path) && + !base::PathExists(path); } bool Connection::BeginTransaction() { diff --git a/sql/connection_unittest.cc b/sql/connection_unittest.cc index c85382f..37cb750 100644 --- a/sql/connection_unittest.cc +++ b/sql/connection_unittest.cc @@ -325,7 +325,7 @@ TEST_F(SQLConnectionTest, RazeEmptyDB) { TEST_F(SQLConnectionTest, RazeNOTADB) { db().Close(); sql::Connection::Delete(db_path()); - ASSERT_FALSE(file_util::PathExists(db_path())); + ASSERT_FALSE(base::PathExists(db_path())); { file_util::ScopedFILE file(file_util::OpenFile(db_path(), "w")); @@ -334,7 +334,7 @@ TEST_F(SQLConnectionTest, RazeNOTADB) { const char* kJunk = "This is the hour of our discontent."; fputs(kJunk, file.get()); } - ASSERT_TRUE(file_util::PathExists(db_path())); + ASSERT_TRUE(base::PathExists(db_path())); // SQLite will successfully open the handle, but will fail with // SQLITE_IOERR_SHORT_READ on pragma statemenets which read the @@ -551,12 +551,12 @@ TEST_F(SQLConnectionTest, Delete) { // Should have both a main database file and a journal file because // of journal_mode PERSIST. base::FilePath journal(db_path().value() + FILE_PATH_LITERAL("-journal")); - ASSERT_TRUE(file_util::PathExists(db_path())); - ASSERT_TRUE(file_util::PathExists(journal)); + ASSERT_TRUE(base::PathExists(db_path())); + ASSERT_TRUE(base::PathExists(journal)); sql::Connection::Delete(db_path()); - EXPECT_FALSE(file_util::PathExists(db_path())); - EXPECT_FALSE(file_util::PathExists(journal)); + EXPECT_FALSE(base::PathExists(db_path())); + EXPECT_FALSE(base::PathExists(journal)); } } // namespace diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index 5efd74d..a9efd99 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -597,7 +597,7 @@ Status ChromiumEnv::NewWritableFile(const std::string& fname, } bool ChromiumEnv::FileExists(const std::string& fname) { - return ::file_util::PathExists(CreateFilePath(fname)); + return ::base::PathExists(CreateFilePath(fname)); } Status ChromiumEnv::GetChildren(const std::string& dir, @@ -665,7 +665,7 @@ Status ChromiumEnv::GetFileSize(const std::string& fname, uint64_t* size) { Status ChromiumEnv::RenameFile(const std::string& src, const std::string& dst) { Status result; base::FilePath src_file_path = CreateFilePath(src); - if (!::file_util::PathExists(src_file_path)) + if (!::base::PathExists(src_file_path)) return result; base::FilePath destination = CreateFilePath(dst); diff --git a/third_party/zlib/google/zip_unittest.cc b/third_party/zlib/google/zip_unittest.cc index 40f776b..0572b85 100644 --- a/third_party/zlib/google/zip_unittest.cc +++ b/third_party/zlib/google/zip_unittest.cc @@ -71,7 +71,7 @@ class ZipTest : public PlatformTest { } void TestUnzipFile(const base::FilePath& path, bool expect_hidden_files) { - ASSERT_TRUE(file_util::PathExists(path)) << "no file " << path.value(); + ASSERT_TRUE(base::PathExists(path)) << "no file " << path.value(); ASSERT_TRUE(zip::Unzip(path, test_dir_)); base::FileEnumerator files(test_dir_, true, @@ -130,7 +130,7 @@ TEST_F(ZipTest, UnzipEvil) { base::FilePath evil_file = output_dir; evil_file = evil_file.AppendASCII( "../levilevilevilevilevilevilevilevilevilevilevilevil"); - ASSERT_FALSE(file_util::PathExists(evil_file)); + ASSERT_FALSE(base::PathExists(evil_file)); } TEST_F(ZipTest, UnzipEvil2) { @@ -145,7 +145,7 @@ TEST_F(ZipTest, UnzipEvil2) { ASSERT_FALSE(zip::Unzip(path, output_dir)); base::FilePath evil_file = output_dir; evil_file = evil_file.AppendASCII("../evil.txt"); - ASSERT_FALSE(file_util::PathExists(evil_file)); + ASSERT_FALSE(base::PathExists(evil_file)); } TEST_F(ZipTest, Zip) { diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 8edb6d4..dab5097 100644 --- a/ui/base/resource/resource_bundle.cc +++ b/ui/base/resource/resource_bundle.cc @@ -224,7 +224,7 @@ base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) return base::FilePath(); - if (test_file_exists && !file_util::PathExists(locale_file_path)) + if (test_file_exists && !base::PathExists(locale_file_path)) return base::FilePath(); return locale_file_path; diff --git a/ui/base/resource/resource_bundle_ios.mm b/ui/base/resource/resource_bundle_ios.mm index e054802..c1daa91 100644 --- a/ui/base/resource/resource_bundle_ios.mm +++ b/ui/base/resource/resource_bundle_ios.mm @@ -82,7 +82,7 @@ base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) return base::FilePath(); - if (test_file_exists && !file_util::PathExists(locale_file_path)) + if (test_file_exists && !base::PathExists(locale_file_path)) return base::FilePath(); return locale_file_path; diff --git a/ui/base/resource/resource_bundle_mac.mm b/ui/base/resource/resource_bundle_mac.mm index 79f834f..5de8ecc 100644 --- a/ui/base/resource/resource_bundle_mac.mm +++ b/ui/base/resource/resource_bundle_mac.mm @@ -90,7 +90,7 @@ base::FilePath ResourceBundle::GetLocaleFilePath(const std::string& app_locale, if (locale_file_path.empty() || !locale_file_path.IsAbsolute()) return base::FilePath(); - if (test_file_exists && !file_util::PathExists(locale_file_path)) + if (test_file_exists && !base::PathExists(locale_file_path)) return base::FilePath(); return locale_file_path; diff --git a/ui/base/ui_base_paths.cc b/ui/base/ui_base_paths.cc index 98642b4..ae1f3ff 100644 --- a/ui/base/ui_base_paths.cc +++ b/ui/base/ui_base_paths.cc @@ -48,7 +48,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("app")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // we don't want to create this + if (!base::PathExists(cur)) // we don't want to create this return false; break; #if defined(OS_ANDROID) @@ -62,7 +62,7 @@ bool PathProvider(int key, base::FilePath* result) { return false; } - if (create_dir && !file_util::PathExists(cur) && + if (create_dir && !base::PathExists(cur) && !file_util::CreateDirectory(cur)) return false; diff --git a/ui/gfx/gfx_paths.cc b/ui/gfx/gfx_paths.cc index e78e72a..3d53dfd 100644 --- a/ui/gfx/gfx_paths.cc +++ b/ui/gfx/gfx_paths.cc @@ -24,7 +24,7 @@ bool PathProvider(int key, base::FilePath* result) { cur = cur.Append(FILE_PATH_LITERAL("gfx")); cur = cur.Append(FILE_PATH_LITERAL("test")); cur = cur.Append(FILE_PATH_LITERAL("data")); - if (!file_util::PathExists(cur)) // we don't want to create this + if (!base::PathExists(cur)) // we don't want to create this return false; break; default: diff --git a/ui/gfx/icon_util_unittest.cc b/ui/gfx/icon_util_unittest.cc index a63da08..b1548ce 100644 --- a/ui/gfx/icon_util_unittest.cc +++ b/ui/gfx/icon_util_unittest.cc @@ -73,7 +73,7 @@ class IconUtilTest : public testing::Test { void IconUtilTest::CheckAllIconSizes(const base::FilePath& icon_filename, int max_icon_size) { - ASSERT_TRUE(file_util::PathExists(icon_filename)); + ASSERT_TRUE(base::PathExists(icon_filename)); // Determine how many icons to expect, based on |max_icon_size|. int expected_num_icons = 0; @@ -214,7 +214,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { image_family.Add(gfx::Image::CreateFrom1xBitmap(*bitmap)); EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(image_family, valid_icon_filename)); - EXPECT_FALSE(file_util::PathExists(valid_icon_filename)); + EXPECT_FALSE(base::PathExists(valid_icon_filename)); // Invalid bitmap size. image_family.clear(); @@ -225,7 +225,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { image_family.Add(gfx::Image::CreateFrom1xBitmap(*bitmap)); EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(image_family, valid_icon_filename)); - EXPECT_FALSE(file_util::PathExists(valid_icon_filename)); + EXPECT_FALSE(base::PathExists(valid_icon_filename)); // Bitmap with no allocated pixels. image_family.clear(); @@ -237,7 +237,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { image_family.Add(gfx::Image::CreateFrom1xBitmap(*bitmap)); EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(image_family, valid_icon_filename)); - EXPECT_FALSE(file_util::PathExists(valid_icon_filename)); + EXPECT_FALSE(base::PathExists(valid_icon_filename)); // Invalid file name. image_family.clear(); @@ -247,7 +247,7 @@ TEST_F(IconUtilTest, TestCreateIconFileInvalidParameters) { image_family.Add(gfx::Image::CreateFrom1xBitmap(*bitmap)); EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(image_family, invalid_icon_filename)); - EXPECT_FALSE(file_util::PathExists(invalid_icon_filename)); + EXPECT_FALSE(base::PathExists(invalid_icon_filename)); } // This test case makes sure IconUtil::CreateIconFileFromImageFamily fails if @@ -259,14 +259,14 @@ TEST_F(IconUtilTest, TestCreateIconFileEmptyImageFamily) { // Empty image family. EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(gfx::ImageFamily(), icon_filename)); - EXPECT_FALSE(file_util::PathExists(icon_filename)); + EXPECT_FALSE(base::PathExists(icon_filename)); // Image family with only an empty image. gfx::ImageFamily image_family; image_family.Add(gfx::Image()); EXPECT_FALSE(IconUtil::CreateIconFileFromImageFamily(image_family, icon_filename)); - EXPECT_FALSE(file_util::PathExists(icon_filename)); + EXPECT_FALSE(base::PathExists(icon_filename)); } // This test case makes sure that when we load an icon from disk and convert diff --git a/webkit/browser/appcache/appcache_database.cc b/webkit/browser/appcache/appcache_database.cc index 5f507d1..dc23be3 100644 --- a/webkit/browser/appcache/appcache_database.cc +++ b/webkit/browser/appcache/appcache_database.cc @@ -994,7 +994,7 @@ bool AppCacheDatabase::LazyOpen(bool create_if_needed) { // Avoid creating a database at all if we can. bool use_in_memory_db = db_file_path_.empty(); if (!create_if_needed && - (use_in_memory_db || !file_util::PathExists(db_file_path_))) { + (use_in_memory_db || !base::PathExists(db_file_path_))) { return false; } @@ -1179,7 +1179,7 @@ void AppCacheDatabase::ResetConnectionAndTables() { bool AppCacheDatabase::DeleteExistingAndCreateNewDatabase() { DCHECK(!db_file_path_.empty()); - DCHECK(file_util::PathExists(db_file_path_)); + DCHECK(base::PathExists(db_file_path_)); VLOG(1) << "Deleting existing appcache data and starting over."; ResetConnectionAndTables(); @@ -1192,7 +1192,7 @@ bool AppCacheDatabase::DeleteExistingAndCreateNewDatabase() { } // Make sure the steps above actually deleted things. - if (file_util::PathExists(db_file_path_)) + if (base::PathExists(db_file_path_)) return false; // So we can't go recursive. diff --git a/webkit/browser/appcache/appcache_database_unittest.cc b/webkit/browser/appcache/appcache_database_unittest.cc index e1a5142..5974d83 100644 --- a/webkit/browser/appcache/appcache_database_unittest.cc +++ b/webkit/browser/appcache/appcache_database_unittest.cc @@ -66,15 +66,15 @@ TEST(AppCacheDatabaseTest, ReCreate) { EXPECT_FALSE(db.LazyOpen(false)); EXPECT_TRUE(db.LazyOpen(true)); - EXPECT_TRUE(file_util::PathExists(kDbFile)); + EXPECT_TRUE(base::PathExists(kDbFile)); EXPECT_TRUE(file_util::DirectoryExists(kNestedDir)); - EXPECT_TRUE(file_util::PathExists(kOtherFile)); + EXPECT_TRUE(base::PathExists(kOtherFile)); EXPECT_TRUE(db.DeleteExistingAndCreateNewDatabase()); - EXPECT_TRUE(file_util::PathExists(kDbFile)); + EXPECT_TRUE(base::PathExists(kDbFile)); EXPECT_FALSE(file_util::DirectoryExists(kNestedDir)); - EXPECT_FALSE(file_util::PathExists(kOtherFile)); + EXPECT_FALSE(base::PathExists(kOtherFile)); } TEST(AppCacheDatabaseTest, ExperimentalFlags) { @@ -87,7 +87,7 @@ TEST(AppCacheDatabaseTest, ExperimentalFlags) { const base::FilePath kDbFile = temp_dir.path().AppendASCII("appcache.db"); const base::FilePath kOtherFile = temp_dir.path().AppendASCII("other_file"); EXPECT_EQ(3, file_util::WriteFile(kOtherFile, "foo", 3)); - EXPECT_TRUE(file_util::PathExists(kOtherFile)); + EXPECT_TRUE(base::PathExists(kOtherFile)); AppCacheDatabase db(kDbFile); EXPECT_TRUE(db.LazyOpen(true)); @@ -104,7 +104,7 @@ TEST(AppCacheDatabaseTest, ExperimentalFlags) { EXPECT_TRUE(db.LazyOpen(false)); EXPECT_TRUE(db.meta_table_->GetValue(kExperimentFlagsKey, &flags)); EXPECT_TRUE(flags.empty()); - EXPECT_FALSE(file_util::PathExists(kOtherFile)); + EXPECT_FALSE(base::PathExists(kOtherFile)); } TEST(AppCacheDatabaseTest, EntryRecords) { diff --git a/webkit/browser/database/database_tracker.cc b/webkit/browser/database/database_tracker.cc index aa6838b..ce155ca 100644 --- a/webkit/browser/database/database_tracker.cc +++ b/webkit/browser/database/database_tracker.cc @@ -468,7 +468,7 @@ bool DatabaseTracker::LazyInit() { const base::FilePath kTrackerDatabaseFullPath = db_dir_.Append(base::FilePath(kTrackerDatabaseFileName)); if (file_util::DirectoryExists(db_dir_) && - file_util::PathExists(kTrackerDatabaseFullPath) && + base::PathExists(kTrackerDatabaseFullPath) && (!db_->Open(kTrackerDatabaseFullPath) || !sql::MetaTable::DoesTableExist(db_.get()))) { db_->Close(); diff --git a/webkit/browser/database/database_tracker_unittest.cc b/webkit/browser/database/database_tracker_unittest.cc index 68dcf22..5c15154 100644 --- a/webkit/browser/database/database_tracker_unittest.cc +++ b/webkit/browser/database/database_tracker_unittest.cc @@ -249,7 +249,7 @@ class DatabaseTracker_TestHelper_Test { tracker->DatabaseClosed(kOrigin1, kDB1); result = callback.GetResult(result); EXPECT_EQ(net::OK, result); - EXPECT_FALSE(file_util::PathExists( + EXPECT_FALSE(base::PathExists( tracker->DatabaseDirectory().AppendASCII(kOrigin1))); // Recreate db1. @@ -285,12 +285,12 @@ class DatabaseTracker_TestHelper_Test { tracker->DatabaseClosed(kOrigin2, kDB2); result = callback.GetResult(result); EXPECT_EQ(net::OK, result); - EXPECT_FALSE(file_util::PathExists( + EXPECT_FALSE(base::PathExists( tracker->DatabaseDirectory().AppendASCII(kOrigin1))); EXPECT_TRUE( - file_util::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); + base::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); EXPECT_TRUE( - file_util::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB3))); + base::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB3))); tracker->DatabaseClosed(kOrigin2, kDB3); tracker->RemoveObserver(&observer); @@ -613,13 +613,13 @@ class DatabaseTracker_TestHelper_Test { EXPECT_EQ(size_t(1), origins_info.size()); EXPECT_EQ(kOrigin1, origins_info[0].GetOriginIdentifier()); EXPECT_TRUE( - file_util::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); + base::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); EXPECT_EQ(base::FilePath(), tracker->GetFullDBFilePath(kOrigin2, kDB2)); // The origin directory of kOrigin1 remains, but the origin directory of // kOrigin2 is deleted. - EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); - EXPECT_FALSE(file_util::PathExists(origin2_db_dir)); + EXPECT_TRUE(base::PathExists(origin1_db_dir)); + EXPECT_FALSE(base::PathExists(origin2_db_dir)); } static void DatabaseTrackerSetForceKeepSessionState() { @@ -692,12 +692,12 @@ class DatabaseTracker_TestHelper_Test { // No origins were deleted. EXPECT_EQ(size_t(2), origins_info.size()); EXPECT_TRUE( - file_util::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); + base::PathExists(tracker->GetFullDBFilePath(kOrigin1, kDB1))); EXPECT_TRUE( - file_util::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); + base::PathExists(tracker->GetFullDBFilePath(kOrigin2, kDB2))); - EXPECT_TRUE(file_util::PathExists(origin1_db_dir)); - EXPECT_TRUE(file_util::PathExists(origin2_db_dir)); + EXPECT_TRUE(base::PathExists(origin1_db_dir)); + EXPECT_TRUE(base::PathExists(origin2_db_dir)); } static void EmptyDatabaseNameIsValid() { @@ -794,12 +794,12 @@ class DatabaseTracker_TestHelper_Test { tracker->HandleSqliteError(kOriginId, kName, SQLITE_CORRUPT); EXPECT_TRUE(tracker->IsDatabaseScheduledForDeletion(kOriginId, kName)); EXPECT_TRUE(observer.DidReceiveNewNotification()); - EXPECT_TRUE(file_util::PathExists(spoof_db_file)); + EXPECT_TRUE(base::PathExists(spoof_db_file)); // Verify that once closed, the file is deleted and the record in the // tracker db is removed. tracker->DatabaseClosed(kOriginId, kName); - EXPECT_FALSE(file_util::PathExists(spoof_db_file)); + EXPECT_FALSE(base::PathExists(spoof_db_file)); EXPECT_TRUE(tracker->GetFullDBFilePath(kOriginId, kName).empty()); // -------------------------------------------------------- @@ -819,7 +819,7 @@ class DatabaseTracker_TestHelper_Test { EXPECT_FALSE(tracker->IsDatabaseScheduledForDeletion(kOriginId, kName)); EXPECT_FALSE(observer.DidReceiveNewNotification()); EXPECT_TRUE(tracker->GetFullDBFilePath(kOriginId, kName).empty()); - EXPECT_FALSE(file_util::PathExists(spoof_db_file2)); + EXPECT_FALSE(base::PathExists(spoof_db_file2)); tracker->RemoveObserver(&observer); } diff --git a/webkit/browser/database/vfs_backend.cc b/webkit/browser/database/vfs_backend.cc index 109664d..1f459f5 100644 --- a/webkit/browser/database/vfs_backend.cc +++ b/webkit/browser/database/vfs_backend.cc @@ -120,7 +120,7 @@ void VfsBackend::OpenTempFileInDirectory( // static int VfsBackend::DeleteFile(const base::FilePath& file_path, bool sync_dir) { - if (!file_util::PathExists(file_path)) + if (!base::PathExists(file_path)) return SQLITE_OK; if (!base::Delete(file_path, false)) return SQLITE_IOERR_DELETE; diff --git a/webkit/browser/dom_storage/dom_storage_area_unittest.cc b/webkit/browser/dom_storage/dom_storage_area_unittest.cc index 661290a..8ea94b7 100644 --- a/webkit/browser/dom_storage/dom_storage_area_unittest.cc +++ b/webkit/browser/dom_storage/dom_storage_area_unittest.cc @@ -135,7 +135,7 @@ TEST_F(DomStorageAreaTest, BackingDatabaseOpened) { new DomStorageArea(kOrigin, base::FilePath(), NULL)); EXPECT_EQ(NULL, area->backing_.get()); EXPECT_TRUE(area->is_initial_import_done_); - EXPECT_FALSE(file_util::PathExists(kExpectedOriginFilePath)); + EXPECT_FALSE(base::PathExists(kExpectedOriginFilePath)); } // Valid directory and origin but no session storage backing. Backing should @@ -153,7 +153,7 @@ TEST_F(DomStorageAreaTest, BackingDatabaseOpened) { // Check that saving a value has still left us without a backing database. EXPECT_EQ(NULL, area->backing_.get()); - EXPECT_FALSE(file_util::PathExists(kExpectedOriginFilePath)); + EXPECT_FALSE(base::PathExists(kExpectedOriginFilePath)); } // This should set up a DomStorageArea that is correctly backed to disk. @@ -323,17 +323,17 @@ TEST_F(DomStorageAreaTest, DeleteOrigin) { // Nothing bad should happen when invoked w/o any files on disk. area->DeleteOrigin(); - EXPECT_FALSE(file_util::PathExists(db_file_path)); + EXPECT_FALSE(base::PathExists(db_file_path)); // Commit something in the database and then delete. base::NullableString16 old_value; area->SetItem(kKey, kValue, &old_value); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(db_file_path)); + EXPECT_TRUE(base::PathExists(db_file_path)); area->DeleteOrigin(); EXPECT_EQ(0u, area->Length()); - EXPECT_FALSE(file_util::PathExists(db_file_path)); - EXPECT_FALSE(file_util::PathExists(db_journal_file_path)); + EXPECT_FALSE(base::PathExists(db_file_path)); + EXPECT_FALSE(base::PathExists(db_journal_file_path)); // Put some uncommitted changes to a non-existing database in // and then delete. No file ever gets created in this case. @@ -345,13 +345,13 @@ TEST_F(DomStorageAreaTest, DeleteOrigin) { EXPECT_EQ(0u, area->Length()); base::MessageLoop::current()->RunUntilIdle(); EXPECT_FALSE(area->HasUncommittedChanges()); - EXPECT_FALSE(file_util::PathExists(db_file_path)); + EXPECT_FALSE(base::PathExists(db_file_path)); // Put some uncommitted changes to a an existing database in // and then delete. area->SetItem(kKey, kValue, &old_value); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(db_file_path)); + EXPECT_TRUE(base::PathExists(db_file_path)); area->SetItem(kKey2, kValue2, &old_value); EXPECT_TRUE(area->HasUncommittedChanges()); EXPECT_EQ(2u, area->Length()); @@ -362,10 +362,10 @@ TEST_F(DomStorageAreaTest, DeleteOrigin) { EXPECT_FALSE(area->HasUncommittedChanges()); // Since the area had uncommitted changes at the time delete // was called, the file will linger until the shutdown time. - EXPECT_TRUE(file_util::PathExists(db_file_path)); + EXPECT_TRUE(base::PathExists(db_file_path)); area->Shutdown(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(db_file_path)); + EXPECT_FALSE(base::PathExists(db_file_path)); } TEST_F(DomStorageAreaTest, PurgeMemory) { diff --git a/webkit/browser/dom_storage/dom_storage_database.cc b/webkit/browser/dom_storage/dom_storage_database.cc index 24713a0..12e38ed 100644 --- a/webkit/browser/dom_storage/dom_storage_database.cc +++ b/webkit/browser/dom_storage/dom_storage_database.cc @@ -88,7 +88,7 @@ bool DomStorageDatabase::CommitChanges(bool clear_all_first, // If we're being asked to commit changes that will result in an // empty database, we return true if the database file doesn't exist. return clear_all_first && changes.empty() && - !file_util::PathExists(file_path_); + !base::PathExists(file_path_); } bool old_known_to_be_empty = known_to_be_empty_; @@ -150,7 +150,7 @@ bool DomStorageDatabase::LazyOpen(bool create_if_needed) { if (IsOpen()) return true; - bool database_exists = file_util::PathExists(file_path_); + bool database_exists = base::PathExists(file_path_); if (!database_exists && !create_if_needed) { // If the file doesn't exist already and we haven't been asked to create @@ -257,7 +257,7 @@ bool DomStorageDatabase::CreateTableV2() { bool DomStorageDatabase::DeleteFileAndRecreate() { DCHECK(!IsOpen()); - DCHECK(file_util::PathExists(file_path_)); + DCHECK(base::PathExists(file_path_)); // We should only try and do this once. if (tried_to_recreate_) diff --git a/webkit/browser/dom_storage/dom_storage_database_unittest.cc b/webkit/browser/dom_storage/dom_storage_database_unittest.cc index 4d8db91..d3d4ae2 100644 --- a/webkit/browser/dom_storage/dom_storage_database_unittest.cc +++ b/webkit/browser/dom_storage/dom_storage_database_unittest.cc @@ -122,7 +122,7 @@ TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { EXPECT_EQ(file_name, db.file_path()); ASSERT_TRUE(db.CommitChanges(false, storage)); } - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); { // Check that reading an existing db with data in it @@ -133,14 +133,14 @@ TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { EXPECT_EQ(storage.size(), values.size()); } - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); storage.clear(); { DomStorageDatabase db(file_name); ASSERT_TRUE(db.CommitChanges(true, storage)); } - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); // Now ensure that a series of updates and removals whose net effect // is an empty database also triggers deletion. @@ -150,7 +150,7 @@ TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { ASSERT_TRUE(db.CommitChanges(false, storage)); } - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); { DomStorageDatabase db(file_name); @@ -160,7 +160,7 @@ TEST(DomStorageDatabaseTest, CloseEmptyDatabaseDeletesFile) { it->second = base::NullableString16(); ASSERT_TRUE(db.CommitChanges(false, storage)); } - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); } TEST(DomStorageDatabaseTest, TestLazyOpenIsLazy) { @@ -313,7 +313,7 @@ TEST(DomStorageDatabaseTest, TestCanOpenAndReadWebCoreDatabase) { webcore_database = webcore_database.AppendASCII("webcore_test_database.localstorage"); - ASSERT_TRUE(file_util::PathExists(webcore_database)); + ASSERT_TRUE(base::PathExists(webcore_database)); DomStorageDatabase db(webcore_database); ValuesMap values; @@ -374,7 +374,7 @@ TEST(DomStorageDatabaseTest, TestCanOpenFileThatIsNotADatabase) { EXPECT_EQ(0u, values.size()); EXPECT_FALSE(db.IsOpen()); - EXPECT_TRUE(file_util::PathExists(temp_dir.path())); + EXPECT_TRUE(base::PathExists(temp_dir.path())); } } diff --git a/webkit/browser/dom_storage/session_storage_database.cc b/webkit/browser/dom_storage/session_storage_database.cc index f7eaba6..0d8c572 100644 --- a/webkit/browser/dom_storage/session_storage_database.cc +++ b/webkit/browser/dom_storage/session_storage_database.cc @@ -279,7 +279,7 @@ bool SessionStorageDatabase::LazyOpen(bool create_if_needed) { return true; if (!create_if_needed && - (!file_util::PathExists(file_path_) || + (!base::PathExists(file_path_) || file_util::IsDirectoryEmpty(file_path_))) { // If the directory doesn't exist already and we haven't been asked to // create a file on disk, then we don't bother opening the database. This diff --git a/webkit/browser/fileapi/file_system_usage_cache.cc b/webkit/browser/fileapi/file_system_usage_cache.cc index d9352fc..9dcfaee 100644 --- a/webkit/browser/fileapi/file_system_usage_cache.cc +++ b/webkit/browser/fileapi/file_system_usage_cache.cc @@ -149,7 +149,7 @@ bool FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, bool FileSystemUsageCache::Exists(const base::FilePath& usage_file_path) { TRACE_EVENT0("FileSystem", "UsageCache::Exists"); DCHECK(CalledOnValidThread()); - return file_util::PathExists(usage_file_path); + return base::PathExists(usage_file_path); } bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { diff --git a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc index 54ac218..84e9a8c 100644 --- a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc +++ b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc @@ -100,7 +100,7 @@ TEST_F(LocalFileStreamWriterTest, Write) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "bar")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foobar", GetFileContent(path)); } @@ -111,7 +111,7 @@ TEST_F(LocalFileStreamWriterTest, WriteMiddle) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foxxxr", GetFileContent(path)); } @@ -122,19 +122,19 @@ TEST_F(LocalFileStreamWriterTest, WriteEnd) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foobarxxx", GetFileContent(path)); } TEST_F(LocalFileStreamWriterTest, WriteFailForNonexistingFile) { base::FilePath path = Path("file_a"); - ASSERT_FALSE(file_util::PathExists(path)); + ASSERT_FALSE(base::PathExists(path)); scoped_ptr<LocalFileStreamWriter> writer( new LocalFileStreamWriter(file_task_runner(), path, 0)); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, WriteStringToWriter(writer.get(), "foo")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(path)); + EXPECT_FALSE(base::PathExists(path)); } TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) { @@ -159,7 +159,7 @@ TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) { writer.reset(); base::MessageLoop::current()->RunUntilIdle(); // Write operation is already completed. - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foo", GetFileContent(path)); } diff --git a/webkit/browser/fileapi/local_file_util_unittest.cc b/webkit/browser/fileapi/local_file_util_unittest.cc index 1eb3792..46f2e9a 100644 --- a/webkit/browser/fileapi/local_file_util_unittest.cc +++ b/webkit/browser/fileapi/local_file_util_unittest.cc @@ -74,7 +74,7 @@ class LocalFileUtilTest : public testing::Test { } bool FileExists(const char *file_name) { - return file_util::PathExists(LocalPath(file_name)) && + return base::PathExists(LocalPath(file_name)) && !file_util::DirectoryExists(LocalPath(file_name)); } diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc index 7b12a62..84b027b 100644 --- a/webkit/browser/fileapi/native_file_util.cc +++ b/webkit/browser/fileapi/native_file_util.cc @@ -126,10 +126,10 @@ PlatformFileError NativeFileUtil::CreateDirectory( bool exclusive, bool recursive) { // If parent dir of file doesn't exist. - if (!recursive && !file_util::PathExists(path.DirName())) + if (!recursive && !base::PathExists(path.DirName())) return base::PLATFORM_FILE_ERROR_NOT_FOUND; - bool path_exists = file_util::PathExists(path); + bool path_exists = base::PathExists(path); if (exclusive && path_exists) return base::PLATFORM_FILE_ERROR_EXISTS; @@ -149,7 +149,7 @@ PlatformFileError NativeFileUtil::CreateDirectory( PlatformFileError NativeFileUtil::GetFileInfo( const base::FilePath& path, base::PlatformFileInfo* file_info) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::GetFileInfo(path, file_info)) return base::PLATFORM_FILE_ERROR_FAILED; @@ -195,7 +195,7 @@ PlatformFileError NativeFileUtil::Truncate( } bool NativeFileUtil::PathExists(const base::FilePath& path) { - return file_util::PathExists(path); + return base::PathExists(path); } bool NativeFileUtil::DirectoryExists(const base::FilePath& path) { @@ -238,7 +238,7 @@ PlatformFileError NativeFileUtil::CopyOrMoveFile( } PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (file_util::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_FILE; @@ -248,7 +248,7 @@ PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { } PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; diff --git a/webkit/browser/fileapi/native_file_util_unittest.cc b/webkit/browser/fileapi/native_file_util_unittest.cc index e42effb..3b99ab1 100644 --- a/webkit/browser/fileapi/native_file_util_unittest.cc +++ b/webkit/browser/fileapi/native_file_util_unittest.cc @@ -29,7 +29,7 @@ class NativeFileUtilTest : public testing::Test { } bool FileExists(const base::FilePath& path) { - return file_util::PathExists(path) && + return base::PathExists(path) && !file_util::DirectoryExists(path); } @@ -56,7 +56,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { &file_handle, &created)); ASSERT_TRUE(created); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); EXPECT_TRUE(NativeFileUtil::PathExists(file_name)); EXPECT_EQ(0, GetSize(file_name)); EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); @@ -72,7 +72,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::DeleteFile(file_name)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); EXPECT_FALSE(NativeFileUtil::PathExists(file_name)); } diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc index 174cb81..abc3cc5 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.cc +++ b/webkit/browser/fileapi/obfuscated_file_util.cc @@ -1103,7 +1103,7 @@ PlatformFileError ObfuscatedFileUtil::CreateFile( src_file_path, dest_local_path, true /* copy */); created = true; } else { - if (file_util::PathExists(dest_local_path)) { + if (base::PathExists(dest_local_path)) { if (!base::Delete(dest_local_path, true /* recursive */)) { NOTREACHED(); return base::PLATFORM_FILE_ERROR_FAILED; diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc index 31e8e87..e865b3d 100644 --- a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc @@ -37,7 +37,7 @@ namespace fileapi { namespace { bool FileExists(const base::FilePath& path) { - return file_util::PathExists(path) && !file_util::DirectoryExists(path); + return base::PathExists(path) && !file_util::DirectoryExists(path); } int64 GetSize(const base::FilePath& path) { @@ -720,7 +720,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); - EXPECT_TRUE(file_util::PathExists(local_path)); + EXPECT_TRUE(base::PathExists(local_path)); // Verify that deleting a file isn't stopped by zero quota, and that it frees // up quote from its path. @@ -729,7 +729,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteFile(context.get(), url)); EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); - EXPECT_FALSE(file_util::PathExists(local_path)); + EXPECT_FALSE(base::PathExists(local_path)); EXPECT_EQ(ObfuscatedFileUtil::ComputeFilePathCost(url.path()), context->allowed_bytes_growth()); @@ -758,13 +758,13 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); - EXPECT_TRUE(file_util::PathExists(local_path)); + EXPECT_TRUE(base::PathExists(local_path)); context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteFile(context.get(), url)); EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); - EXPECT_FALSE(file_util::PathExists(local_path)); + EXPECT_FALSE(base::PathExists(local_path)); // Make sure we have no unexpected changes. EXPECT_TRUE(change_observer()->HasNoChange()); diff --git a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc index 620be98..5c0a7da 100644 --- a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc +++ b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc @@ -98,7 +98,7 @@ int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { usage_cache()->CloseCacheFiles(); int64 size = base::ComputeDirectorySize(GetOriginRootPath()); - if (file_util::PathExists(GetUsageCachePath())) + if (base::PathExists(GetUsageCachePath())) size -= FileSystemUsageCache::kUsageFileSize; return size; } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc index a64ea5e..d99ef85 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc @@ -72,7 +72,7 @@ void SandboxIsolatedOriginDatabase::MigrateDatabaseIfNeeded() { base::FilePath from_path = file_system_directory_.Append(directory_name); base::FilePath to_path = file_system_directory_.Append(kOriginDirectory); - if (file_util::PathExists(to_path)) + if (base::PathExists(to_path)) base::Delete(to_path, true /* recursive */); base::Move(from_path, to_path); } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc index b334741..f430fa0 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc @@ -47,7 +47,7 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { { SandboxOriginDatabase database_old(dir.path()); old_db_path = database_old.GetDatabasePath(); - EXPECT_FALSE(file_util::PathExists(old_db_path)); + EXPECT_FALSE(base::PathExists(old_db_path)); EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin, &path)); EXPECT_FALSE(path.empty()); EXPECT_TRUE(file_util::DirectoryExists(old_db_path)); @@ -75,13 +75,13 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { std::string origin_db_data; base::FilePath directory_db_path = dir.path().Append(path); EXPECT_TRUE(file_util::DirectoryExists(directory_db_path)); - EXPECT_TRUE(file_util::PathExists(directory_db_path.AppendASCII("dummy"))); + EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); EXPECT_TRUE(file_util::ReadFileToString( directory_db_path.AppendASCII("dummy"), &origin_db_data)); EXPECT_EQ(kFakeDirectoryData, origin_db_data); // After the migration the database must be gone. - EXPECT_FALSE(file_util::PathExists(old_db_path)); + EXPECT_FALSE(base::PathExists(old_db_path)); } } // namespace fileapi diff --git a/webkit/browser/fileapi/sandbox_origin_database.cc b/webkit/browser/fileapi/sandbox_origin_database.cc index 0d7d3ef..f85ddbe 100644 --- a/webkit/browser/fileapi/sandbox_origin_database.cc +++ b/webkit/browser/fileapi/sandbox_origin_database.cc @@ -71,7 +71,7 @@ bool SandboxOriginDatabase::Init(InitOption init_option, return true; base::FilePath db_path = GetDatabasePath(); - if (init_option == FAIL_IF_NONEXISTENT && !file_util::PathExists(db_path)) + if (init_option == FAIL_IF_NONEXISTENT && !base::PathExists(db_path)) return false; std::string path = FilePathToString(db_path); diff --git a/webkit/browser/fileapi/sandbox_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_origin_database_unittest.cc index 49e5045..867dc27 100644 --- a/webkit/browser/fileapi/sandbox_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_origin_database_unittest.cc @@ -32,7 +32,7 @@ TEST(SandboxOriginDatabaseTest, BasicTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -55,14 +55,14 @@ TEST(SandboxOriginDatabaseTest, BasicTest) { EXPECT_FALSE(path1.empty()); EXPECT_EQ(path0, path1); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); } TEST(SandboxOriginDatabaseTest, TwoPathTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -83,14 +83,14 @@ TEST(SandboxOriginDatabaseTest, TwoPathTest) { EXPECT_FALSE(path1.empty()); EXPECT_NE(path0, path1); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); } TEST(SandboxOriginDatabaseTest, DropDatabaseTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -103,7 +103,7 @@ TEST(SandboxOriginDatabaseTest, DropDatabaseTest) { EXPECT_TRUE(database.HasOriginPath(origin)); EXPECT_FALSE(path0.empty()); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); database.DropDatabase(); @@ -118,7 +118,7 @@ TEST(SandboxOriginDatabaseTest, DeleteOriginTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -145,7 +145,7 @@ TEST(SandboxOriginDatabaseTest, ListOriginsTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); std::vector<SandboxOriginDatabase::OriginRecord> origins; @@ -195,7 +195,7 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryTest) { ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); const base::FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); const std::string kOrigins[] = { @@ -255,8 +255,8 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryTest) { EXPECT_FALSE(path.empty()); EXPECT_TRUE(database->HasOriginPath(kOrigin)); - EXPECT_FALSE(file_util::PathExists(kGarbageFile)); - EXPECT_FALSE(file_util::PathExists(kGarbageDir)); + EXPECT_FALSE(base::PathExists(kGarbageFile)); + EXPECT_FALSE(base::PathExists(kGarbageDir)); } TEST(SandboxOriginDatabaseTest, DatabaseRecoveryForMissingDBFileTest) { @@ -275,7 +275,7 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryForMissingDBFileTest) { ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); const base::FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); const std::string kOrigin = "foo.example.com"; diff --git a/webkit/browser/fileapi/transient_file_util_unittest.cc b/webkit/browser/fileapi/transient_file_util_unittest.cc index 66be6db..02a2329 100644 --- a/webkit/browser/fileapi/transient_file_util_unittest.cc +++ b/webkit/browser/fileapi/transient_file_util_unittest.cc @@ -85,7 +85,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { // Make sure the file is there. ASSERT_TRUE(temp_url.is_valid()); - ASSERT_TRUE(file_util::PathExists(temp_path)); + ASSERT_TRUE(base::PathExists(temp_path)); ASSERT_FALSE(file_util::DirectoryExists(temp_path)); // Create a snapshot file. @@ -101,7 +101,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { ASSERT_FALSE(file_info.is_directory); // The file should be still there. - ASSERT_TRUE(file_util::PathExists(temp_path)); + ASSERT_TRUE(base::PathExists(temp_path)); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->GetFileInfo(NewOperationContext().get(), temp_url, &file_info, &path)); @@ -113,7 +113,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { base::MessageLoop::current()->RunUntilIdle(); // Now the temporary file and the transient filesystem must be gone too. - ASSERT_FALSE(file_util::PathExists(temp_path)); + ASSERT_FALSE(base::PathExists(temp_path)); ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, file_util()->GetFileInfo(NewOperationContext().get(), temp_url, &file_info, &path)); diff --git a/webkit/browser/quota/quota_database.cc b/webkit/browser/quota/quota_database.cc index 2a63598..759540f 100644 --- a/webkit/browser/quota/quota_database.cc +++ b/webkit/browser/quota/quota_database.cc @@ -440,7 +440,7 @@ bool QuotaDatabase::LazyOpen(bool create_if_needed) { bool in_memory_only = db_file_path_.empty(); if (!create_if_needed && - (in_memory_only || !file_util::PathExists(db_file_path_))) { + (in_memory_only || !base::PathExists(db_file_path_))) { return false; } @@ -552,7 +552,7 @@ bool QuotaDatabase::CreateSchema( bool QuotaDatabase::ResetSchema() { DCHECK(!db_file_path_.empty()); - DCHECK(file_util::PathExists(db_file_path_)); + DCHECK(base::PathExists(db_file_path_)); VLOG(1) << "Deleting existing quota data and starting over."; db_.reset(); diff --git a/webkit/browser/quota/quota_database_unittest.cc b/webkit/browser/quota/quota_database_unittest.cc index 86c7649..347b01c 100644 --- a/webkit/browser/quota/quota_database_unittest.cc +++ b/webkit/browser/quota/quota_database_unittest.cc @@ -39,7 +39,7 @@ class QuotaDatabaseTest : public testing::Test { EXPECT_FALSE(db.LazyOpen(false)); ASSERT_TRUE(db.LazyOpen(true)); EXPECT_TRUE(db.db_.get()); - EXPECT_TRUE(kDbFile.empty() || file_util::PathExists(kDbFile)); + EXPECT_TRUE(kDbFile.empty() || base::PathExists(kDbFile)); } void UpgradeSchemaV2toV3(const base::FilePath& kDbFile) { diff --git a/webkit/common/blob/shareable_file_reference_unittest.cc b/webkit/common/blob/shareable_file_reference_unittest.cc index 14ab668..6ba94d2 100644 --- a/webkit/common/blob/shareable_file_reference_unittest.cc +++ b/webkit/common/blob/shareable_file_reference_unittest.cc @@ -22,7 +22,7 @@ TEST(ShareableFileReferenceTest, TestReferences) { // Create a file. base::FilePath file; file_util::CreateTemporaryFileInDir(temp_dir.path(), &file); - EXPECT_TRUE(file_util::PathExists(file)); + EXPECT_TRUE(base::PathExists(file)); // Create a first reference to that file. scoped_refptr<ShareableFileReference> reference1; @@ -45,13 +45,13 @@ TEST(ShareableFileReferenceTest, TestReferences) { reference1 = NULL; EXPECT_TRUE(ShareableFileReference::Get(file).get()); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(file)); + EXPECT_TRUE(base::PathExists(file)); // Drop the second reference, the file and reference should get deleted. reference2 = NULL; EXPECT_FALSE(ShareableFileReference::Get(file).get()); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(file)); + EXPECT_FALSE(base::PathExists(file)); // TODO(michaeln): add a test for files that aren't deletable behavior. } diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc index e5aaae9..1249190 100644 --- a/webkit/glue/webfileutilities_impl.cc +++ b/webkit/glue/webfileutilities_impl.cc @@ -26,7 +26,7 @@ WebFileUtilitiesImpl::~WebFileUtilitiesImpl() { } bool WebFileUtilitiesImpl::fileExists(const WebString& path) { - return file_util::PathExists(base::FilePath::FromUTF16Unsafe(path)); + return base::PathExists(base::FilePath::FromUTF16Unsafe(path)); } bool WebFileUtilitiesImpl::deleteFile(const WebString& path) { diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index d1c8be3..bcf6571 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -201,15 +201,15 @@ class WebPluginImplWithPageDelegate base::FilePath GetWebKitRootDirFilePath() { base::FilePath basePath; PathService::Get(base::DIR_SOURCE_ROOT, &basePath); - if (file_util::PathExists( + if (base::PathExists( basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { // We're in a WebKit-in-chrome checkout. basePath = basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")); - } else if (file_util::PathExists( + } else if (base::PathExists( basePath.Append(FILE_PATH_LITERAL("chromium")))) { // We're in a WebKit-only checkout on Windows. basePath = basePath.Append(FILE_PATH_LITERAL("../..")); - } else if (file_util::PathExists( + } else if (base::PathExists( basePath.Append(FILE_PATH_LITERAL("webkit/support")))) { // We're in a WebKit-only/xcodebuild checkout on Mac basePath = basePath.Append(FILE_PATH_LITERAL("../../..")); @@ -246,7 +246,7 @@ namespace webkit_support { base::FilePath GetChromiumRootDirFilePath() { base::FilePath basePath; PathService::Get(base::DIR_SOURCE_ROOT, &basePath); - if (file_util::PathExists( + if (base::PathExists( basePath.Append(FILE_PATH_LITERAL("third_party/WebKit")))) { // We're in a WebKit-in-chrome checkout. return basePath; @@ -512,7 +512,7 @@ WebURL RewriteLayoutTestsURL(const std::string& utf8_url) { // On Android, the file is actually accessed through file-over-http. Disable // the following CHECK because the file is unlikely to exist on the device. #if !defined(OS_ANDROID) - CHECK(file_util::PathExists(replacePath)) << replacePath.value() << + CHECK(base::PathExists(replacePath)) << replacePath.value() << " (re-written from " << utf8_url << ") does not exit"; #endif diff --git a/webkit/support/weburl_loader_mock_factory.cc b/webkit/support/weburl_loader_mock_factory.cc index 1ac9bd49..612df83 100644 --- a/webkit/support/weburl_loader_mock_factory.cc +++ b/webkit/support/weburl_loader_mock_factory.cc @@ -47,7 +47,7 @@ void WebURLLoaderMockFactory::RegisterURL(const WebURL& url, response_info.file_path = base::FilePath(std::wstring( file_path_16.data(), file_path_16.length())); #endif - DCHECK(file_util::PathExists(response_info.file_path)) + DCHECK(base::PathExists(response_info.file_path)) << response_info.file_path.MaybeAsASCII() << " does not exist."; } diff --git a/win8/delegate_execute/chrome_util.cc b/win8/delegate_execute/chrome_util.cc index 894b5b3..e2b9b07 100644 --- a/win8/delegate_execute/chrome_util.cc +++ b/win8/delegate_execute/chrome_util.cc @@ -81,7 +81,7 @@ bool IsBrowserRunning(const base::FilePath& chrome_exe) { // |chrome_exe|. bool NewChromeExeExists(const base::FilePath& chrome_exe) { base::FilePath new_chrome_exe(chrome_exe.DirName().Append(kNewChromeExe)); - return file_util::PathExists(new_chrome_exe); + return base::PathExists(new_chrome_exe); } bool GetUpdateCommand(bool is_per_user, string16* update_command) { diff --git a/win8/delegate_execute/command_execute_impl.cc b/win8/delegate_execute/command_execute_impl.cc index 1bed342..eb1e035 100644 --- a/win8/delegate_execute/command_execute_impl.cc +++ b/win8/delegate_execute/command_execute_impl.cc @@ -71,7 +71,7 @@ bool LaunchChromeBrowserProcess() { delegate_exe_path.DirName() .DirName() .Append(chrome::kBrowserProcessExecutableName); - if (!file_util::PathExists(chrome_exe_path)) { + if (!base::PathExists(chrome_exe_path)) { // Try looking in the current directory if we couldn't find it one up in // order to support developer installs. chrome_exe_path = @@ -79,7 +79,7 @@ bool LaunchChromeBrowserProcess() { .Append(chrome::kBrowserProcessExecutableName); } - if (!file_util::PathExists(chrome_exe_path)) { + if (!base::PathExists(chrome_exe_path)) { AtlTrace("Could not locate chrome.exe at: %ls\n", chrome_exe_path.value().c_str()); return false; @@ -392,9 +392,9 @@ bool CommandExecuteImpl::FindChromeExe(base::FilePath* chrome_exe) { } *chrome_exe = dir_exe.DirName().Append(chrome::kBrowserProcessExecutableName); - if (!file_util::PathExists(*chrome_exe)) { + if (!base::PathExists(*chrome_exe)) { *chrome_exe = dir_exe.Append(chrome::kBrowserProcessExecutableName); - if (!file_util::PathExists(*chrome_exe)) { + if (!base::PathExists(*chrome_exe)) { AtlTrace("Failed to find chrome exe file\n"); return false; } diff --git a/win8/test/metro_registration_helper.cc b/win8/test/metro_registration_helper.cc index dd07cf6..202eb73 100644 --- a/win8/test/metro_registration_helper.cc +++ b/win8/test/metro_registration_helper.cc @@ -43,7 +43,7 @@ bool RegisterTestDefaultBrowser() { base::FilePath chrome_exe(dir.Append(kChromeExe)); base::FilePath registrar(dir.Append(kRegistrar)); - if (!file_util::PathExists(chrome_exe) || !file_util::PathExists(registrar)) { + if (!base::PathExists(chrome_exe) || !base::PathExists(registrar)) { LOG(ERROR) << "Could not locate " << kChromeExe << " or " << kRegistrar; return false; } |