diff options
113 files changed, 330 insertions, 335 deletions
diff --git a/base/file_util.cc b/base/file_util.cc index 4e1163a..2623b64 100644 --- a/base/file_util.cc +++ b/base/file_util.cc @@ -56,17 +56,6 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path) { return internal::CopyFileUnsafe(from_path, to_path); } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::FileEnumerator; -using base::FilePath; -using base::kExtensionSeparator; -using base::kMaxUniqueFiles; - bool ContentsEqual(const FilePath& filename1, const FilePath& filename2) { // We open the file in binary format even if they are text files because // we are just comparing that bytes are exactly same in both files and not @@ -141,6 +130,17 @@ bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2) { return true; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::FileEnumerator; +using base::FilePath; +using base::kExtensionSeparator; +using base::kMaxUniqueFiles; + bool ReadFileToString(const FilePath& path, std::string* contents) { if (path.ReferencesParent()) return false; diff --git a/base/file_util.h b/base/file_util.h index 095734b..e6d7ac8 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -116,27 +116,27 @@ BASE_EXPORT bool CopyDirectory(const FilePath& from_path, // false otherwise. BASE_EXPORT bool PathExists(const FilePath& path); -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - // Returns true if the given path is writable by the user, false otherwise. -BASE_EXPORT bool PathIsWritable(const base::FilePath& path); +BASE_EXPORT bool PathIsWritable(const FilePath& path); // Returns true if the given path exists and is a directory, false otherwise. -BASE_EXPORT bool DirectoryExists(const base::FilePath& path); +BASE_EXPORT bool DirectoryExists(const FilePath& path); // Returns true if the contents of the two files given are equal, false // otherwise. If either file can't be read, returns false. -BASE_EXPORT bool ContentsEqual(const base::FilePath& filename1, - const base::FilePath& filename2); +BASE_EXPORT bool ContentsEqual(const FilePath& filename1, + const FilePath& filename2); // Returns true if the contents of the two text files given are equal, false // otherwise. This routine treats "\r\n" and "\n" as equivalent. -BASE_EXPORT bool TextContentsEqual(const base::FilePath& filename1, - const base::FilePath& filename2); +BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, + const FilePath& filename2); + +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { // Read the file at |path| into |contents|, returning true on success. // This function fails if the |path| contains path traversal components ('..'). diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index f438253..c368534 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -314,6 +314,19 @@ bool PathExists(const FilePath& path) { return access(path.value().c_str(), F_OK) == 0; } +bool PathIsWritable(const FilePath& path) { + ThreadRestrictions::AssertIOAllowed(); + return access(path.value().c_str(), W_OK) == 0; +} + +bool DirectoryExists(const FilePath& path) { + ThreadRestrictions::AssertIOAllowed(); + stat_wrapper_t file_info; + if (CallStat(path.value().c_str(), &file_info) == 0) + return S_ISDIR(file_info.st_mode); + return false; +} + } // namespace base // ----------------------------------------------------------------------------- @@ -323,25 +336,13 @@ namespace file_util { using base::stat_wrapper_t; using base::CallStat; using base::CallLstat; +using base::DirectoryExists; using base::FileEnumerator; using base::FilePath; using base::MakeAbsoluteFilePath; using base::RealPath; using base::VerifySpecificPathControlledByUser; -bool PathIsWritable(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); - return access(path.value().c_str(), W_OK) == 0; -} - -bool DirectoryExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); - stat_wrapper_t file_info; - if (CallStat(path.value().c_str(), &file_info) == 0) - return S_ISDIR(file_info.st_mode); - return false; -} - bool ReadFromFD(int fd, char* buffer, size_t bytes) { size_t total_read = 0; while (total_read < bytes) { diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index c73d079..e0007d5 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -35,8 +35,11 @@ // This macro helps avoid wrapped lines in the test structs. #define FPL(x) FILE_PATH_LITERAL(x) +using base::DirectoryExists; using base::FileEnumerator; using base::FilePath; +using base::PathIsWritable; +using base::TextContentsEqual; namespace { @@ -862,7 +865,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { int mode = 0; EXPECT_TRUE(file_util::GetPosixFilePermissions(file_name, &mode)); EXPECT_TRUE(mode & file_util::FILE_PERMISSION_WRITE_BY_USER); - EXPECT_TRUE(file_util::PathIsWritable(file_name)); + EXPECT_TRUE(PathIsWritable(file_name)); // Get rid of the write permission. EXPECT_TRUE(file_util::SetPosixFilePermissions(file_name, 0u)); @@ -871,7 +874,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { // Make sure the file can't be write. EXPECT_EQ(-1, file_util::WriteFile(file_name, kData.data(), kData.length())); - EXPECT_FALSE(file_util::PathIsWritable(file_name)); + EXPECT_FALSE(PathIsWritable(file_name)); // Give read permission. EXPECT_TRUE(file_util::SetPosixFilePermissions( @@ -882,7 +885,7 @@ TEST_F(FileUtilTest, ChangeFilePermissionsAndWrite) { // Make sure the file can be write. EXPECT_EQ(static_cast<int>(kData.length()), file_util::WriteFile(file_name, kData.data(), kData.length())); - EXPECT_TRUE(file_util::PathIsWritable(file_name)); + EXPECT_TRUE(PathIsWritable(file_name)); // Delete the file. EXPECT_TRUE(base::Delete(file_name, false)); @@ -1557,20 +1560,19 @@ TEST_F(ReadOnlyFileUtilTest, ContentsEqual) { FilePath binary_file_diff = data_dir.Append(FILE_PATH_LITERAL("binary_file_diff.bin")); - EXPECT_TRUE(file_util::ContentsEqual(original_file, original_file)); - EXPECT_TRUE(file_util::ContentsEqual(original_file, same_file)); - EXPECT_FALSE(file_util::ContentsEqual(original_file, same_length_file)); - EXPECT_FALSE(file_util::ContentsEqual(original_file, different_file)); - EXPECT_FALSE(file_util::ContentsEqual( - FilePath(FILE_PATH_LITERAL("bogusname")), - FilePath(FILE_PATH_LITERAL("bogusname")))); - EXPECT_FALSE(file_util::ContentsEqual(original_file, different_first_file)); - EXPECT_FALSE(file_util::ContentsEqual(original_file, different_last_file)); - EXPECT_TRUE(file_util::ContentsEqual(empty1_file, empty2_file)); - EXPECT_FALSE(file_util::ContentsEqual(original_file, shortened_file)); - EXPECT_FALSE(file_util::ContentsEqual(shortened_file, original_file)); - EXPECT_TRUE(file_util::ContentsEqual(binary_file, binary_file_same)); - EXPECT_FALSE(file_util::ContentsEqual(binary_file, binary_file_diff)); + EXPECT_TRUE(ContentsEqual(original_file, original_file)); + EXPECT_TRUE(ContentsEqual(original_file, same_file)); + EXPECT_FALSE(ContentsEqual(original_file, same_length_file)); + EXPECT_FALSE(ContentsEqual(original_file, different_file)); + EXPECT_FALSE(ContentsEqual(FilePath(FILE_PATH_LITERAL("bogusname")), + FilePath(FILE_PATH_LITERAL("bogusname")))); + EXPECT_FALSE(ContentsEqual(original_file, different_first_file)); + EXPECT_FALSE(ContentsEqual(original_file, different_last_file)); + EXPECT_TRUE(ContentsEqual(empty1_file, empty2_file)); + EXPECT_FALSE(ContentsEqual(original_file, shortened_file)); + EXPECT_FALSE(ContentsEqual(shortened_file, original_file)); + EXPECT_TRUE(ContentsEqual(binary_file, binary_file_same)); + EXPECT_FALSE(ContentsEqual(binary_file, binary_file_diff)); } TEST_F(ReadOnlyFileUtilTest, TextContentsEqual) { @@ -1606,19 +1608,16 @@ TEST_F(ReadOnlyFileUtilTest, TextContentsEqual) { FilePath blank_line_crlf_file = data_dir.Append(FILE_PATH_LITERAL("blank_line_crlf.txt")); - EXPECT_TRUE(file_util::TextContentsEqual(original_file, same_file)); - EXPECT_TRUE(file_util::TextContentsEqual(original_file, crlf_file)); - EXPECT_FALSE(file_util::TextContentsEqual(original_file, shortened_file)); - EXPECT_FALSE(file_util::TextContentsEqual(original_file, different_file)); - EXPECT_FALSE(file_util::TextContentsEqual(original_file, - different_first_file)); - EXPECT_FALSE(file_util::TextContentsEqual(original_file, - different_last_file)); - EXPECT_FALSE(file_util::TextContentsEqual(first1_file, first2_file)); - EXPECT_TRUE(file_util::TextContentsEqual(empty1_file, empty2_file)); - EXPECT_FALSE(file_util::TextContentsEqual(original_file, empty1_file)); - EXPECT_TRUE(file_util::TextContentsEqual(blank_line_file, - blank_line_crlf_file)); + EXPECT_TRUE(TextContentsEqual(original_file, same_file)); + EXPECT_TRUE(TextContentsEqual(original_file, crlf_file)); + EXPECT_FALSE(TextContentsEqual(original_file, shortened_file)); + EXPECT_FALSE(TextContentsEqual(original_file, different_file)); + EXPECT_FALSE(TextContentsEqual(original_file, different_first_file)); + EXPECT_FALSE(TextContentsEqual(original_file, different_last_file)); + EXPECT_FALSE(TextContentsEqual(first1_file, first2_file)); + EXPECT_TRUE(TextContentsEqual(empty1_file, empty2_file)); + EXPECT_FALSE(TextContentsEqual(original_file, empty1_file)); + EXPECT_TRUE(TextContentsEqual(blank_line_file, blank_line_crlf_file)); } // We don't need equivalent functionality outside of Windows. @@ -1688,7 +1687,7 @@ TEST_F(FileUtilTest, CreateTemporaryFileTest) { for (int i = 0; i < 3; i++) { ASSERT_TRUE(file_util::CreateTemporaryFile(&(temp_files[i]))); EXPECT_TRUE(base::PathExists(temp_files[i])); - EXPECT_FALSE(file_util::DirectoryExists(temp_files[i])); + EXPECT_FALSE(DirectoryExists(temp_files[i])); } for (int i = 0; i < 3; i++) EXPECT_FALSE(temp_files[i] == temp_files[(i+1)%3]); @@ -1742,7 +1741,7 @@ TEST_F(FileUtilTest, CreateNewTemporaryDirInDirTest) { TEST_F(FileUtilTest, GetShmemTempDirTest) { FilePath dir; EXPECT_TRUE(file_util::GetShmemTempDir(&dir, false)); - EXPECT_TRUE(file_util::DirectoryExists(dir)); + EXPECT_TRUE(DirectoryExists(dir)); } TEST_F(FileUtilTest, CreateDirectoryTest) { @@ -1776,13 +1775,12 @@ TEST_F(FileUtilTest, CreateDirectoryTest) { // Verify assumptions made by the Windows implementation: // 1. The current directory always exists. // 2. The root directory always exists. - ASSERT_TRUE(file_util::DirectoryExists( - FilePath(FilePath::kCurrentDirectory))); + ASSERT_TRUE(DirectoryExists(FilePath(FilePath::kCurrentDirectory))); FilePath top_level = test_root; while (top_level != top_level.DirName()) { top_level = top_level.DirName(); } - ASSERT_TRUE(file_util::DirectoryExists(top_level)); + ASSERT_TRUE(DirectoryExists(top_level)); // Given these assumptions hold, it should be safe to // test that "creating" these directories succeeds. @@ -1807,14 +1805,14 @@ TEST_F(FileUtilTest, DetectDirectoryTest) { EXPECT_FALSE(base::PathExists(test_root)); EXPECT_TRUE(file_util::CreateDirectory(test_root)); EXPECT_TRUE(base::PathExists(test_root)); - EXPECT_TRUE(file_util::DirectoryExists(test_root)); + EXPECT_TRUE(DirectoryExists(test_root)); // Check a file FilePath test_path = test_root.Append(FILE_PATH_LITERAL("foobar.txt")); EXPECT_FALSE(base::PathExists(test_path)); CreateTextFile(test_path, L"test file"); EXPECT_TRUE(base::PathExists(test_path)); - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(DirectoryExists(test_path)); EXPECT_TRUE(base::Delete(test_path, false)); EXPECT_TRUE(base::Delete(test_root, true)); diff --git a/base/file_util_win.cc b/base/file_util_win.cc index 90d8fca..95843d9 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -176,7 +176,7 @@ bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, return ShellCopy(from_path, to_path, true); // The following code assumes that from path is a directory. - DCHECK(file_util::DirectoryExists(from_path)); + DCHECK(DirectoryExists(from_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. @@ -198,17 +198,8 @@ bool PathExists(const FilePath& path) { return (GetFileAttributes(path.value().c_str()) != INVALID_FILE_ATTRIBUTES); } -} // namespace base - -// ----------------------------------------------------------------------------- - -namespace file_util { - -using base::FilePath; -using base::kFileShareAll; - bool PathIsWritable(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); HANDLE dir = CreateFile(path.value().c_str(), FILE_ADD_FILE, kFileShareAll, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); @@ -221,13 +212,23 @@ bool PathIsWritable(const FilePath& path) { } bool DirectoryExists(const FilePath& path) { - base::ThreadRestrictions::AssertIOAllowed(); + ThreadRestrictions::AssertIOAllowed(); DWORD fileattr = GetFileAttributes(path.value().c_str()); if (fileattr != INVALID_FILE_ATTRIBUTES) return (fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0; return false; } +} // namespace base + +// ----------------------------------------------------------------------------- + +namespace file_util { + +using base::DirectoryExists; +using base::FilePath; +using base::kFileShareAll; + bool GetTempDir(FilePath* path) { base::ThreadRestrictions::AssertIOAllowed(); @@ -710,7 +711,7 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { bool ret = false; DWORD last_error = ::GetLastError(); - if (file_util::DirectoryExists(from_path)) { + if (DirectoryExists(from_path)) { // MoveFileEx fails if moving directory across volumes. We will simulate // the move by using Copy and Delete. Ideally we could check whether // from_path and to_path are indeed in different volumes. diff --git a/base/files/file_path_watcher_win.cc b/base/files/file_path_watcher_win.cc index 823d74d..ac092a9 100644 --- a/base/files/file_path_watcher_win.cc +++ b/base/files/file_path_watcher_win.cc @@ -200,7 +200,7 @@ bool FilePathWatcherImpl::SetupWatchHandle(const FilePath& dir, // Make sure the handle we got points to an existing directory. It seems // that windows sometimes hands out watches to directories that are // about to go away, but doesn't sent notifications if that happens. - if (!file_util::DirectoryExists(dir)) { + if (!DirectoryExists(dir)) { FindCloseChangeNotification(*handle); *handle = INVALID_HANDLE_VALUE; } diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc index 721f671..fee97fb 100644 --- a/base/files/file_util_proxy.cc +++ b/base/files/file_util_proxy.cc @@ -197,7 +197,7 @@ PlatformFileError CreateOrOpenAdapter( PlatformFile* file_handle, bool* created) { DCHECK(file_handle); DCHECK(created); - if (!file_util::DirectoryExists(file_path.DirName())) { + if (!DirectoryExists(file_path.DirName())) { // If its parent does not exist, should return NOT_FOUND error. return PLATFORM_FILE_ERROR_NOT_FOUND; } diff --git a/base/files/scoped_temp_dir.cc b/base/files/scoped_temp_dir.cc index 5666ce1..3e90349 100644 --- a/base/files/scoped_temp_dir.cc +++ b/base/files/scoped_temp_dir.cc @@ -52,8 +52,7 @@ bool ScopedTempDir::Set(const FilePath& path) { if (!path_.empty()) return false; - if (!file_util::DirectoryExists(path) && - !file_util::CreateDirectory(path)) + if (!DirectoryExists(path) && !file_util::CreateDirectory(path)) return false; path_ = path; @@ -80,7 +79,7 @@ FilePath ScopedTempDir::Take() { } bool ScopedTempDir::IsValid() const { - return !path_.empty() && file_util::DirectoryExists(path_); + return !path_.empty() && DirectoryExists(path_); } } // namespace base diff --git a/base/files/scoped_temp_dir_unittest.cc b/base/files/scoped_temp_dir_unittest.cc index 7acec84..75afa61 100644 --- a/base/files/scoped_temp_dir_unittest.cc +++ b/base/files/scoped_temp_dir_unittest.cc @@ -17,32 +17,32 @@ TEST(ScopedTempDir, FullPath) { &test_path); // Against an existing dir, it should get destroyed when leaving scope. - EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(DirectoryExists(test_path)); { ScopedTempDir dir; EXPECT_TRUE(dir.Set(test_path)); EXPECT_TRUE(dir.IsValid()); } - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(DirectoryExists(test_path)); { ScopedTempDir dir; EXPECT_TRUE(dir.Set(test_path)); // Now the dir doesn't exist, so ensure that it gets created. - EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(DirectoryExists(test_path)); // When we call Release(), it shouldn't get destroyed when leaving scope. FilePath path = dir.Take(); EXPECT_EQ(path.value(), test_path.value()); EXPECT_FALSE(dir.IsValid()); } - EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(DirectoryExists(test_path)); // Clean up. { ScopedTempDir dir; EXPECT_TRUE(dir.Set(test_path)); } - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(DirectoryExists(test_path)); } TEST(ScopedTempDir, TempDir) { @@ -53,12 +53,12 @@ TEST(ScopedTempDir, TempDir) { ScopedTempDir dir; EXPECT_TRUE(dir.CreateUniqueTempDir()); test_path = dir.path(); - EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(DirectoryExists(test_path)); FilePath tmp_dir; EXPECT_TRUE(file_util::GetTempDir(&tmp_dir)); EXPECT_TRUE(test_path.value().find(tmp_dir.value()) != std::string::npos); } - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(DirectoryExists(test_path)); } TEST(ScopedTempDir, UniqueTempDirUnderPath) { @@ -72,11 +72,11 @@ TEST(ScopedTempDir, UniqueTempDirUnderPath) { ScopedTempDir dir; EXPECT_TRUE(dir.CreateUniqueTempDirUnderPath(base_path)); test_path = dir.path(); - EXPECT_TRUE(file_util::DirectoryExists(test_path)); + EXPECT_TRUE(DirectoryExists(test_path)); EXPECT_TRUE(base_path.IsParent(test_path)); EXPECT_TRUE(test_path.value().find(base_path.value()) != std::string::npos); } - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(DirectoryExists(test_path)); base::Delete(base_path, true); } diff --git a/base/json/json_value_serializer_unittest.cc b/base/json/json_value_serializer_unittest.cc index ce7129f..519af84 100644 --- a/base/json/json_value_serializer_unittest.cc +++ b/base/json/json_value_serializer_unittest.cc @@ -423,8 +423,7 @@ TEST_F(JSONFileValueSerializerTest, Roundtrip) { ASSERT_TRUE(PathExists(written_file_path)); // Now compare file contents. - EXPECT_TRUE(file_util::TextContentsEqual(original_file_path, - written_file_path)); + EXPECT_TRUE(TextContentsEqual(original_file_path, written_file_path)); EXPECT_TRUE(base::Delete(written_file_path, false)); } @@ -451,8 +450,7 @@ TEST_F(JSONFileValueSerializerTest, RoundtripNested) { ASSERT_TRUE(PathExists(written_file_path)); // Now compare file contents. - EXPECT_TRUE(file_util::TextContentsEqual(original_file_path, - written_file_path)); + EXPECT_TRUE(TextContentsEqual(original_file_path, written_file_path)); EXPECT_TRUE(base::Delete(written_file_path, false)); } diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm index 15f9e88..6544fca 100644 --- a/base/native_library_mac.mm +++ b/base/native_library_mac.mm @@ -45,8 +45,7 @@ static NativeLibraryObjCStatus GetObjCStatusForImage( NativeLibrary LoadNativeLibrary(const base::FilePath& library_path, std::string* error) { // dlopen() etc. open the file off disk. - if (library_path.Extension() == "dylib" || - !file_util::DirectoryExists(library_path)) { + if (library_path.Extension() == "dylib" || !DirectoryExists(library_path)) { void* dylib = dlopen(library_path.value().c_str(), RTLD_LAZY); if (!dylib) return NULL; diff --git a/base/nix/mime_util_xdg.cc b/base/nix/mime_util_xdg.cc index 7c1d660..1a41394 100644 --- a/base/nix/mime_util_xdg.cc +++ b/base/nix/mime_util_xdg.cc @@ -168,7 +168,7 @@ IconTheme::IconTheme(const std::string& name) &MimeUtilConstants::GetInstance()->icon_dirs_; for (iter = icon_dirs->begin(); iter != icon_dirs->end(); ++iter) { theme_path = iter->first.Append(name); - if (!file_util::DirectoryExists(theme_path)) + if (!DirectoryExists(theme_path)) continue; FilePath theme_index = theme_path.Append("index.theme"); if (!index_theme_loaded_ && PathExists(theme_index)) { @@ -387,7 +387,7 @@ bool IconTheme::SetDirectories(const std::string& dirs) { bool CheckDirExistsAndGetMtime(const FilePath& dir, base::Time* last_modified) { - if (!file_util::DirectoryExists(dir)) + if (!DirectoryExists(dir)) return false; base::PlatformFileInfo file_info; if (!file_util::GetFileInfo(dir, &file_info)) @@ -406,7 +406,7 @@ void TryAddIconDir(const FilePath& dir) { // For a xdg directory |dir|, add the appropriate icon sub-directories. void AddXDGDataDir(const FilePath& dir) { - if (!file_util::DirectoryExists(dir)) + if (!DirectoryExists(dir)) return; TryAddIconDir(dir.Append("icons")); TryAddIconDir(dir.Append("pixmaps")); @@ -418,7 +418,7 @@ void InitIconDir() { if (!home.empty()) { FilePath legacy_data_dir(home); legacy_data_dir = legacy_data_dir.AppendASCII(".icons"); - if (file_util::DirectoryExists(legacy_data_dir)) + if (DirectoryExists(legacy_data_dir)) TryAddIconDir(legacy_data_dir); } const char* env = getenv("XDG_DATA_HOME"); diff --git a/base/prefs/json_pref_store_unittest.cc b/base/prefs/json_pref_store_unittest.cc index 5c506d4..dcfea71 100644 --- a/base/prefs/json_pref_store_unittest.cc +++ b/base/prefs/json_pref_store_unittest.cc @@ -81,8 +81,7 @@ TEST_F(JsonPrefStoreTest, InvalidFile) { EXPECT_FALSE(PathExists(invalid_file)); base::FilePath moved_aside = temp_dir_.path().AppendASCII("invalid.bad"); EXPECT_TRUE(PathExists(moved_aside)); - EXPECT_TRUE(file_util::TextContentsEqual(invalid_file_original, - moved_aside)); + EXPECT_TRUE(TextContentsEqual(invalid_file_original, moved_aside)); } // This function is used to avoid code duplication while testing synchronous and @@ -147,7 +146,7 @@ void RunBasicJsonPrefStoreTest(JsonPrefStore* pref_store, ASSERT_TRUE(PathExists(golden_output_file)); pref_store->CommitPendingWrite(); RunLoop().RunUntilIdle(); - EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, output_file)); + EXPECT_TRUE(TextContentsEqual(golden_output_file, output_file)); ASSERT_TRUE(base::Delete(output_file, false)); } @@ -282,7 +281,7 @@ TEST_F(JsonPrefStoreTest, NeedsEmptyValue) { base::FilePath golden_output_file = data_dir_.AppendASCII("write.golden.need_empty_value.json"); ASSERT_TRUE(PathExists(golden_output_file)); - EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); + EXPECT_TRUE(TextContentsEqual(golden_output_file, pref_file)); } } // namespace base diff --git a/base/test/test_launcher.cc b/base/test/test_launcher.cc index 78f5ed3..aae48a5 100644 --- a/base/test/test_launcher.cc +++ b/base/test/test_launcher.cc @@ -162,7 +162,7 @@ ResultsPrinter::ResultsPrinter(const CommandLine& command_line) if (path.value().empty()) path = FilePath(kDefaultOutputFile); FilePath dir_name = path.DirName(); - if (!file_util::DirectoryExists(dir_name)) { + if (!DirectoryExists(dir_name)) { LOG(WARNING) << "The output directory does not exist. " << "Creating the directory: " << dir_name.value(); // Create the directory if necessary (because the gtest does the same). diff --git a/chrome/app/app_mode_loader_mac.mm b/chrome/app/app_mode_loader_mac.mm index b556044..6ca8308 100644 --- a/chrome/app/app_mode_loader_mac.mm +++ b/chrome/app/app_mode_loader_mac.mm @@ -51,7 +51,7 @@ void LoadFramework(void** cr_dylib, app_mode::ChromeAppModeInfo* info) { NSToCFCast(cr_bundle_id)))) autorelease]; cr_bundle_path = base::mac::NSStringToFilePath(cr_bundle_path_ns); bool found_bundle = - !cr_bundle_path.empty() && file_util::DirectoryExists(cr_bundle_path); + !cr_bundle_path.empty() && base::DirectoryExists(cr_bundle_path); if (!found_bundle) { // If no such bundle path exists, try to search by bundle ID. diff --git a/chrome/browser/browser_encoding_browsertest.cc b/chrome/browser/browser_encoding_browsertest.cc index 976c4b1..e4911db 100644 --- a/chrome/browser/browser_encoding_browsertest.cc +++ b/chrome/browser/browser_encoding_browsertest.cc @@ -133,7 +133,7 @@ class BrowserEncodingTest base::FilePath expected_file_name = ui_test_utils::GetTestFilePath( base::FilePath(kTestDir), expected); - EXPECT_TRUE(file_util::ContentsEqual(full_file_name, expected_file_name)); + EXPECT_TRUE(base::ContentsEqual(full_file_name, expected_file_name)); } virtual void SetUpOnMainThread() OVERRIDE { diff --git a/chrome/browser/chromeos/extensions/file_manager/file_manager_event_router.cc b/chrome/browser/chromeos/extensions/file_manager/file_manager_event_router.cc index b5a66ff..1237226 100644 --- a/chrome/browser/chromeos/extensions/file_manager/file_manager_event_router.cc +++ b/chrome/browser/chromeos/extensions/file_manager/file_manager_event_router.cc @@ -99,7 +99,7 @@ void DirectoryExistsOnBlockingPool(const base::FilePath& directory_path, const base::Closure& failure_callback) { DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); - if (file_util::DirectoryExists(directory_path)) + if (base::DirectoryExists(directory_path)) BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, success_callback); else BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, failure_callback); diff --git a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc index c1c3000..1d79a69 100644 --- a/chrome/browser/chromeos/extensions/wallpaper_private_api.cc +++ b/chrome/browser/chromeos/extensions/wallpaper_private_api.cc @@ -77,7 +77,7 @@ ash::WallpaperLayout GetLayoutEnum(const std::string& layout) { bool SaveData(int key, const std::string& file_name, const std::string& data) { base::FilePath data_dir; CHECK(PathService::Get(key, &data_dir)); - if (!file_util::DirectoryExists(data_dir) && + if (!base::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) { return false; } @@ -94,7 +94,7 @@ bool SaveData(int key, const std::string& file_name, const std::string& data) { // expected that we may try to access file which did not saved yet. bool GetData(const base::FilePath& path, std::string* data) { base::FilePath data_dir = path.DirName(); - if (!file_util::DirectoryExists(data_dir) && + if (!base::DirectoryExists(data_dir) && !file_util::CreateDirectory(data_dir)) return false; @@ -893,7 +893,7 @@ void WallpaperPrivateGetOfflineWallpaperListFunction::GetList( if (source == kOnlineSource) { base::FilePath wallpaper_dir; CHECK(PathService::Get(chrome::DIR_CHROMEOS_WALLPAPERS, &wallpaper_dir)); - if (file_util::DirectoryExists(wallpaper_dir)) { + if (base::DirectoryExists(wallpaper_dir)) { base::FileEnumerator files(wallpaper_dir, false, base::FileEnumerator::FILES); for (base::FilePath current = files.Next(); !current.empty(); diff --git a/chrome/browser/chromeos/login/wallpaper_manager.cc b/chrome/browser/chromeos/login/wallpaper_manager.cc index ff14a87..d5a7bbf 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager.cc @@ -671,7 +671,7 @@ void WallpaperManager::ClearObsoleteWallpaperPrefs() { void WallpaperManager::DeleteAllExcept(const base::FilePath& path) { base::FilePath dir = path.DirName(); - if (file_util::DirectoryExists(dir)) { + if (base::DirectoryExists(dir)) { base::FileEnumerator files(dir, false, base::FileEnumerator::FILES); for (base::FilePath current = files.Next(); !current.empty(); current = files.Next()) { diff --git a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc index 77833c0..0a5b626 100644 --- a/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc +++ b/chrome/browser/chromeos/login/wallpaper_manager_browsertest.cc @@ -94,7 +94,7 @@ class WallpaperManagerBrowserTest : public CrosInProcessBrowserTest, const std::string& id) { base::FilePath wallpaper_path = WallpaperManager::Get()->GetCustomWallpaperPath(sub_dir, email, id); - if (!file_util::DirectoryExists(wallpaper_path.DirName())) + if (!base::DirectoryExists(wallpaper_path.DirName())) file_util::CreateDirectory(wallpaper_path.DirName()); return wallpaper_path; diff --git a/chrome/browser/chromeos/policy/app_pack_updater.cc b/chrome/browser/chromeos/policy/app_pack_updater.cc index b020e86..feb5950 100644 --- a/chrome/browser/chromeos/policy/app_pack_updater.cc +++ b/chrome/browser/chromeos/policy/app_pack_updater.cc @@ -240,7 +240,7 @@ void AppPackUpdater::BlockingCheckCacheInternal( CacheEntryMap* entries) { // Start by verifying that the cache dir exists. base::FilePath dir(kAppPackCacheDir); - if (!file_util::DirectoryExists(dir)) { + if (!base::DirectoryExists(dir)) { // Create it now. if (!file_util::CreateDirectory(dir)) LOG(ERROR) << "Failed to create AppPack directory at " << dir.value(); @@ -484,7 +484,7 @@ void AppPackUpdater::BlockingInstallCacheEntry( base::Delete(cached_crx_path, true /* recursive */); } - if (!file_util::DirectoryExists(cache_dir)) { + if (!base::DirectoryExists(cache_dir)) { LOG(ERROR) << "AppPack cache directory does not exist, creating now: " << cache_dir.value(); if (!file_util::CreateDirectory(cache_dir)) { diff --git a/chrome/browser/component_updater/component_patcher_operation.cc b/chrome/browser/component_updater/component_patcher_operation.cc index ba84918..3f5f46a 100644 --- a/chrome/browser/component_updater/component_patcher_operation.cc +++ b/chrome/browser/component_updater/component_patcher_operation.cc @@ -72,7 +72,7 @@ ComponentUnpacker::Error DeltaUpdateOp::Run(base::DictionaryValue* command_args, return parse_result; const base::FilePath parent = output_abs_path_.DirName(); - if (!file_util::DirectoryExists(parent)) { + if (!base::DirectoryExists(parent)) { if (!file_util::CreateDirectory(parent)) return ComponentUnpacker::kIoError; } diff --git a/chrome/browser/component_updater/test/component_patcher_unittest.cc b/chrome/browser/component_updater/test/component_patcher_unittest.cc index f9933b3..f121fc0 100644 --- a/chrome/browser/component_updater/test/component_patcher_unittest.cc +++ b/chrome/browser/component_updater/test/component_patcher_unittest.cc @@ -85,7 +85,7 @@ TEST_F(ComponentPatcherOperationTest, CheckCreateOperation) { EXPECT_EQ(ComponentUnpacker::kNone, result); EXPECT_EQ(0, error); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), test_file("binary_output.bin"))); } @@ -112,7 +112,7 @@ TEST_F(ComponentPatcherOperationTest, CheckCopyOperation) { &error); EXPECT_EQ(ComponentUnpacker::kNone, result); EXPECT_EQ(0, error); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), test_file("binary_output.bin"))); } diff --git a/chrome/browser/component_updater/test/component_patcher_unittest_win.cc b/chrome/browser/component_updater/test/component_patcher_unittest_win.cc index 9787d92..afec59d 100644 --- a/chrome/browser/component_updater/test/component_patcher_unittest_win.cc +++ b/chrome/browser/component_updater/test/component_patcher_unittest_win.cc @@ -46,7 +46,7 @@ TEST_F(ComponentPatcherOperationTest, CheckCourgetteOperation) { &error); EXPECT_EQ(ComponentUnpacker::kNone, result); EXPECT_EQ(0, error); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), test_file("binary_output.bin"))); } @@ -77,7 +77,7 @@ TEST_F(ComponentPatcherOperationTest, CheckBsdiffOperation) { &error); EXPECT_EQ(ComponentUnpacker::kNone, result); EXPECT_EQ(0, error); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( unpack_dir_.path().Append(FILE_PATH_LITERAL("output.bin")), test_file("binary_output.bin"))); } diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc index f2043e5..059d6fc 100644 --- a/chrome/browser/diagnostics/recon_diagnostics.cc +++ b/chrome/browser/diagnostics/recon_diagnostics.cc @@ -278,7 +278,7 @@ class PathTest : public DiagnosticsTest { RecordSuccess("Path exists"); return true; } - if (!file_util::PathIsWritable(dir_or_file)) { + if (!base::PathIsWritable(dir_or_file)) { RecordFailure(DIAG_RECON_NOT_WRITABLE, "Path is not writable: " + UTF16ToUTF8(dir_or_file.LossyDisplayName())); diff --git a/chrome/browser/download/download_path_reservation_tracker.cc b/chrome/browser/download/download_path_reservation_tracker.cc index d241649..37954a3 100644 --- a/chrome/browser/download/download_path_reservation_tracker.cc +++ b/chrome/browser/download/download_path_reservation_tracker.cc @@ -180,7 +180,7 @@ void CreateReservation( // since been removed, do NOT automatically re-create it. Only automatically // create the directory if it is the default Downloads directory or if the // caller explicitly requested automatic directory creation. - if (!file_util::DirectoryExists(target_dir) && + if (!base::DirectoryExists(target_dir) && (create_directory || (!default_download_path.empty() && (default_download_path == target_dir)))) { @@ -189,7 +189,7 @@ void CreateReservation( // Check writability of the suggested path. If we can't write to it, default // to the user's "My Documents" directory. We'll prompt them in this case. - if (!file_util::PathIsWritable(target_dir)) { + if (!base::PathIsWritable(target_dir)) { DVLOG(1) << "Unable to write to directory \"" << target_dir.value() << "\""; is_path_writeable = false; PathService::Get(chrome::DIR_USER_DOCUMENTS, &target_dir); diff --git a/chrome/browser/download/download_path_reservation_tracker_unittest.cc b/chrome/browser/download/download_path_reservation_tracker_unittest.cc index 67a3dfb..6ac7b45 100644 --- a/chrome/browser/download/download_path_reservation_tracker_unittest.cc +++ b/chrome/browser/download/download_path_reservation_tracker_unittest.cc @@ -500,7 +500,7 @@ TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) { base::FilePath path( GetPathInDownloadsDirectory(FILE_PATH_LITERAL("foo/foo.txt"))); base::FilePath dir(path.DirName()); - ASSERT_FALSE(file_util::DirectoryExists(dir)); + ASSERT_FALSE(base::DirectoryExists(dir)); DownloadPathReservationTracker::FilenameConflictAction conflict_action = DownloadPathReservationTracker::OVERWRITE; bool create_directory = false; @@ -535,7 +535,7 @@ TEST_F(DownloadPathReservationTrackerTest, CreateDefaultDownloadPath) { &verified); // Verification succeeds because the directory is created. EXPECT_TRUE(verified); - EXPECT_TRUE(file_util::DirectoryExists(dir)); + EXPECT_TRUE(base::DirectoryExists(dir)); item->SetState(DownloadItem::COMPLETE); } } diff --git a/chrome/browser/download/save_page_browsertest.cc b/chrome/browser/download/save_page_browsertest.cc index 9378f06..afaef69 100644 --- a/chrome/browser/download/save_page_browsertest.cc +++ b/chrome/browser/download/save_page_browsertest.cc @@ -403,7 +403,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveHTMLOnly) { EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); - EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( + EXPECT_TRUE(base::ContentsEqual(test_dir_.Append(base::FilePath( kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } @@ -527,7 +527,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveViewSourceHTMLOnly) { EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).Append(file_name), full_file_name)); } @@ -562,13 +562,13 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_SaveCompleteHTML) { EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir)); - EXPECT_TRUE(file_util::TextContentsEqual( + EXPECT_TRUE(base::TextContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved1.htm"), full_file_name)); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), dir.AppendASCII("1.png"))); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), dir.AppendASCII("1.css"))); } @@ -660,13 +660,13 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_FileNameFromPageTitle) { EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_TRUE(base::PathExists(dir)); - EXPECT_TRUE(file_util::TextContentsEqual( + EXPECT_TRUE(base::TextContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("b.saved2.htm"), full_file_name)); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.png"), dir.AppendASCII("1.png"))); - EXPECT_TRUE(file_util::ContentsEqual( + EXPECT_TRUE(base::ContentsEqual( test_dir_.Append(base::FilePath(kTestDir)).AppendASCII("1.css"), dir.AppendASCII("1.css"))); } @@ -712,7 +712,7 @@ IN_PROC_BROWSER_TEST_F(SavePageBrowserTest, MAYBE_RemoveFromList) { EXPECT_TRUE(base::PathExists(full_file_name)); EXPECT_FALSE(base::PathExists(dir)); - EXPECT_TRUE(file_util::ContentsEqual(test_dir_.Append(base::FilePath( + EXPECT_TRUE(base::ContentsEqual(test_dir_.Append(base::FilePath( kTestDir)).Append(FILE_PATH_LITERAL("a.htm")), full_file_name)); } 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 0e6cd76..c02d5e01 100644 --- a/chrome/browser/extensions/api/file_system/file_system_api.cc +++ b/chrome/browser/extensions/api/file_system/file_system_api.cc @@ -658,7 +658,7 @@ void FileSystemChooseEntryFunction::SetInitialPathOnFileThread( const base::FilePath& suggested_name, const base::FilePath& previous_path) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); - if (!previous_path.empty() && file_util::DirectoryExists(previous_path)) { + if (!previous_path.empty() && base::DirectoryExists(previous_path)) { initial_path_ = previous_path.Append(suggested_name); } else { base::FilePath documents_dir; diff --git a/chrome/browser/extensions/api/record/record_api_test.cc b/chrome/browser/extensions/api/record/record_api_test.cc index dfcda5d..3fd41d9 100644 --- a/chrome/browser/extensions/api/record/record_api_test.cc +++ b/chrome/browser/extensions/api/record/record_api_test.cc @@ -106,13 +106,13 @@ class TestProcessStrategy : public ProcessStrategy { if (command_line.HasSwitch(switches::kRecordMode)) { base::CopyFile(url_path, url_path_copy); } else { - if (!file_util::ContentsEqual(url_path, url_path_copy)) { + if (!base::ContentsEqual(url_path, url_path_copy)) { std::string contents1, contents2; file_util::ReadFileToString(url_path, &contents1); file_util::ReadFileToString(url_path_copy, &contents2); LOG(ERROR) << "FILE MISMATCH" << contents1 << " VS " << contents2; } - EXPECT_TRUE(file_util::ContentsEqual(url_path, url_path_copy)); + EXPECT_TRUE(base::ContentsEqual(url_path, url_path_copy)); } } diff --git a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc index a64fc19..6184cfc 100644 --- a/chrome/browser/extensions/api/storage/managed_value_store_cache.cc +++ b/chrome/browser/extensions/api/storage/managed_value_store_cache.cc @@ -235,7 +235,7 @@ void ManagedValueStoreCache::DeleteStorageSoon( // (because the extension is unloaded, for example). Open the database to // clear it if it exists. // TODO(joaodasilva): move this check to a ValueStore method. - if (file_util::DirectoryExists(base_path_.AppendASCII(extension_id))) { + if (base::DirectoryExists(base_path_.AppendASCII(extension_id))) { CreateStoreFor( extension_id, false, @@ -383,7 +383,7 @@ void ManagedValueStoreCache::CreateStoreWithInitialPolicy( // If the database doesn't exist yet then this is the initial install, // and no notifications should be issued in that case. // TODO(joaodasilva): move this check to a ValueStore method. - if (!file_util::DirectoryExists(base_path_.AppendASCII(extension_id))) + if (!base::DirectoryExists(base_path_.AppendASCII(extension_id))) notify_if_changed = false; store = new PolicyValueStore( diff --git a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc index 92d8cca..3e3fe78 100644 --- a/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc +++ b/chrome/browser/extensions/api/webstore_private/webstore_private_apitest.cc @@ -198,7 +198,7 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebstorePrivateApiTest, InstallAccepted) { ASSERT_TRUE(RunInstallTest("accepted.html", "extension.crx")); // Cleanup. - if (file_util::DirectoryExists(missing_directory)) + if (base::DirectoryExists(missing_directory)) EXPECT_TRUE(base::Delete(missing_directory, true)); } diff --git a/chrome/browser/extensions/extension_creator.cc b/chrome/browser/extensions/extension_creator.cc index 975cd6d..0784fee 100644 --- a/chrome/browser/extensions/extension_creator.cc +++ b/chrome/browser/extensions/extension_creator.cc @@ -41,7 +41,7 @@ bool ExtensionCreator::InitializeInput( int run_flags) { // Validate input |extension_dir|. if (extension_dir.value().empty() || - !file_util::DirectoryExists(extension_dir)) { + !base::DirectoryExists(extension_dir)) { error_message_ = l10n_util::GetStringUTF8(IDS_EXTENSION_DIRECTORY_NO_EXISTS); return false; diff --git a/chrome/browser/extensions/extension_service_unittest.cc b/chrome/browser/extensions/extension_service_unittest.cc index 2541e0a..5121e67e 100644 --- a/chrome/browser/extensions/extension_service_unittest.cc +++ b/chrome/browser/extensions/extension_service_unittest.cc @@ -4072,7 +4072,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { base::MessageLoop::current()->message_loop_proxy().get()); base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); EXPECT_TRUE(file_util::CreateDirectory(idb_path)); - EXPECT_TRUE(file_util::DirectoryExists(idb_path)); + EXPECT_TRUE(base::DirectoryExists(idb_path)); // Uninstall the extension. service_->UninstallExtension(good_crx, false, NULL); @@ -4095,7 +4095,7 @@ TEST_F(ExtensionServiceTest, ClearExtensionData) { EXPECT_FALSE(base::PathExists(lso_file_path)); // Check if the indexed db has disappeared too. - EXPECT_FALSE(file_util::DirectoryExists(idb_path)); + EXPECT_FALSE(base::DirectoryExists(idb_path)); } // Verifies app state is removed upon uninstall. @@ -4189,7 +4189,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { base::MessageLoop::current()->message_loop_proxy().get()); base::FilePath idb_path = idb_context->GetFilePathForTesting(origin_id); EXPECT_TRUE(file_util::CreateDirectory(idb_path)); - EXPECT_TRUE(file_util::DirectoryExists(idb_path)); + EXPECT_TRUE(base::DirectoryExists(idb_path)); // Uninstall one of them, unlimited storage should still be granted // to the origin. @@ -4229,7 +4229,7 @@ TEST_F(ExtensionServiceTest, ClearAppData) { EXPECT_FALSE(base::PathExists(lso_file_path)); // Check if the indexed db has disappeared too. - EXPECT_FALSE(file_util::DirectoryExists(idb_path)); + EXPECT_FALSE(base::DirectoryExists(idb_path)); } // Tests loading single extensions (like --load-extension) diff --git a/chrome/browser/extensions/platform_app_launcher.cc b/chrome/browser/extensions/platform_app_launcher.cc index c6c862cb..66d1133 100644 --- a/chrome/browser/extensions/platform_app_launcher.cc +++ b/chrome/browser/extensions/platform_app_launcher.cc @@ -147,7 +147,7 @@ class PlatformAppPathLauncher // If the file doesn't exist, or is a directory, launch with no launch data. if (!base::PathExists(file_path_) || - file_util::DirectoryExists(file_path_)) { + base::DirectoryExists(file_path_)) { LOG(WARNING) << "No file exists with path " << file_path_.value(); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind( &PlatformAppPathLauncher::LaunchWithNoLaunchData, this)); diff --git a/chrome/browser/extensions/webstore_installer.cc b/chrome/browser/extensions/webstore_installer.cc index 2b14cf5..44b6450 100644 --- a/chrome/browser/extensions/webstore_installer.cc +++ b/chrome/browser/extensions/webstore_installer.cc @@ -88,7 +88,7 @@ void GetDownloadFilePath( // Ensure the download directory exists. TODO(asargent) - make this use // common code from the downloads system. - if (!file_util::DirectoryExists(directory)) { + if (!base::DirectoryExists(directory)) { if (!file_util::CreateDirectory(directory)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(callback, base::FilePath())); diff --git a/chrome/browser/google/google_update_settings_posix.cc b/chrome/browser/google/google_update_settings_posix.cc index c253421..4da917a 100644 --- a/chrome/browser/google/google_update_settings_posix.cc +++ b/chrome/browser/google/google_update_settings_posix.cc @@ -37,7 +37,7 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { base::FilePath consent_dir; PathService::Get(chrome::DIR_USER_DATA, &consent_dir); - if (!file_util::DirectoryExists(consent_dir)) + if (!base::DirectoryExists(consent_dir)) return false; base::FilePath consent_file = consent_dir.AppendASCII(kConsentToSendStats); @@ -60,7 +60,7 @@ bool GoogleUpdateSettings::SetMetricsId(const std::wstring& client_id) { // Make sure that user has consented to send crashes. base::FilePath consent_dir; PathService::Get(chrome::DIR_USER_DATA, &consent_dir); - if (!file_util::DirectoryExists(consent_dir) || + if (!base::DirectoryExists(consent_dir) || !GoogleUpdateSettings::GetCollectStatsConsent()) return false; diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 50a0d0c..7a5c26a 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -431,9 +431,9 @@ void Firefox3Importer::GetSearchEnginesXMLData( DCHECK(!locale_.empty()); base::FilePath locale_app_path = app_path.AppendASCII(locale_); base::FilePath default_locale_app_path = app_path.AppendASCII("en-US"); - if (file_util::DirectoryExists(locale_app_path)) + if (base::DirectoryExists(locale_app_path)) app_path = locale_app_path; - else if (file_util::DirectoryExists(default_locale_app_path)) + else if (base::DirectoryExists(default_locale_app_path)) app_path = default_locale_app_path; #endif diff --git a/chrome/browser/media_galleries/fileapi/picasa/picasa_finder.cc b/chrome/browser/media_galleries/fileapi/picasa/picasa_finder.cc index 6a0a657..400eef1 100644 --- a/chrome/browser/media_galleries/fileapi/picasa/picasa_finder.cc +++ b/chrome/browser/media_galleries/fileapi/picasa/picasa_finder.cc @@ -36,7 +36,7 @@ base::FilePath FindPicasaDatabaseOnFileThread() { path = path.AppendASCII("Google").AppendASCII("Picasa2").AppendASCII("db3"); // Verify actual existence - if (!file_util::DirectoryExists(path)) + if (!base::DirectoryExists(path)) path.clear(); return path; diff --git a/chrome/browser/page_cycler/page_cycler_unittest.cc b/chrome/browser/page_cycler/page_cycler_unittest.cc index eef3eb8..cbfc07e 100644 --- a/chrome/browser/page_cycler/page_cycler_unittest.cc +++ b/chrome/browser/page_cycler/page_cycler_unittest.cc @@ -29,7 +29,7 @@ using ::testing::Invoke; using content::RenderViewHost; using content::TestBrowserThread; using content::WebContentsObserver; -using file_util::ContentsEqual; +using base::ContentsEqual; using base::PathExists; namespace { diff --git a/chrome/browser/performance_monitor/database.cc b/chrome/browser/performance_monitor/database.cc index 36bc93c..c08c2b8 100644 --- a/chrome/browser/performance_monitor/database.cc +++ b/chrome/browser/performance_monitor/database.cc @@ -91,7 +91,7 @@ scoped_ptr<Database> Database::Create(base::FilePath path) { path = path.AppendASCII(kDbDir); } scoped_ptr<Database> database; - if (!file_util::DirectoryExists(path) && !file_util::CreateDirectory(path)) + if (!base::DirectoryExists(path) && !file_util::CreateDirectory(path)) return database.Pass(); database.reset(new Database(path)); diff --git a/chrome/browser/platform_util_linux.cc b/chrome/browser/platform_util_linux.cc index 9ac22d7..6f88b16 100644 --- a/chrome/browser/platform_util_linux.cc +++ b/chrome/browser/platform_util_linux.cc @@ -56,7 +56,7 @@ void XDGEmail(const std::string& email) { // show the folder. void ShowItemInFolderOnFileThread(const base::FilePath& full_path) { base::FilePath dir = full_path.DirName(); - if (!file_util::DirectoryExists(dir)) + if (!base::DirectoryExists(dir)) return; XDGOpen(dir.value()); diff --git a/chrome/browser/policy/cloud/resource_cache.cc b/chrome/browser/policy/cloud/resource_cache.cc index 2214a2e..82aea6d 100644 --- a/chrome/browser/policy/cloud/resource_cache.cc +++ b/chrome/browser/policy/cloud/resource_cache.cc @@ -154,7 +154,7 @@ bool ResourceCache::VerifyKeyPath(const std::string& key, return false; *path = cache_dir_.AppendASCII(encoded); return allow_create ? file_util::CreateDirectory(*path) : - file_util::DirectoryExists(*path); + base::DirectoryExists(*path); } bool ResourceCache::VerifyKeyPathAndGetSubkeyPath(const std::string& key, diff --git a/chrome/browser/prefs/chrome_pref_service_unittest.cc b/chrome/browser/prefs/chrome_pref_service_unittest.cc index 683ffa5..39d9786 100644 --- a/chrome/browser/prefs/chrome_pref_service_unittest.cc +++ b/chrome/browser/prefs/chrome_pref_service_unittest.cc @@ -138,7 +138,7 @@ TEST_F(ChromePrefServiceUserFilePrefsTest, PreserveEmptyValue) { base::FilePath golden_output_file = data_dir_.AppendASCII("write.golden.need_empty_value.json"); ASSERT_TRUE(base::PathExists(golden_output_file)); - EXPECT_TRUE(file_util::TextContentsEqual(golden_output_file, pref_file)); + EXPECT_TRUE(base::TextContentsEqual(golden_output_file, pref_file)); } class ChromePrefServiceWebKitPrefs : public ChromeRenderViewHostTestHarness { diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc index 9434b5a..94e4c47 100644 --- a/chrome/browser/profiles/profile_info_cache.cc +++ b/chrome/browser/profiles/profile_info_cache.cc @@ -122,7 +122,7 @@ void SaveBitmap(ImageData* data, // Make sure the destination directory exists. base::FilePath dir = image_path.DirName(); - if (!file_util::DirectoryExists(dir) && !file_util::CreateDirectory(dir)) { + if (!base::DirectoryExists(dir) && !file_util::CreateDirectory(dir)) { LOG(ERROR) << "Failed to create parent directory."; return; } diff --git a/chrome/browser/search_engines/template_url_fetcher_unittest.cc b/chrome/browser/search_engines/template_url_fetcher_unittest.cc index 5e8dffe..d97e662 100644 --- a/chrome/browser/search_engines/template_url_fetcher_unittest.cc +++ b/chrome/browser/search_engines/template_url_fetcher_unittest.cc @@ -146,7 +146,7 @@ void TemplateURLFetcherTest::StartDownload( ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &osdd_full_path)); osdd_full_path = osdd_full_path.AppendASCII(osdd_file_name); ASSERT_TRUE(base::PathExists(osdd_full_path)); - ASSERT_FALSE(file_util::DirectoryExists(osdd_full_path)); + ASSERT_FALSE(base::DirectoryExists(osdd_full_path)); } // Start the fetch. diff --git a/chrome/browser/storage_monitor/media_storage_util.cc b/chrome/browser/storage_monitor/media_storage_util.cc index 76d39f7..aef5b0b 100644 --- a/chrome/browser/storage_monitor/media_storage_util.cc +++ b/chrome/browser/storage_monitor/media_storage_util.cc @@ -103,11 +103,11 @@ bool MediaStorageUtil::HasDcim(const base::FilePath& mount_point) { DCHECK(!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); base::FilePath::StringType dcim_dir(kDCIMDirectoryName); - if (!file_util::DirectoryExists(mount_point.Append(dcim_dir))) { + if (!base::DirectoryExists(mount_point.Append(dcim_dir))) { // Check for lowercase 'dcim' as well. base::FilePath dcim_path_lower( mount_point.Append(StringToLowerASCII(dcim_dir))); - if (!file_util::DirectoryExists(dcim_path_lower)) + if (!base::DirectoryExists(dcim_path_lower)) return false; } return true; diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc index e1186a5..d53f7cc 100644 --- a/chrome/browser/sync/glue/sync_backend_host.cc +++ b/chrome/browser/sync/glue/sync_backend_host.cc @@ -1394,7 +1394,7 @@ void SyncBackendHost::Core::DoRetryConfiguration( void SyncBackendHost::Core::DeleteSyncDataFolder() { DCHECK_EQ(base::MessageLoop::current(), sync_loop_); - if (file_util::DirectoryExists(sync_data_folder_path_)) { + if (base::DirectoryExists(sync_data_folder_path_)) { if (!base::Delete(sync_data_folder_path_, true)) SLOG(DFATAL) << "Could not delete the Sync Data folder."; } diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc index c3e5e9b..450f2b4 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc @@ -90,7 +90,7 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const { bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread( const base::FilePath& path) { base::ThreadRestrictions::ScopedAllowIO allow_io; - return file_util::DirectoryExists(path); + return base::DirectoryExists(path); } } // namespace libgtk2ui diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h index 55f1c30..89db17c 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.h @@ -59,7 +59,7 @@ class SelectFileDialogImpl : public ui::SelectFileDialog { gfx::NativeWindow owning_window, void* params) = 0; - // Wrapper for file_util::DirectoryExists() that allow access on the UI + // Wrapper for base::DirectoryExists() that allow access on the UI // thread. Use this only in the file dialog functions, where it's ok // because the file dialog has to do many stats anyway. One more won't // hurt too badly and it's likely already cached. diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc index 6dca58f..aa0f1d8 100644 --- a/chrome/browser/ui/metro_pin_tab_helper_win.cc +++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc @@ -57,7 +57,7 @@ base::FilePath GetTileImagesDir() { return base::FilePath(); tile_images_dir = tile_images_dir.Append(L"TileImages"); - if (!file_util::DirectoryExists(tile_images_dir) && + if (!base::DirectoryExists(tile_images_dir) && !file_util::CreateDirectory(tile_images_dir)) return base::FilePath(); diff --git a/chrome/browser/user_style_sheet_watcher.cc b/chrome/browser/user_style_sheet_watcher.cc index ddf2ba6..2dd6414 100644 --- a/chrome/browser/user_style_sheet_watcher.cc +++ b/chrome/browser/user_style_sheet_watcher.cc @@ -104,7 +104,7 @@ void UserStyleSheetLoader::LoadStyleSheet( // We keep the user style sheet in a subdir so we can watch for changes // to the file. base::FilePath style_sheet_dir = style_sheet_file.DirName(); - if (!file_util::DirectoryExists(style_sheet_dir)) { + if (!base::DirectoryExists(style_sheet_dir)) { if (!file_util::CreateDirectory(style_sheet_dir)) return; } diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm index cda4da6..e731611 100644 --- a/chrome/browser/web_applications/web_app_mac.mm +++ b/chrome/browser/web_applications/web_app_mac.mm @@ -130,7 +130,7 @@ bool AddGfxImageToIconFamily(IconFamilyHandle icon_family, base::FilePath GetWritableApplicationsDirectory() { base::FilePath path; if (base::mac::GetLocalDirectory(NSApplicationDirectory, &path) && - file_util::PathIsWritable(path)) { + base::PathIsWritable(path)) { return path; } if (base::mac::GetUserDirectory(NSApplicationDirectory, &path)) @@ -384,7 +384,7 @@ size_t WebAppShortcutCreator::CreateShortcutsIn( bool WebAppShortcutCreator::CreateShortcuts() { base::FilePath dst_path = GetDestinationPath(); - if (dst_path.empty() || !file_util::DirectoryExists(dst_path.DirName())) { + if (dst_path.empty() || !base::DirectoryExists(dst_path.DirName())) { LOG(ERROR) << "Couldn't find an Applications directory to copy app to."; return false; } diff --git a/chrome/common/auto_start_linux.cc b/chrome/common/auto_start_linux.cc index 0033aae..b06c6f8 100644 --- a/chrome/common/auto_start_linux.cc +++ b/chrome/common/auto_start_linux.cc @@ -32,7 +32,7 @@ bool AutoStart::AddApplication(const std::string& autostart_filename, bool is_terminal_app) { scoped_ptr<base::Environment> environment(base::Environment::Create()); base::FilePath autostart_directory = GetAutostartDirectory(environment.get()); - if (!file_util::DirectoryExists(autostart_directory) && + if (!base::DirectoryExists(autostart_directory) && !file_util::CreateDirectory(autostart_directory)) { return false; } diff --git a/chrome/common/extensions/extension_file_util.cc b/chrome/common/extensions/extension_file_util.cc index 37137fd..24d23cb 100644 --- a/chrome/common/extensions/extension_file_util.cc +++ b/chrome/common/extensions/extension_file_util.cc @@ -329,7 +329,7 @@ void GarbageCollectExtensions( const base::FilePath& install_directory, const std::multimap<std::string, base::FilePath>& extension_paths) { // Nothing to clean up if it doesn't exist. - if (!file_util::DirectoryExists(install_directory)) + if (!base::DirectoryExists(install_directory)) return; DVLOG(1) << "Garbage collecting extensions..."; @@ -549,11 +549,11 @@ base::FilePath GetInstallTempDir(const base::FilePath& extensions_dir) { // install target. base::FilePath temp_path = extensions_dir.Append(kTempDirectoryName); if (base::PathExists(temp_path)) { - if (!file_util::DirectoryExists(temp_path)) { + if (!base::DirectoryExists(temp_path)) { DLOG(WARNING) << "Not a directory: " << temp_path.value(); return base::FilePath(); } - if (!file_util::PathIsWritable(temp_path)) { + if (!base::PathIsWritable(temp_path)) { DLOG(WARNING) << "Can't write to path: " << temp_path.value(); return base::FilePath(); } diff --git a/chrome/common/extensions/extension_file_util_unittest.cc b/chrome/common/extensions/extension_file_util_unittest.cc index ff90cf94..ad8b1e1 100644 --- a/chrome/common/extensions/extension_file_util_unittest.cc +++ b/chrome/common/extensions/extension_file_util_unittest.cc @@ -51,10 +51,10 @@ TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { ASSERT_EQ(version_1.value(), all_extensions.AppendASCII(extension_id).AppendASCII("1.0_0") .value()); - ASSERT_TRUE(file_util::DirectoryExists(version_1)); + ASSERT_TRUE(base::DirectoryExists(version_1)); // Should have moved the source. - ASSERT_FALSE(file_util::DirectoryExists(src)); + ASSERT_FALSE(base::DirectoryExists(src)); // Install again. Should create a new one with different name. ASSERT_TRUE(file_util::CreateDirectory(src)); @@ -66,10 +66,10 @@ TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { ASSERT_EQ(version_2.value(), all_extensions.AppendASCII(extension_id).AppendASCII("1.0_1") .value()); - ASSERT_TRUE(file_util::DirectoryExists(version_2)); + ASSERT_TRUE(base::DirectoryExists(version_2)); // Should have moved the source. - ASSERT_FALSE(file_util::DirectoryExists(src)); + ASSERT_FALSE(base::DirectoryExists(src)); // Install yet again. Should create a new one with a different name. ASSERT_TRUE(file_util::CreateDirectory(src)); @@ -81,7 +81,7 @@ TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { ASSERT_EQ(version_3.value(), all_extensions.AppendASCII(extension_id).AppendASCII("1.0_2") .value()); - ASSERT_TRUE(file_util::DirectoryExists(version_3)); + ASSERT_TRUE(base::DirectoryExists(version_3)); // Collect garbage. Should remove first one. std::multimap<std::string, base::FilePath> extension_paths; @@ -91,15 +91,15 @@ TEST_F(ExtensionFileUtilTest, InstallUninstallGarbageCollect) { base::FilePath().AppendASCII(extension_id).Append(version_3.BaseName()))); extension_file_util::GarbageCollectExtensions(all_extensions, extension_paths); - ASSERT_FALSE(file_util::DirectoryExists(version_1)); - ASSERT_TRUE(file_util::DirectoryExists(version_2)); - ASSERT_TRUE(file_util::DirectoryExists(version_3)); + ASSERT_FALSE(base::DirectoryExists(version_1)); + ASSERT_TRUE(base::DirectoryExists(version_2)); + ASSERT_TRUE(base::DirectoryExists(version_3)); // Uninstall. Should remove entire extension subtree. extension_file_util::UninstallExtension(all_extensions, extension_id); - ASSERT_FALSE(file_util::DirectoryExists(version_2.DirName())); - ASSERT_FALSE(file_util::DirectoryExists(version_3.DirName())); - ASSERT_TRUE(file_util::DirectoryExists(all_extensions)); + ASSERT_FALSE(base::DirectoryExists(version_2.DirName())); + ASSERT_FALSE(base::DirectoryExists(version_3.DirName())); + ASSERT_TRUE(base::DirectoryExists(all_extensions)); } TEST_F(ExtensionFileUtilTest, LoadExtensionWithValidLocales) { diff --git a/chrome/common/mac/app_mode_chrome_locator_unittest.mm b/chrome/common/mac/app_mode_chrome_locator_unittest.mm index f3c7e4d..950da7e 100644 --- a/chrome/common/mac/app_mode_chrome_locator_unittest.mm +++ b/chrome/common/mac/app_mode_chrome_locator_unittest.mm @@ -31,7 +31,7 @@ TEST(ChromeLocatorTest, FindBundle) { base::FilePath finder_bundle_path; EXPECT_TRUE( app_mode::FindBundleById(@"com.apple.finder", &finder_bundle_path)); - EXPECT_TRUE(file_util::DirectoryExists(finder_bundle_path)); + EXPECT_TRUE(base::DirectoryExists(finder_bundle_path)); } TEST(ChromeLocatorTest, FindNonExistentBundle) { @@ -55,7 +55,7 @@ TEST(ChromeLocatorTest, GetChromeBundleInfo) { base::FilePath chrome_bundle_path; GetChromeBundlePath(&chrome_bundle_path); - ASSERT_TRUE(file_util::DirectoryExists(chrome_bundle_path)); + ASSERT_TRUE(base::DirectoryExists(chrome_bundle_path)); string16 raw_version; base::FilePath version_path; @@ -63,6 +63,6 @@ TEST(ChromeLocatorTest, GetChromeBundleInfo) { EXPECT_TRUE(GetChromeBundleInfo(chrome_bundle_path, &raw_version, &version_path, &framework_path)); EXPECT_GT(raw_version.size(), 0U); - EXPECT_TRUE(file_util::DirectoryExists(version_path)); + EXPECT_TRUE(base::DirectoryExists(version_path)); EXPECT_TRUE(base::PathExists(framework_path)); } diff --git a/chrome/installer/setup/setup_util_unittest.cc b/chrome/installer/setup/setup_util_unittest.cc index 5cc08b1..ec78c5c 100644 --- a/chrome/installer/setup/setup_util_unittest.cc +++ b/chrome/installer/setup/setup_util_unittest.cc @@ -107,7 +107,7 @@ TEST_F(SetupUtilTestWithDir, ApplyDiffPatchTest) { base::FilePath dest = work_dir.AppendASCII("archive2.7z"); EXPECT_EQ(installer::ApplyDiffPatch(src, patch, dest, NULL), 0); base::FilePath base = data_dir_.AppendASCII("archive2.7z"); - EXPECT_TRUE(file_util::ContentsEqual(dest, base)); + EXPECT_TRUE(base::ContentsEqual(dest, base)); EXPECT_EQ(installer::ApplyDiffPatch(base::FilePath(), base::FilePath(), base::FilePath(), NULL), diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 2b7610f..a7e7f6a 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -64,7 +64,7 @@ namespace { void DeleteInstallTempDir(const base::FilePath& target_path) { base::FilePath temp_path(target_path.DirName().Append( installer::kInstallTempDir)); - if (file_util::DirectoryExists(temp_path)) { + if (base::DirectoryExists(temp_path)) { installer::SelfCleaningTempDir temp_dir; if (!temp_dir.Initialize(target_path.DirName(), installer::kInstallTempDir) || diff --git a/chrome/installer/util/copy_tree_work_item.cc b/chrome/installer/util/copy_tree_work_item.cc index 6f44e59..0e847b1 100644 --- a/chrome/installer/util/copy_tree_work_item.cc +++ b/chrome/installer/util/copy_tree_work_item.cc @@ -38,17 +38,17 @@ bool CopyTreeWorkItem::Do() { // handle overwrite_option_ = IF_DIFFERENT case. if ((dest_exist) && (overwrite_option_ == WorkItem::IF_DIFFERENT) && // only for single file - (!file_util::DirectoryExists(source_path_)) && - (!file_util::DirectoryExists(dest_path_)) && - (file_util::ContentsEqual(source_path_, dest_path_))) { + (!base::DirectoryExists(source_path_)) && + (!base::DirectoryExists(dest_path_)) && + (base::ContentsEqual(source_path_, dest_path_))) { VLOG(1) << "Source file " << source_path_.value() << " and destination file " << dest_path_.value() << " are exactly same. Returning true."; return true; } else if ((dest_exist) && (overwrite_option_ == WorkItem::NEW_NAME_IF_IN_USE) && - (!file_util::DirectoryExists(source_path_)) && - (!file_util::DirectoryExists(dest_path_)) && + (!base::DirectoryExists(source_path_)) && + (!base::DirectoryExists(dest_path_)) && (IsFileInUse(dest_path_))) { // handle overwrite_option_ = NEW_NAME_IF_IN_USE case. if (alternative_path_.empty() || diff --git a/chrome/installer/util/copy_tree_work_item_unittest.cc b/chrome/installer/util/copy_tree_work_item_unittest.cc index 981e54e..c98e1f3 100644 --- a/chrome/installer/util/copy_tree_work_item_unittest.cc +++ b/chrome/installer/util/copy_tree_work_item_unittest.cc @@ -103,7 +103,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFile) { 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)); + EXPECT_TRUE(base::ContentsEqual(file_name_from, file_name_to)); // test rollback() work_item->Rollback(); @@ -372,7 +372,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. EXPECT_TRUE(base::PathExists(backup_file)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, backup_file)); // test rollback() work_item->Rollback(); @@ -380,7 +380,7 @@ TEST_F(CopyTreeWorkItemTest, CopyFileInUse) { 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(base::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback EXPECT_FALSE(base::PathExists(backup_file)); @@ -444,10 +444,10 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { 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(base::ContentsEqual(exe_full_path, file_name_to)); // verify that the backup path does not exist EXPECT_TRUE(work_item->backup_path_.path().empty()); - EXPECT_TRUE(file_util::ContentsEqual(file_name_from, alternate_to)); + EXPECT_TRUE(base::ContentsEqual(file_name_from, alternate_to)); // test rollback() work_item->Rollback(); @@ -455,7 +455,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { 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(base::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(base::PathExists(alternate_to)); @@ -485,7 +485,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { 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)); + EXPECT_TRUE(base::ContentsEqual(file_name_from, file_name_to)); // verify that the backup path does exist EXPECT_TRUE(base::PathExists(backup_file)); EXPECT_FALSE(base::PathExists(alternate_to)); @@ -496,7 +496,7 @@ TEST_F(CopyTreeWorkItemTest, NewNameAndCopyTest) { 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(base::ContentsEqual(exe_full_path, file_name_to)); // the backup file should be gone after rollback EXPECT_FALSE(base::PathExists(backup_file)); EXPECT_FALSE(base::PathExists(alternate_to)); @@ -547,7 +547,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { 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(base::ContentsEqual(exe_full_path, file_name_to)); EXPECT_FALSE(base::PathExists(backup_file)); // test rollback() @@ -558,7 +558,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_IfNotPresentTest) { 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(base::ContentsEqual(exe_full_path, file_name_to)); EXPECT_FALSE(base::PathExists(backup_file)); // Now delete the destination and try copying the file again. @@ -647,12 +647,12 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyFileInUseAndCleanup) { EXPECT_EQ(0, ReadTextFile(file_name_to.value()).compare(text_content_1)); // verify the file in used is moved to backup place. EXPECT_TRUE(base::PathExists(backup_file)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, backup_file)); } // verify the file in used should be still at the backup place. EXPECT_TRUE(base::PathExists(backup_file)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, backup_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, backup_file)); TerminateProcess(pi.hProcess, 0); // make sure the handle is closed. @@ -711,7 +711,7 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { 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)); + EXPECT_TRUE(base::ContentsEqual(file_name_from_1, file_name_to_1)); base::FilePath file_name_to_2(dir_name_to); file_name_to_2 = file_name_to_2.AppendASCII("2"); @@ -719,5 +719,5 @@ TEST_F(CopyTreeWorkItemTest, DISABLED_CopyTree) { 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)); + EXPECT_TRUE(base::ContentsEqual(file_name_from_2, file_name_to_2)); } diff --git a/chrome/installer/util/delete_after_reboot_helper.cc b/chrome/installer/util/delete_after_reboot_helper.cc index f86405c..5131b1d 100644 --- a/chrome/installer/util/delete_after_reboot_helper.cc +++ b/chrome/installer/util/delete_after_reboot_helper.cc @@ -63,7 +63,7 @@ bool ScheduleFileSystemEntityForDeletion(const wchar_t* path) { } DWORD flags = MOVEFILE_DELAY_UNTIL_REBOOT; - if (!file_util::DirectoryExists(base::FilePath::FromWStringHack(path))) { + if (!base::DirectoryExists(base::FilePath::FromWStringHack(path))) { // This flag valid only for files flags |= MOVEFILE_REPLACE_EXISTING; } diff --git a/chrome/installer/util/move_tree_work_item_unittest.cc b/chrome/installer/util/move_tree_work_item_unittest.cc index 3402787..c00a44d 100644 --- a/chrome/installer/util/move_tree_work_item_unittest.cc +++ b/chrome/installer/util/move_tree_work_item_unittest.cc @@ -308,7 +308,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileDestInUse) { EXPECT_TRUE(base::PathExists(from_dir)); EXPECT_EQ(0, ReadTextFile(from_file).compare(kTextContent1)); EXPECT_TRUE(base::PathExists(to_dir)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, to_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); TerminateProcess(pi.hProcess, 0); EXPECT_TRUE(WaitForSingleObject(pi.hProcess, 10000) == WAIT_OBJECT_0); @@ -363,7 +363,7 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { 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)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); // Close the process and make sure all the conditions after Do() are // still true. @@ -375,13 +375,13 @@ TEST_F(MoveTreeWorkItemTest, MoveFileInUse) { 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)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, to_file)); // test rollback() work_item->Rollback(); EXPECT_TRUE(base::PathExists(from_dir)); - EXPECT_TRUE(file_util::ContentsEqual(exe_full_path, from_file)); + EXPECT_TRUE(base::ContentsEqual(exe_full_path, from_file)); EXPECT_TRUE(base::PathExists(to_dir)); EXPECT_EQ(0, ReadTextFile(to_file).compare(kTextContent1)); } diff --git a/chrome/installer/util/self_cleaning_temp_dir.cc b/chrome/installer/util/self_cleaning_temp_dir.cc index 8b85926..8fddbb9 100644 --- a/chrome/installer/util/self_cleaning_temp_dir.cc +++ b/chrome/installer/util/self_cleaning_temp_dir.cc @@ -30,7 +30,7 @@ void SelfCleaningTempDir::GetTopDirToCreate( *base_dir = parent_dir; parent_dir = parent_dir.DirName(); } while (parent_dir != *base_dir && !base::PathExists(parent_dir)); - LOG_IF(WARNING, !file_util::DirectoryExists(parent_dir)) + LOG_IF(WARNING, !base::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/self_cleaning_temp_dir_unittest.cc b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc index c941619..a752f17 100644 --- a/chrome/installer/util/self_cleaning_temp_dir_unittest.cc +++ b/chrome/installer/util/self_cleaning_temp_dir_unittest.cc @@ -74,14 +74,14 @@ TEST_F(SelfCleaningTempDirTest, RemoveUnusedOnDelete) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); EXPECT_TRUE(temp_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that two clients can work in the same area. @@ -101,23 +101,23 @@ TEST_F(SelfCleaningTempDirTest, TwoClients) { // Both clients are where they are expected. EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir1.path()); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir2.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir1.path())); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir2.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir1.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir2.path())); // Second client goes away. EXPECT_TRUE(temp_dir2.Delete()); // The first is now useless. - EXPECT_FALSE(file_util::DirectoryExists(temp_dir1.path())); + EXPECT_FALSE(base::DirectoryExists(temp_dir1.path())); // But the intermediate dirs are still present - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir)); // Now the first goes away. EXPECT_TRUE(temp_dir1.Delete()); // And cleans up after itself. - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that all intermediate dirs are cleaned up if they're empty when the @@ -133,14 +133,14 @@ TEST_F(SelfCleaningTempDirTest, RemoveUnusedOnDestroy) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); } - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir)); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName())); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName())); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } // Test that intermediate dirs are left behind if they're not empty when the @@ -158,16 +158,16 @@ TEST_F(SelfCleaningTempDirTest, LeaveUsedOnDestroy) { SelfCleaningTempDir temp_dir; EXPECT_TRUE(temp_dir.Initialize(parent_temp_dir, L"Three")); EXPECT_EQ(parent_temp_dir.Append(L"Three"), temp_dir.path()); - EXPECT_TRUE(file_util::DirectoryExists(temp_dir.path())); + EXPECT_TRUE(base::DirectoryExists(temp_dir.path())); // Drop a file somewhere. EXPECT_EQ(arraysize(kHiHon) - 1, file_util::WriteFile(parent_temp_dir.Append(GetRandomFilename()), kHiHon, arraysize(kHiHon) - 1)); } - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.Append(L"Three"))); - EXPECT_TRUE(file_util::DirectoryExists(parent_temp_dir)); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.Append(L"Three"))); + EXPECT_TRUE(base::DirectoryExists(parent_temp_dir)); EXPECT_TRUE(work_dir.Delete()); - EXPECT_FALSE(file_util::DirectoryExists(parent_temp_dir.DirName().DirName())); + EXPECT_FALSE(base::DirectoryExists(parent_temp_dir.DirName().DirName())); } } // namespace installer diff --git a/chrome/installer/util/shell_util.cc b/chrome/installer/util/shell_util.cc index c7da3e7..1c2a0b1 100644 --- a/chrome/installer/util/shell_util.cc +++ b/chrome/installer/util/shell_util.cc @@ -1177,7 +1177,7 @@ bool GetAppShortcutsFolder(BrowserDistribution* dist, folder = folder.Append( ShellUtil::GetBrowserModelId(dist, level == ShellUtil::CURRENT_USER)); - if (!file_util::DirectoryExists(folder)) { + if (!base::DirectoryExists(folder)) { VLOG(1) << "No start screen shortcuts."; return false; } diff --git a/chrome/test/chromedriver/chrome/zip.cc b/chrome/test/chromedriver/chrome/zip.cc index 75ea8d4d..16924e3 100644 --- a/chrome/test/chromedriver/chrome/zip.cc +++ b/chrome/test/chromedriver/chrome/zip.cc @@ -57,7 +57,7 @@ bool AddEntryToZip(zipFile zip_file, const base::FilePath& path, ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/"); #endif - bool is_directory = file_util::DirectoryExists(path); + bool is_directory = base::DirectoryExists(path); if (is_directory) str_path += "/"; @@ -127,7 +127,7 @@ bool Unzip(const base::FilePath& src_file, const base::FilePath& dest_dir) { bool ZipWithFilterCallback(const base::FilePath& src_dir, const base::FilePath& dest_file, const FilterCallback& filter_cb) { - DCHECK(file_util::DirectoryExists(src_dir)); + DCHECK(base::DirectoryExists(src_dir)); zipFile zip_file = internal::OpenForZipping(dest_file.AsUTF8Unsafe(), APPEND_STATUS_CREATE); @@ -175,7 +175,7 @@ bool Zip(const base::FilePath& src_dir, const base::FilePath& dest_file, bool ZipFiles(const base::FilePath& src_dir, const std::vector<base::FilePath>& src_relative_paths, int dest_fd) { - DCHECK(file_util::DirectoryExists(src_dir)); + DCHECK(base::DirectoryExists(src_dir)); zipFile zip_file = internal::OpenFdForZipping(dest_fd, APPEND_STATUS_CREATE); if (!zip_file) { diff --git a/chrome/test/perf/frame_rate/frame_rate_tests.cc b/chrome/test/perf/frame_rate/frame_rate_tests.cc index bc3326a..a9dc43c 100644 --- a/chrome/test/perf/frame_rate/frame_rate_tests.cc +++ b/chrome/test/perf/frame_rate/frame_rate_tests.cc @@ -162,7 +162,7 @@ class FrameRateTest ASSERT_TRUE(!HasFlag(kUseGpu) || IsGpuAvailable()); base::FilePath test_path = GetDataPath(name); - ASSERT_TRUE(file_util::DirectoryExists(test_path)) + ASSERT_TRUE(base::DirectoryExists(test_path)) << "Missing test directory: " << test_path.value(); test_path = test_path.Append(FILE_PATH_LITERAL("test.html")); diff --git a/chrome_frame/simple_resource_loader.cc b/chrome_frame/simple_resource_loader.cc index 3d4426a..e6d5c6c 100644 --- a/chrome_frame/simple_resource_loader.cc +++ b/chrome_frame/simple_resource_loader.cc @@ -148,7 +148,7 @@ void SimpleResourceLoader::DetermineLocalesDirectory( // We may be residing in the "locales" directory's parent, or we might be // in a sibling directory. Move up one and look for Locales again in the // latter case. - if (!file_util::DirectoryExists(*locales_path)) { + if (!base::DirectoryExists(*locales_path)) { *locales_path = module_path.DirName(); *locales_path = locales_path->Append(kLocalesDirName); } @@ -225,7 +225,7 @@ bool SimpleResourceLoader::LoadLocalePack( } } } - DCHECK(found_pack || file_util::DirectoryExists(locales_path)) + DCHECK(found_pack || base::DirectoryExists(locales_path)) << "Could not locate locales DLL directory."; return found_pack; } diff --git a/chrome_frame/test/test_with_web_server.cc b/chrome_frame/test/test_with_web_server.cc index 9c93a377..06869ad 100644 --- a/chrome_frame/test/test_with_web_server.cc +++ b/chrome_frame/test/test_with_web_server.cc @@ -400,7 +400,7 @@ void MockWebServer::SendResponseHelper( std::string headers, body; std::string content_type; if (base::PathExists(file_path) && - !file_util::DirectoryExists(file_path)) { + !base::DirectoryExists(file_path)) { base::FilePath mock_http_headers(file_path.value() + L".mock-http-headers"); if (base::PathExists(mock_http_headers)) { headers = GetMockHttpHeaders(mock_http_headers); diff --git a/cloud_print/virtual_driver/win/install/setup.cc b/cloud_print/virtual_driver/win/install/setup.cc index e5a249e..510370f 100644 --- a/cloud_print/virtual_driver/win/install/setup.cc +++ b/cloud_print/virtual_driver/win/install/setup.cc @@ -391,7 +391,7 @@ bool IsOSSupported() { HRESULT RegisterVirtualDriver(const base::FilePath& install_path) { HRESULT result = S_OK; - DCHECK(file_util::DirectoryExists(install_path)); + DCHECK(base::DirectoryExists(install_path)); if (!IsOSSupported()) { LOG(ERROR) << "Requires XP SP3 or later."; return HRESULT_FROM_WIN32(ERROR_OLD_WIN_VERSION); @@ -477,7 +477,7 @@ HRESULT DoRegister(const base::FilePath& install_path) { HRESULT DoDelete(const base::FilePath& install_path) { if (install_path.value().empty()) return E_INVALIDARG; - if (!file_util::DirectoryExists(install_path)) + if (!base::DirectoryExists(install_path)) return S_FALSE; Sleep(5000); // Give parent some time to exit. return base::Delete(install_path, true) ? S_OK : E_FAIL; @@ -492,7 +492,7 @@ HRESULT DoInstall(const base::FilePath& install_path) { base::FilePath old_install_path = GetInstallLocation(kUninstallId); if (!old_install_path.value().empty() && install_path != old_install_path) { - if (file_util::DirectoryExists(old_install_path)) + if (base::DirectoryExists(old_install_path)) base::Delete(old_install_path, true); } CreateUninstallKey(kUninstallId, LoadLocalString(IDS_DRIVER_NAME), @@ -509,7 +509,7 @@ HRESULT ExecuteCommands() { base::FilePath exe_path; if (FAILED(PathService::Get(base::DIR_EXE, &exe_path)) || - !file_util::DirectoryExists(exe_path)) { + !base::DirectoryExists(exe_path)) { return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); } 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 ad43c8f..ab235e6 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -310,7 +310,7 @@ base::FilePath GetChromeExePath() { base::FilePath GetChromeProfilePath() { base::FilePath path = ReadPathFromAnyRegistry(kChromeProfilePathRegValue); - if (!path.empty() && file_util::DirectoryExists(path)) + if (!path.empty() && base::DirectoryExists(path)) return path; return base::FilePath(); } 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 4849842..cce0327 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 @@ -113,7 +113,7 @@ TEST_F(PortMonitorTest, GetChromeProfilePathTest) { base::FilePath temp; PathService::Get(base::DIR_TEMP, &temp); EXPECT_EQ(data_path, temp); - EXPECT_TRUE(file_util::DirectoryExists(data_path)); + EXPECT_TRUE(base::DirectoryExists(data_path)); DeleteChromeExeRegistry(); data_path = cloud_print::GetChromeProfilePath(); EXPECT_TRUE(data_path.empty()); diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index c56cf88..ef9cb15 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -775,7 +775,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, MultiDownload) { ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); base::FilePath file2(download2->GetTargetFilePath()); - ASSERT_TRUE(file_util::ContentsEqual( + ASSERT_TRUE(base::ContentsEqual( file2, GetTestFilePath("download", "download-test.lib"))); } diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index 67a629d..07c7558 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -61,7 +61,7 @@ void DeleteDownloadedFile(const base::FilePath& path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); // Make sure we only delete files. - if (!file_util::DirectoryExists(path)) + if (!base::DirectoryExists(path)) base::Delete(path, false); } diff --git a/content/browser/download/file_metadata_linux.cc b/content/browser/download/file_metadata_linux.cc index 894acb8..c06d3f1 100644 --- a/content/browser/download/file_metadata_linux.cc +++ b/content/browser/download/file_metadata_linux.cc @@ -29,7 +29,7 @@ static void SetExtendedFileAttribute(const char* path, const char* name, void AddOriginMetadataToFile(const base::FilePath& file, const GURL& source, const GURL& referrer) { - DCHECK(file_util::PathIsWritable(file)); + DCHECK(base::PathIsWritable(file)); if (source.is_valid()) { SetExtendedFileAttribute(file.value().c_str(), kSourceURLAttrName, source.spec().c_str(), source.spec().length(), 0); diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index cc42005..ad4330f 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -1346,9 +1346,9 @@ void SavePackage::CreateDirectoryOnFileThread( base::FilePath save_dir; // If the default html/websites save folder doesn't exist... // We skip the directory check for gdata directories on ChromeOS. - if (!skip_dir_check && !file_util::DirectoryExists(website_save_dir)) { + if (!skip_dir_check && !base::DirectoryExists(website_save_dir)) { // If the default download dir doesn't exist, create it. - if (!file_util::DirectoryExists(download_save_dir)) { + if (!base::DirectoryExists(download_save_dir)) { bool res = file_util::CreateDirectory(download_save_dir); DCHECK(res); } diff --git a/content/browser/gpu/webgl_conformance_test.cc b/content/browser/gpu/webgl_conformance_test.cc index 70ffd94..c58653c 100644 --- a/content/browser/gpu/webgl_conformance_test.cc +++ b/content/browser/gpu/webgl_conformance_test.cc @@ -40,7 +40,7 @@ class WebGLConformanceTest : public ContentBrowserTest { FILE_PATH_LITERAL("third_party")); webgl_conformance_path = webgl_conformance_path.Append( FILE_PATH_LITERAL("webgl_conformance")); - ASSERT_TRUE(file_util::DirectoryExists(webgl_conformance_path)) + ASSERT_TRUE(base::DirectoryExists(webgl_conformance_path)) << "Missing conformance tests: " << webgl_conformance_path.value(); PathService::Get(DIR_TEST_DATA, &test_path_); diff --git a/content/browser/indexed_db/indexed_db_unittest.cc b/content/browser/indexed_db/indexed_db_unittest.cc index a45f544..c9aec29 100644 --- a/content/browser/indexed_db/indexed_db_unittest.cc +++ b/content/browser/indexed_db/indexed_db_unittest.cc @@ -74,8 +74,8 @@ TEST_F(IndexedDBTest, ClearSessionOnlyDatabases) { FlushIndexedDBTaskRunner(); message_loop_.RunUntilIdle(); - EXPECT_TRUE(file_util::DirectoryExists(normal_path)); - EXPECT_FALSE(file_util::DirectoryExists(session_only_path)); + EXPECT_TRUE(base::DirectoryExists(normal_path)); + EXPECT_FALSE(base::DirectoryExists(session_only_path)); } TEST_F(IndexedDBTest, SetForceKeepSessionState) { @@ -108,8 +108,8 @@ TEST_F(IndexedDBTest, SetForceKeepSessionState) { message_loop_.RunUntilIdle(); // No data was cleared because of SetForceKeepSessionState. - EXPECT_TRUE(file_util::DirectoryExists(normal_path)); - EXPECT_TRUE(file_util::DirectoryExists(session_only_path)); + EXPECT_TRUE(base::DirectoryExists(normal_path)); + EXPECT_TRUE(base::DirectoryExists(session_only_path)); } class MockConnection : public IndexedDBConnection { @@ -187,7 +187,7 @@ TEST_F(IndexedDBTest, ForceCloseOpenDatabasesOnDelete) { // Make sure we wait until the destructor has run. message_loop_.RunUntilIdle(); - EXPECT_FALSE(file_util::DirectoryExists(test_path)); + EXPECT_FALSE(base::DirectoryExists(test_path)); } } // namespace content diff --git a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc index 20af748..9dffec4 100644 --- a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc @@ -245,7 +245,7 @@ int32_t PepperFlashFileMessageFilter::OnCreateTemporaryFile( base::FilePath validated_dir_path = ValidateAndConvertPepperFilePath( dir_path, kReadPermissions | kWritePermissions); if (validated_dir_path.empty() || - (!file_util::DirectoryExists(validated_dir_path) && + (!base::DirectoryExists(validated_dir_path) && !file_util::CreateDirectory(validated_dir_path))) { return ppapi::PlatformFileErrorToPepperError( base::PLATFORM_FILE_ERROR_ACCESS_DENIED); diff --git a/content/renderer/gpu/gpu_benchmarking_extension.cc b/content/renderer/gpu/gpu_benchmarking_extension.cc index fbae5da..43d557d 100644 --- a/content/renderer/gpu/gpu_benchmarking_extension.cc +++ b/content/renderer/gpu/gpu_benchmarking_extension.cc @@ -348,7 +348,7 @@ class GpuBenchmarkingWrapper : public v8::Extension { base::FilePath dirpath( base::FilePath::StringType(*dirname, *dirname + dirname.length())); if (!file_util::CreateDirectory(dirpath) || - !file_util::PathIsWritable(dirpath)) { + !base::PathIsWritable(dirpath)) { std::string msg("Path is not writable: "); msg.append(dirpath.MaybeAsASCII()); v8::ThrowException(v8::Exception::Error( diff --git a/gpu/tools/compositor_model_bench/compositor_model_bench.cc b/gpu/tools/compositor_model_bench/compositor_model_bench.cc index f6bbb83..3e7318d 100644 --- a/gpu/tools/compositor_model_bench/compositor_model_bench.cc +++ b/gpu/tools/compositor_model_bench/compositor_model_bench.cc @@ -39,7 +39,7 @@ using base::TimeTicks; using file_util::CloseFile; -using file_util::DirectoryExists; +using base::DirectoryExists; using file_util::OpenFile; using base::PathExists; using std::queue; diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc index 2f7e473..e155906 100644 --- a/net/base/directory_lister.cc +++ b/net/base/directory_lister.cc @@ -143,7 +143,7 @@ void DirectoryLister::Core::Cancel() { void DirectoryLister::Core::StartInternal() { - if (!file_util::DirectoryExists(dir_)) { + if (!base::DirectoryExists(dir_)) { origin_loop_->PostTask( FROM_HERE, base::Bind(&DirectoryLister::Core::OnDone, this, ERR_FILE_NOT_FOUND)); diff --git a/net/disk_cache/simple/simple_backend_impl.cc b/net/disk_cache/simple/simple_backend_impl.cc index 1302054..6c68e66 100644 --- a/net/disk_cache/simple/simple_backend_impl.cc +++ b/net/disk_cache/simple/simple_backend_impl.cc @@ -33,7 +33,7 @@ using base::MessageLoopProxy; using base::SequencedWorkerPool; using base::SingleThreadTaskRunner; using base::Time; -using file_util::DirectoryExists; +using base::DirectoryExists; using file_util::CreateDirectory; namespace { diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc index ba4b8e6..9029e01 100644 --- a/net/proxy/proxy_config_service_linux.cc +++ b/net/proxy/proxy_config_service_linux.cc @@ -883,7 +883,7 @@ class SettingGetterImplKDE : public ProxyConfigServiceLinux::SettingGetter, base::FilePath kde4_path = base::FilePath(home).Append(".kde4"); base::FilePath kde4_config = KDEHomeToConfigPath(kde4_path); bool use_kde4 = false; - if (file_util::DirectoryExists(kde4_path)) { + if (base::DirectoryExists(kde4_path)) { base::PlatformFileInfo kde3_info; base::PlatformFileInfo kde4_info; if (file_util::GetFileInfo(kde4_config, &kde4_info)) { diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc index 53419ab..b024e08 100644 --- a/net/proxy/proxy_config_service_linux_unittest.cc +++ b/net/proxy/proxy_config_service_linux_unittest.cc @@ -1530,7 +1530,7 @@ TEST_F(ProxyConfigServiceLinuxTest, KDEHomePicker) { // If .kde4 exists it will mess up the first test. It should not, as // we created the directory for $HOME in the test setup. - CHECK(!file_util::DirectoryExists(kde4_home_)); + CHECK(!base::DirectoryExists(kde4_home_)); { SCOPED_TRACE("KDE4, no .kde4 directory, verify fallback"); MockEnvironment* env = new MockEnvironment; diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc index 209b50a..30c5f67 100644 --- a/net/test/python_utils.cc +++ b/net/test/python_utils.cc @@ -48,7 +48,7 @@ bool TryRelativeToDir(const base::FilePath& start_dir, const base::FilePath& to_try, base::FilePath* out_dir) { base::FilePath dir(start_dir); - while (!file_util::DirectoryExists(dir.Append(to_try))) { + while (!base::DirectoryExists(dir.Append(to_try))) { base::FilePath parent = dir.DirName(); if (parent == dir) { // We hit the root directory. diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index 59b75f1..408dbf6 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -111,7 +111,7 @@ int main(int argc, const char* argv[]) { return -1; } - if (!file_util::DirectoryExists(test_server->document_root())) { + if (!base::DirectoryExists(test_server->document_root())) { printf("Error: invalid doc root: \"%s\" does not exist!\n", UTF16ToUTF8(test_server->document_root().LossyDisplayName()).c_str()); return -1; diff --git a/net/url_request/url_fetcher_impl_unittest.cc b/net/url_request/url_fetcher_impl_unittest.cc index 1a70ed4..7cc1674 100644 --- a/net/url_request/url_fetcher_impl_unittest.cc +++ b/net/url_request/url_fetcher_impl_unittest.cc @@ -876,7 +876,7 @@ void URLFetcherFileTest::OnURLFetchComplete(const URLFetcher* source) { EXPECT_TRUE(source->GetResponseAsFilePath( take_ownership_of_file_, &file_path_)); - EXPECT_TRUE(file_util::ContentsEqual(expected_file_, file_path_)); + EXPECT_TRUE(base::ContentsEqual(expected_file_, file_path_)); } else { int error_code = OK; EXPECT_TRUE(fetcher_->FileErrorOccurred(&error_code)); @@ -1439,7 +1439,7 @@ TEST_F(URLFetcherFileTest, OverwriteExistingFile) { file_util::WriteFile(file_path_, data.data(), data.size())); ASSERT_TRUE(base::PathExists(file_path_)); expected_file_ = test_server.GetDocumentRoot().AppendASCII(kFileToFetch); - ASSERT_FALSE(file_util::ContentsEqual(file_path_, expected_file_)); + ASSERT_FALSE(base::ContentsEqual(file_path_, expected_file_)); // Get a small file. CreateFetcherForFile( diff --git a/remoting/host/setup/daemon_controller_linux.cc b/remoting/host/setup/daemon_controller_linux.cc index c0a5f03..c36c63b 100644 --- a/remoting/host/setup/daemon_controller_linux.cc +++ b/remoting/host/setup/daemon_controller_linux.cc @@ -255,7 +255,7 @@ void DaemonControllerLinux::DoSetConfigAndStart( // Ensure the configuration directory exists. base::FilePath config_dir = GetConfigPath().DirName(); - if (!file_util::DirectoryExists(config_dir) && + if (!base::DirectoryExists(config_dir) && !file_util::CreateDirectory(config_dir)) { LOG(ERROR) << "Failed to create config directory " << config_dir.value(); done_callback.Run(RESULT_FAILED); diff --git a/third_party/leveldatabase/env_chromium.cc b/third_party/leveldatabase/env_chromium.cc index a9efd99..652d56d 100644 --- a/third_party/leveldatabase/env_chromium.cc +++ b/third_party/leveldatabase/env_chromium.cc @@ -709,7 +709,7 @@ Status ChromiumEnv::LockFile(const std::string& fname, FileLock** lock) { ::base::FilePath last_parent; int num_missing_ancestors = 0; do { - if (file_util::DirectoryExists(parent)) + if (base::DirectoryExists(parent)) break; ++num_missing_ancestors; last_parent = parent; diff --git a/third_party/zlib/google/zip.cc b/third_party/zlib/google/zip.cc index 9e2de0d..64aead1 100644 --- a/third_party/zlib/google/zip.cc +++ b/third_party/zlib/google/zip.cc @@ -57,7 +57,7 @@ bool AddEntryToZip(zipFile zip_file, const base::FilePath& path, ReplaceSubstringsAfterOffset(&str_path, 0u, "\\", "/"); #endif - bool is_directory = file_util::DirectoryExists(path); + bool is_directory = base::DirectoryExists(path); if (is_directory) str_path += "/"; @@ -127,7 +127,7 @@ bool Unzip(const base::FilePath& src_file, const base::FilePath& dest_dir) { bool ZipWithFilterCallback(const base::FilePath& src_dir, const base::FilePath& dest_file, const FilterCallback& filter_cb) { - DCHECK(file_util::DirectoryExists(src_dir)); + DCHECK(base::DirectoryExists(src_dir)); zipFile zip_file = internal::OpenForZipping(dest_file.AsUTF8Unsafe(), APPEND_STATUS_CREATE); @@ -175,7 +175,7 @@ bool Zip(const base::FilePath& src_dir, const base::FilePath& dest_file, bool ZipFiles(const base::FilePath& src_dir, const std::vector<base::FilePath>& src_relative_paths, int dest_fd) { - DCHECK(file_util::DirectoryExists(src_dir)); + DCHECK(base::DirectoryExists(src_dir)); zipFile zip_file = internal::OpenFdForZipping(dest_fd, APPEND_STATUS_CREATE); if (!zip_file) { diff --git a/third_party/zlib/google/zip_reader_unittest.cc b/third_party/zlib/google/zip_reader_unittest.cc index ca5ceb8..4fec4643 100644 --- a/third_party/zlib/google/zip_reader_unittest.cc +++ b/third_party/zlib/google/zip_reader_unittest.cc @@ -280,7 +280,7 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryToFilePath_Directory) { ASSERT_TRUE(reader.ExtractCurrentEntryToFilePath( test_dir_.AppendASCII("foo"))); // The directory should be created. - ASSERT_TRUE(file_util::DirectoryExists(test_dir_.AppendASCII("foo"))); + ASSERT_TRUE(base::DirectoryExists(test_dir_.AppendASCII("foo"))); } TEST_F(ZipReaderTest, ExtractCurrentEntryIntoDirectory_RegularFile) { @@ -290,7 +290,7 @@ TEST_F(ZipReaderTest, ExtractCurrentEntryIntoDirectory_RegularFile) { ASSERT_TRUE(reader.LocateAndOpenEntry(target_path)); ASSERT_TRUE(reader.ExtractCurrentEntryIntoDirectory(test_dir_)); // Sub directories should be created. - ASSERT_TRUE(file_util::DirectoryExists(test_dir_.AppendASCII("foo/bar"))); + ASSERT_TRUE(base::DirectoryExists(test_dir_.AppendASCII("foo/bar"))); // And the file should be created. std::string output; ASSERT_TRUE(file_util::ReadFileToString( diff --git a/tools/android/md5sum/md5sum.cc b/tools/android/md5sum/md5sum.cc index 8543fb6..bc4ca07 100644 --- a/tools/android/md5sum/md5sum.cc +++ b/tools/android/md5sum/md5sum.cc @@ -53,7 +53,7 @@ std::set<std::string> MakeFileSet(const char** files) { std::set<std::string> file_set; for (const char** file = files; *file; ++file) { base::FilePath file_path(*file); - if (file_util::DirectoryExists(file_path)) { + if (base::DirectoryExists(file_path)) { base::FileEnumerator file_enumerator( file_path, true /* recurse */, base::FileEnumerator::FILES); for (base::FilePath child, empty; diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc index caea53a..c7e80c1 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl.cc +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl.cc @@ -86,7 +86,7 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow parent_window) const { bool SelectFileDialogImpl::CallDirectoryExistsOnUIThread( const base::FilePath& path) { base::ThreadRestrictions::ScopedAllowIO allow_io; - return file_util::DirectoryExists(path); + return base::DirectoryExists(path); } } // namespace ui diff --git a/ui/shell_dialogs/gtk/select_file_dialog_impl.h b/ui/shell_dialogs/gtk/select_file_dialog_impl.h index 1911827..ebe497f 100644 --- a/ui/shell_dialogs/gtk/select_file_dialog_impl.h +++ b/ui/shell_dialogs/gtk/select_file_dialog_impl.h @@ -53,7 +53,7 @@ class SelectFileDialogImpl : public SelectFileDialog { gfx::NativeWindow owning_window, void* params) = 0; - // Wrapper for file_util::DirectoryExists() that allow access on the UI + // Wrapper for base::DirectoryExists() that allow access on the UI // thread. Use this only in the file dialog functions, where it's ok // because the file dialog has to do many stats anyway. One more won't // hurt too badly and it's likely already cached. diff --git a/ui/shell_dialogs/select_file_dialog_mac.mm b/ui/shell_dialogs/select_file_dialog_mac.mm index 1511318..218d39d 100644 --- a/ui/shell_dialogs/select_file_dialog_mac.mm +++ b/ui/shell_dialogs/select_file_dialog_mac.mm @@ -200,7 +200,7 @@ void SelectFileDialogImpl::SelectFileImpl( // The file dialog is going to do a ton of stats anyway. Not much // point in eliminating this one. base::ThreadRestrictions::ScopedAllowIO allow_io; - if (file_util::DirectoryExists(default_path)) { + if (base::DirectoryExists(default_path)) { default_dir = base::SysUTF8ToNSString(default_path.value()); } else { default_dir = base::SysUTF8ToNSString(default_path.DirName().value()); diff --git a/webkit/browser/appcache/appcache_database_unittest.cc b/webkit/browser/appcache/appcache_database_unittest.cc index 5974d83..34a6f0c 100644 --- a/webkit/browser/appcache/appcache_database_unittest.cc +++ b/webkit/browser/appcache/appcache_database_unittest.cc @@ -67,13 +67,13 @@ TEST(AppCacheDatabaseTest, ReCreate) { EXPECT_TRUE(db.LazyOpen(true)); EXPECT_TRUE(base::PathExists(kDbFile)); - EXPECT_TRUE(file_util::DirectoryExists(kNestedDir)); + EXPECT_TRUE(base::DirectoryExists(kNestedDir)); EXPECT_TRUE(base::PathExists(kOtherFile)); EXPECT_TRUE(db.DeleteExistingAndCreateNewDatabase()); EXPECT_TRUE(base::PathExists(kDbFile)); - EXPECT_FALSE(file_util::DirectoryExists(kNestedDir)); + EXPECT_FALSE(base::DirectoryExists(kNestedDir)); EXPECT_FALSE(base::PathExists(kOtherFile)); } diff --git a/webkit/browser/database/database_tracker.cc b/webkit/browser/database/database_tracker.cc index ce155ca..cc14e140 100644 --- a/webkit/browser/database/database_tracker.cc +++ b/webkit/browser/database/database_tracker.cc @@ -451,7 +451,7 @@ bool DatabaseTracker::LazyInit() { // If there are left-over directories from failed deletion attempts, clean // them up. - if (file_util::DirectoryExists(db_dir_)) { + if (base::DirectoryExists(db_dir_)) { base::FileEnumerator directories( db_dir_, false, @@ -467,7 +467,7 @@ bool DatabaseTracker::LazyInit() { // have a meta table, delete the database directory. const base::FilePath kTrackerDatabaseFullPath = db_dir_.Append(base::FilePath(kTrackerDatabaseFileName)); - if (file_util::DirectoryExists(db_dir_) && + if (base::DirectoryExists(db_dir_) && base::PathExists(kTrackerDatabaseFullPath) && (!db_->Open(kTrackerDatabaseFullPath) || !sql::MetaTable::DoesTableExist(db_.get()))) { @@ -797,7 +797,7 @@ void DatabaseTracker::DeleteIncognitoDBDirectory() { base::FilePath incognito_db_dir = profile_path_.Append(kIncognitoDatabaseDirectoryName); - if (file_util::DirectoryExists(incognito_db_dir)) + if (base::DirectoryExists(incognito_db_dir)) base::Delete(incognito_db_dir, true); } diff --git a/webkit/browser/dom_storage/dom_storage_database.cc b/webkit/browser/dom_storage/dom_storage_database.cc index 12e38ed..8a94fc8 100644 --- a/webkit/browser/dom_storage/dom_storage_database.cc +++ b/webkit/browser/dom_storage/dom_storage_database.cc @@ -266,7 +266,7 @@ bool DomStorageDatabase::DeleteFileAndRecreate() { tried_to_recreate_ = true; // If it's not a directory and we can delete the file, try and open it again. - if (!file_util::DirectoryExists(file_path_) && + if (!base::DirectoryExists(file_path_) && sql::Connection::Delete(file_path_)) { return LazyOpen(true); } diff --git a/webkit/browser/fileapi/dump_file_system.cc b/webkit/browser/fileapi/dump_file_system.cc index 1c165d7..4dd60f2 100644 --- a/webkit/browser/fileapi/dump_file_system.cc +++ b/webkit/browser/fileapi/dump_file_system.cc @@ -73,7 +73,7 @@ static void DumpDirectoryTree(const std::string& origin_name, printf("=== ORIGIN %s %s ===\n", origin_name.c_str(), FilePathToString(origin_dir).c_str()); - if (!file_util::DirectoryExists(origin_dir)) + if (!base::DirectoryExists(origin_dir)) return; SandboxDirectoryDatabase directory_db(origin_dir); @@ -189,7 +189,7 @@ int main(int argc, char* argv[]) { ShowUsageAndExit(arg0); const base::FilePath file_system_dir = fileapi::StringToFilePath(argv[1]); - if (!file_util::DirectoryExists(file_system_dir)) { + if (!base::DirectoryExists(file_system_dir)) { ShowMessageAndExit(fileapi::FilePathToString(file_system_dir) + " is not a filesystem directory"); } diff --git a/webkit/browser/fileapi/local_file_util_unittest.cc b/webkit/browser/fileapi/local_file_util_unittest.cc index 46f2e9a..0866f1e 100644 --- a/webkit/browser/fileapi/local_file_util_unittest.cc +++ b/webkit/browser/fileapi/local_file_util_unittest.cc @@ -75,11 +75,11 @@ class LocalFileUtilTest : public testing::Test { bool FileExists(const char *file_name) { return base::PathExists(LocalPath(file_name)) && - !file_util::DirectoryExists(LocalPath(file_name)); + !base::DirectoryExists(LocalPath(file_name)); } bool DirectoryExists(const char *file_name) { - return file_util::DirectoryExists(LocalPath(file_name)); + return base::DirectoryExists(LocalPath(file_name)); } int64 GetSize(const char *file_name) { diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc index 84b027b..efc6d42 100644 --- a/webkit/browser/fileapi/native_file_util.cc +++ b/webkit/browser/fileapi/native_file_util.cc @@ -79,11 +79,11 @@ bool NativeFileEnumerator::IsDirectory() { PlatformFileError NativeFileUtil::CreateOrOpen( const base::FilePath& path, int file_flags, PlatformFile* file_handle, bool* created) { - if (!file_util::DirectoryExists(path.DirName())) { + if (!base::DirectoryExists(path.DirName())) { // If its parent does not exist, should return NOT_FOUND error. return base::PLATFORM_FILE_ERROR_NOT_FOUND; } - if (file_util::DirectoryExists(path)) + if (base::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_FILE; PlatformFileError error_code = base::PLATFORM_FILE_OK; *file_handle = base::CreatePlatformFile(path, file_flags, @@ -100,7 +100,7 @@ PlatformFileError NativeFileUtil::Close(PlatformFile file_handle) { PlatformFileError NativeFileUtil::EnsureFileExists( const base::FilePath& path, bool* created) { - if (!file_util::DirectoryExists(path.DirName())) + if (!base::DirectoryExists(path.DirName())) // If its parent does not exist, should return NOT_FOUND error. return base::PLATFORM_FILE_ERROR_NOT_FOUND; PlatformFileError error_code = base::PLATFORM_FILE_OK; @@ -134,7 +134,7 @@ PlatformFileError NativeFileUtil::CreateDirectory( return base::PLATFORM_FILE_ERROR_EXISTS; // If file exists at the path. - if (path_exists && !file_util::DirectoryExists(path)) + if (path_exists && !base::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_EXISTS; if (!file_util::CreateDirectory(path)) @@ -199,7 +199,7 @@ bool NativeFileUtil::PathExists(const base::FilePath& path) { } bool NativeFileUtil::DirectoryExists(const base::FilePath& path) { - return file_util::DirectoryExists(path); + return base::DirectoryExists(path); } PlatformFileError NativeFileUtil::CopyOrMoveFile( @@ -240,7 +240,7 @@ PlatformFileError NativeFileUtil::CopyOrMoveFile( PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; - if (file_util::DirectoryExists(path)) + if (base::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_FILE; if (!base::Delete(path, false)) return base::PLATFORM_FILE_ERROR_FAILED; @@ -250,7 +250,7 @@ PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) { if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; - if (!file_util::DirectoryExists(path)) + if (!base::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; if (!file_util::IsDirectoryEmpty(path)) return base::PLATFORM_FILE_ERROR_NOT_EMPTY; diff --git a/webkit/browser/fileapi/native_file_util_unittest.cc b/webkit/browser/fileapi/native_file_util_unittest.cc index 3b99ab1..1ed699e 100644 --- a/webkit/browser/fileapi/native_file_util_unittest.cc +++ b/webkit/browser/fileapi/native_file_util_unittest.cc @@ -30,7 +30,7 @@ class NativeFileUtilTest : public testing::Test { bool FileExists(const base::FilePath& path) { return base::PathExists(path) && - !file_util::DirectoryExists(path); + !base::DirectoryExists(path); } int64 GetSize(const base::FilePath& path) { @@ -99,7 +99,7 @@ TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { false /* recursive */)); EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name)); - EXPECT_TRUE(file_util::DirectoryExists(dir_name)); + EXPECT_TRUE(base::DirectoryExists(dir_name)); ASSERT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, NativeFileUtil::CreateDirectory(dir_name, @@ -108,7 +108,7 @@ TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::DeleteDirectory(dir_name)); - EXPECT_FALSE(file_util::DirectoryExists(dir_name)); + EXPECT_FALSE(base::DirectoryExists(dir_name)); EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name)); } @@ -240,7 +240,7 @@ TEST_F(NativeFileUtilTest, CopyFile) { base::FilePath dir = Path("dir"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(dir, false, false)); - ASSERT_TRUE(file_util::DirectoryExists(dir)); + ASSERT_TRUE(base::DirectoryExists(dir)); base::FilePath to_dir_file = dir.AppendASCII("file"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CopyOrMoveFile(from_file, to_dir_file, true)); @@ -299,7 +299,7 @@ TEST_F(NativeFileUtilTest, MoveFile) { base::FilePath dir = Path("dir"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CreateDirectory(dir, false, false)); - ASSERT_TRUE(file_util::DirectoryExists(dir)); + ASSERT_TRUE(base::DirectoryExists(dir)); base::FilePath to_dir_file = dir.AppendASCII("file"); ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::CopyOrMoveFile(from_file, to_dir_file, false)); diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc index abc3cc5..c4baa68 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.cc +++ b/webkit/browser/fileapi/obfuscated_file_util.cc @@ -244,7 +244,7 @@ class ObfuscatedOriginEnumerator } base::FilePath path = base_file_path_.Append(current_.path).Append(type_string); - return file_util::DirectoryExists(path); + return base::DirectoryExists(path); } private: @@ -874,7 +874,7 @@ base::FilePath ObfuscatedFileUtil::GetDirectoryForOriginAndType( } base::FilePath path = origin_dir.Append(type_string); base::PlatformFileError error = base::PLATFORM_FILE_OK; - if (!file_util::DirectoryExists(path) && + if (!base::DirectoryExists(path) && (!create || !file_util::CreateDirectory(path))) { error = create ? base::PLATFORM_FILE_ERROR_FAILED : @@ -922,7 +922,7 @@ bool ObfuscatedFileUtil::DeleteDirectoryForOriginAndType( DCHECK(type != kFileSystemTypeSyncableForInternalSync); for (size_t i = 0; i < other_types.size(); ++i) { - if (file_util::DirectoryExists( + if (base::DirectoryExists( origin_path.Append(GetDirectoryNameForType(other_types[i])))) { // Other type's directory exists; just return true here. return true; @@ -995,7 +995,7 @@ int64 ObfuscatedFileUtil::ComputeFilePathCost(const base::FilePath& path) { void ObfuscatedFileUtil::MaybePrepopulateDatabase() { base::FilePath isolated_origin_dir = file_system_directory_.Append( SandboxIsolatedOriginDatabase::kOriginDirectory); - if (!file_util::DirectoryExists(isolated_origin_dir)) + if (!base::DirectoryExists(isolated_origin_dir)) return; const FileSystemType kPrepopulateTypes[] = { @@ -1009,7 +1009,7 @@ void ObfuscatedFileUtil::MaybePrepopulateDatabase() { base::FilePath::StringType type_string = GetDirectoryNameForType(type); DCHECK(!type_string.empty()); base::FilePath path = isolated_origin_dir.Append(type_string); - if (!file_util::DirectoryExists(path)) + if (!base::DirectoryExists(path)) continue; scoped_ptr<SandboxDirectoryDatabase> db(new SandboxDirectoryDatabase(path)); if (db->Init(SandboxDirectoryDatabase::FAIL_ON_CORRUPTION)) { @@ -1238,7 +1238,7 @@ base::FilePath ObfuscatedFileUtil::GetDirectoryForOrigin( } base::FilePath path = file_system_directory_.Append(directory_name); - bool exists_in_fs = file_util::DirectoryExists(path); + bool exists_in_fs = base::DirectoryExists(path); if (!exists_in_db && exists_in_fs) { if (!base::Delete(path, true)) { if (error_code) @@ -1298,7 +1298,7 @@ bool ObfuscatedFileUtil::InitOriginDatabase(bool create) { if (origin_database_) return true; - if (!create && !file_util::DirectoryExists(file_system_directory_)) + if (!create && !base::DirectoryExists(file_system_directory_)) return false; if (!file_util::CreateDirectory(file_system_directory_)) { LOG(WARNING) << "Failed to create FileSystem directory: " << diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc index e865b3d..1ceef8d 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 base::PathExists(path) && !file_util::DirectoryExists(path); + return base::PathExists(path) && !base::DirectoryExists(path); } int64 GetSize(const base::FilePath& path) { diff --git a/webkit/browser/fileapi/sandbox_directory_database.cc b/webkit/browser/fileapi/sandbox_directory_database.cc index 41cc429..5e4ba3d 100644 --- a/webkit/browser/fileapi/sandbox_directory_database.cc +++ b/webkit/browser/fileapi/sandbox_directory_database.cc @@ -180,7 +180,7 @@ DatabaseCheckHelper::DatabaseCheckHelper( last_file_id_(-1), last_integer_(-1) { DCHECK(dir_db_); DCHECK(db_); - DCHECK(!path_.empty() && file_util::DirectoryExists(path_)); + DCHECK(!path_.empty() && base::DirectoryExists(path_)); } bool DatabaseCheckHelper::IsDatabaseEmpty() { diff --git a/webkit/browser/fileapi/sandbox_directory_database_unittest.cc b/webkit/browser/fileapi/sandbox_directory_database_unittest.cc index e163c8b..9278129 100644 --- a/webkit/browser/fileapi/sandbox_directory_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_directory_database_unittest.cc @@ -81,7 +81,7 @@ class SandboxDirectoryDatabaseTest : public testing::Test { ASSERT_TRUE(db_->AddFileInfo(info, &file_id)); base::FilePath local_path = path().Append(data_path); - if (!file_util::DirectoryExists(local_path.DirName())) + if (!base::DirectoryExists(local_path.DirName())) ASSERT_TRUE(file_util::CreateDirectory(local_path.DirName())); bool created = false; diff --git a/webkit/browser/fileapi/sandbox_file_system_backend.cc b/webkit/browser/fileapi/sandbox_file_system_backend.cc index f81af13..eb319f4 100644 --- a/webkit/browser/fileapi/sandbox_file_system_backend.cc +++ b/webkit/browser/fileapi/sandbox_file_system_backend.cc @@ -403,7 +403,7 @@ int64 SandboxFileSystemBackend::GetOriginUsageOnFileThread( base::FilePath base_path = GetBaseDirectoryForOriginAndType(origin_url, type, false); - if (base_path.empty() || !file_util::DirectoryExists(base_path)) + if (base_path.empty() || !base::DirectoryExists(base_path)) return 0; base::FilePath usage_file_path = base_path.Append(FileSystemUsageCache::kUsageFileName); diff --git a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc index 2794df3..373e684 100644 --- a/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc +++ b/webkit/browser/fileapi/sandbox_file_system_backend_unittest.cc @@ -105,7 +105,7 @@ class SandboxFileSystemBackendTest : public testing::Test { base::FilePath target = backend_-> GetBaseDirectoryForOriginAndType(origin, type, true); ASSERT_TRUE(!target.empty()); - ASSERT_TRUE(file_util::DirectoryExists(target)); + ASSERT_TRUE(base::DirectoryExists(target)); } bool GetRootPath(const GURL& origin_url, @@ -255,7 +255,7 @@ TEST_F(SandboxFileSystemBackendTest, GetRootPathCreateAndExamine) { base::FilePath expected = file_system_path().AppendASCII( kRootPathTestCases[i].expected_path); EXPECT_EQ(expected.value(), root_path.value()); - EXPECT_TRUE(file_util::DirectoryExists(root_path)); + EXPECT_TRUE(base::DirectoryExists(root_path)); ASSERT_TRUE(returned_root_path.size() > i); returned_root_path[i] = root_path; } @@ -353,7 +353,7 @@ TEST_F(SandboxFileSystemBackendTest, GetRootPathFileURIWithAllowFlag) { base::FilePath expected = file_system_path().AppendASCII( kRootPathFileURITestCases[i].expected_path); EXPECT_EQ(expected.value(), root_path.value()); - EXPECT_TRUE(file_util::DirectoryExists(root_path)); + EXPECT_TRUE(base::DirectoryExists(root_path)); } } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc index f430fa0..7eeab21 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc @@ -50,7 +50,7 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { 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)); + EXPECT_TRUE(base::DirectoryExists(old_db_path)); // Populate the origin directory with some fake data. base::FilePath directory_db_path = dir.path().Append(path); @@ -74,7 +74,7 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { // so we should see the same fake data. std::string origin_db_data; base::FilePath directory_db_path = dir.path().Append(path); - EXPECT_TRUE(file_util::DirectoryExists(directory_db_path)); + EXPECT_TRUE(base::DirectoryExists(directory_db_path)); EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); EXPECT_TRUE(file_util::ReadFileToString( directory_db_path.AppendASCII("dummy"), &origin_db_data)); diff --git a/webkit/browser/fileapi/transient_file_util_unittest.cc b/webkit/browser/fileapi/transient_file_util_unittest.cc index 02a2329..8cd0143 100644 --- a/webkit/browser/fileapi/transient_file_util_unittest.cc +++ b/webkit/browser/fileapi/transient_file_util_unittest.cc @@ -86,7 +86,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { // Make sure the file is there. ASSERT_TRUE(temp_url.is_valid()); ASSERT_TRUE(base::PathExists(temp_path)); - ASSERT_FALSE(file_util::DirectoryExists(temp_path)); + ASSERT_FALSE(base::DirectoryExists(temp_path)); // Create a snapshot file. { diff --git a/webkit/glue/webfileutilities_impl.cc b/webkit/glue/webfileutilities_impl.cc index 1249190..3ad3b3d 100644 --- a/webkit/glue/webfileutilities_impl.cc +++ b/webkit/glue/webfileutilities_impl.cc @@ -74,7 +74,7 @@ bool WebFileUtilitiesImpl::makeAllDirectories(const WebString& path) { } bool WebFileUtilitiesImpl::isDirectory(const WebString& path) { - return file_util::DirectoryExists(base::FilePath::FromUTF16Unsafe(path)); + return base::DirectoryExists(base::FilePath::FromUTF16Unsafe(path)); } WebKit::WebURL WebFileUtilitiesImpl::filePathToURL(const WebString& path) { |