diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 17:36:07 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-07-11 17:36:07 +0000 |
commit | 7567484144da059e2c2c2a818b06660a5459052f (patch) | |
tree | a4ceafc7e890051c25dbdd54b170d0f5794dd229 /webkit/browser/fileapi | |
parent | 8a25d54d6eb190a8b82479b5309a892c1080a372 (diff) | |
download | chromium_src-7567484144da059e2c2c2a818b06660a5459052f.zip chromium_src-7567484144da059e2c2c2a818b06660a5459052f.tar.gz chromium_src-7567484144da059e2c2c2a818b06660a5459052f.tar.bz2 |
Move PathExists to base namespace.
BUG=
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/18286004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211147 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/browser/fileapi')
13 files changed, 44 insertions, 44 deletions
diff --git a/webkit/browser/fileapi/file_system_usage_cache.cc b/webkit/browser/fileapi/file_system_usage_cache.cc index d9352fc..9dcfaee 100644 --- a/webkit/browser/fileapi/file_system_usage_cache.cc +++ b/webkit/browser/fileapi/file_system_usage_cache.cc @@ -149,7 +149,7 @@ bool FileSystemUsageCache::UpdateUsage(const base::FilePath& usage_file_path, bool FileSystemUsageCache::Exists(const base::FilePath& usage_file_path) { TRACE_EVENT0("FileSystem", "UsageCache::Exists"); DCHECK(CalledOnValidThread()); - return file_util::PathExists(usage_file_path); + return base::PathExists(usage_file_path); } bool FileSystemUsageCache::Delete(const base::FilePath& usage_file_path) { diff --git a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc index 54ac218..84e9a8c 100644 --- a/webkit/browser/fileapi/local_file_stream_writer_unittest.cc +++ b/webkit/browser/fileapi/local_file_stream_writer_unittest.cc @@ -100,7 +100,7 @@ TEST_F(LocalFileStreamWriterTest, Write) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "bar")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foobar", GetFileContent(path)); } @@ -111,7 +111,7 @@ TEST_F(LocalFileStreamWriterTest, WriteMiddle) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foxxxr", GetFileContent(path)); } @@ -122,19 +122,19 @@ TEST_F(LocalFileStreamWriterTest, WriteEnd) { EXPECT_EQ(net::OK, WriteStringToWriter(writer.get(), "xxx")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foobarxxx", GetFileContent(path)); } TEST_F(LocalFileStreamWriterTest, WriteFailForNonexistingFile) { base::FilePath path = Path("file_a"); - ASSERT_FALSE(file_util::PathExists(path)); + ASSERT_FALSE(base::PathExists(path)); scoped_ptr<LocalFileStreamWriter> writer( new LocalFileStreamWriter(file_task_runner(), path, 0)); EXPECT_EQ(net::ERR_FILE_NOT_FOUND, WriteStringToWriter(writer.get(), "foo")); writer.reset(); base::MessageLoop::current()->RunUntilIdle(); - EXPECT_FALSE(file_util::PathExists(path)); + EXPECT_FALSE(base::PathExists(path)); } TEST_F(LocalFileStreamWriterTest, CancelBeforeOperation) { @@ -159,7 +159,7 @@ TEST_F(LocalFileStreamWriterTest, CancelAfterFinishedOperation) { writer.reset(); base::MessageLoop::current()->RunUntilIdle(); // Write operation is already completed. - EXPECT_TRUE(file_util::PathExists(path)); + EXPECT_TRUE(base::PathExists(path)); EXPECT_EQ("foo", GetFileContent(path)); } diff --git a/webkit/browser/fileapi/local_file_util_unittest.cc b/webkit/browser/fileapi/local_file_util_unittest.cc index 1eb3792..46f2e9a 100644 --- a/webkit/browser/fileapi/local_file_util_unittest.cc +++ b/webkit/browser/fileapi/local_file_util_unittest.cc @@ -74,7 +74,7 @@ class LocalFileUtilTest : public testing::Test { } bool FileExists(const char *file_name) { - return file_util::PathExists(LocalPath(file_name)) && + return base::PathExists(LocalPath(file_name)) && !file_util::DirectoryExists(LocalPath(file_name)); } diff --git a/webkit/browser/fileapi/native_file_util.cc b/webkit/browser/fileapi/native_file_util.cc index 7b12a62..84b027b 100644 --- a/webkit/browser/fileapi/native_file_util.cc +++ b/webkit/browser/fileapi/native_file_util.cc @@ -126,10 +126,10 @@ PlatformFileError NativeFileUtil::CreateDirectory( bool exclusive, bool recursive) { // If parent dir of file doesn't exist. - if (!recursive && !file_util::PathExists(path.DirName())) + if (!recursive && !base::PathExists(path.DirName())) return base::PLATFORM_FILE_ERROR_NOT_FOUND; - bool path_exists = file_util::PathExists(path); + bool path_exists = base::PathExists(path); if (exclusive && path_exists) return base::PLATFORM_FILE_ERROR_EXISTS; @@ -149,7 +149,7 @@ PlatformFileError NativeFileUtil::CreateDirectory( PlatformFileError NativeFileUtil::GetFileInfo( const base::FilePath& path, base::PlatformFileInfo* file_info) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::GetFileInfo(path, file_info)) return base::PLATFORM_FILE_ERROR_FAILED; @@ -195,7 +195,7 @@ PlatformFileError NativeFileUtil::Truncate( } bool NativeFileUtil::PathExists(const base::FilePath& path) { - return file_util::PathExists(path); + return base::PathExists(path); } bool NativeFileUtil::DirectoryExists(const base::FilePath& path) { @@ -238,7 +238,7 @@ PlatformFileError NativeFileUtil::CopyOrMoveFile( } PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (file_util::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_FILE; @@ -248,7 +248,7 @@ PlatformFileError NativeFileUtil::DeleteFile(const base::FilePath& path) { } PlatformFileError NativeFileUtil::DeleteDirectory(const base::FilePath& path) { - if (!file_util::PathExists(path)) + if (!base::PathExists(path)) return base::PLATFORM_FILE_ERROR_NOT_FOUND; if (!file_util::DirectoryExists(path)) return base::PLATFORM_FILE_ERROR_NOT_A_DIRECTORY; diff --git a/webkit/browser/fileapi/native_file_util_unittest.cc b/webkit/browser/fileapi/native_file_util_unittest.cc index e42effb..3b99ab1 100644 --- a/webkit/browser/fileapi/native_file_util_unittest.cc +++ b/webkit/browser/fileapi/native_file_util_unittest.cc @@ -29,7 +29,7 @@ class NativeFileUtilTest : public testing::Test { } bool FileExists(const base::FilePath& path) { - return file_util::PathExists(path) && + return base::PathExists(path) && !file_util::DirectoryExists(path); } @@ -56,7 +56,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { &file_handle, &created)); ASSERT_TRUE(created); - EXPECT_TRUE(file_util::PathExists(file_name)); + EXPECT_TRUE(base::PathExists(file_name)); EXPECT_TRUE(NativeFileUtil::PathExists(file_name)); EXPECT_EQ(0, GetSize(file_name)); EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); @@ -72,7 +72,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::DeleteFile(file_name)); - EXPECT_FALSE(file_util::PathExists(file_name)); + EXPECT_FALSE(base::PathExists(file_name)); EXPECT_FALSE(NativeFileUtil::PathExists(file_name)); } diff --git a/webkit/browser/fileapi/obfuscated_file_util.cc b/webkit/browser/fileapi/obfuscated_file_util.cc index 174cb81..abc3cc5 100644 --- a/webkit/browser/fileapi/obfuscated_file_util.cc +++ b/webkit/browser/fileapi/obfuscated_file_util.cc @@ -1103,7 +1103,7 @@ PlatformFileError ObfuscatedFileUtil::CreateFile( src_file_path, dest_local_path, true /* copy */); created = true; } else { - if (file_util::PathExists(dest_local_path)) { + if (base::PathExists(dest_local_path)) { if (!base::Delete(dest_local_path, true /* recursive */)) { NOTREACHED(); return base::PLATFORM_FILE_ERROR_FAILED; diff --git a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc index 31e8e87..e865b3d 100644 --- a/webkit/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/webkit/browser/fileapi/obfuscated_file_util_unittest.cc @@ -37,7 +37,7 @@ namespace fileapi { namespace { bool FileExists(const base::FilePath& path) { - return file_util::PathExists(path) && !file_util::DirectoryExists(path); + return base::PathExists(path) && !file_util::DirectoryExists(path); } int64 GetSize(const base::FilePath& path) { @@ -720,7 +720,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { base::FilePath local_path; EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); - EXPECT_TRUE(file_util::PathExists(local_path)); + EXPECT_TRUE(base::PathExists(local_path)); // Verify that deleting a file isn't stopped by zero quota, and that it frees // up quote from its path. @@ -729,7 +729,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteFile(context.get(), url)); EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); - EXPECT_FALSE(file_util::PathExists(local_path)); + EXPECT_FALSE(base::PathExists(local_path)); EXPECT_EQ(ObfuscatedFileUtil::ComputeFilePathCost(url.path()), context->allowed_bytes_growth()); @@ -758,13 +758,13 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( context.get(), url, &local_path)); - EXPECT_TRUE(file_util::PathExists(local_path)); + EXPECT_TRUE(base::PathExists(local_path)); context.reset(NewContext(NULL)); EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->DeleteFile(context.get(), url)); EXPECT_EQ(1, change_observer()->get_and_reset_remove_file_count()); - EXPECT_FALSE(file_util::PathExists(local_path)); + EXPECT_FALSE(base::PathExists(local_path)); // Make sure we have no unexpected changes. EXPECT_TRUE(change_observer()->HasNoChange()); diff --git a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc index 620be98..5c0a7da 100644 --- a/webkit/browser/fileapi/sandbox_file_system_test_helper.cc +++ b/webkit/browser/fileapi/sandbox_file_system_test_helper.cc @@ -98,7 +98,7 @@ int64 SandboxFileSystemTestHelper::GetCachedOriginUsage() const { int64 SandboxFileSystemTestHelper::ComputeCurrentOriginUsage() { usage_cache()->CloseCacheFiles(); int64 size = base::ComputeDirectorySize(GetOriginRootPath()); - if (file_util::PathExists(GetUsageCachePath())) + if (base::PathExists(GetUsageCachePath())) size -= FileSystemUsageCache::kUsageFileSize; return size; } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc index a64ea5e..d99ef85 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database.cc @@ -72,7 +72,7 @@ void SandboxIsolatedOriginDatabase::MigrateDatabaseIfNeeded() { base::FilePath from_path = file_system_directory_.Append(directory_name); base::FilePath to_path = file_system_directory_.Append(kOriginDirectory); - if (file_util::PathExists(to_path)) + if (base::PathExists(to_path)) base::Delete(to_path, true /* recursive */); base::Move(from_path, to_path); } diff --git a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc index b334741..f430fa0 100644 --- a/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_isolated_origin_database_unittest.cc @@ -47,7 +47,7 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { { SandboxOriginDatabase database_old(dir.path()); old_db_path = database_old.GetDatabasePath(); - EXPECT_FALSE(file_util::PathExists(old_db_path)); + EXPECT_FALSE(base::PathExists(old_db_path)); EXPECT_TRUE(database_old.GetPathForOrigin(kOrigin, &path)); EXPECT_FALSE(path.empty()); EXPECT_TRUE(file_util::DirectoryExists(old_db_path)); @@ -75,13 +75,13 @@ TEST(SandboxIsolatedOriginDatabaseTest, MigrationTest) { std::string origin_db_data; base::FilePath directory_db_path = dir.path().Append(path); EXPECT_TRUE(file_util::DirectoryExists(directory_db_path)); - EXPECT_TRUE(file_util::PathExists(directory_db_path.AppendASCII("dummy"))); + EXPECT_TRUE(base::PathExists(directory_db_path.AppendASCII("dummy"))); EXPECT_TRUE(file_util::ReadFileToString( directory_db_path.AppendASCII("dummy"), &origin_db_data)); EXPECT_EQ(kFakeDirectoryData, origin_db_data); // After the migration the database must be gone. - EXPECT_FALSE(file_util::PathExists(old_db_path)); + EXPECT_FALSE(base::PathExists(old_db_path)); } } // namespace fileapi diff --git a/webkit/browser/fileapi/sandbox_origin_database.cc b/webkit/browser/fileapi/sandbox_origin_database.cc index 0d7d3ef..f85ddbe 100644 --- a/webkit/browser/fileapi/sandbox_origin_database.cc +++ b/webkit/browser/fileapi/sandbox_origin_database.cc @@ -71,7 +71,7 @@ bool SandboxOriginDatabase::Init(InitOption init_option, return true; base::FilePath db_path = GetDatabasePath(); - if (init_option == FAIL_IF_NONEXISTENT && !file_util::PathExists(db_path)) + if (init_option == FAIL_IF_NONEXISTENT && !base::PathExists(db_path)) return false; std::string path = FilePathToString(db_path); diff --git a/webkit/browser/fileapi/sandbox_origin_database_unittest.cc b/webkit/browser/fileapi/sandbox_origin_database_unittest.cc index 49e5045..867dc27 100644 --- a/webkit/browser/fileapi/sandbox_origin_database_unittest.cc +++ b/webkit/browser/fileapi/sandbox_origin_database_unittest.cc @@ -32,7 +32,7 @@ TEST(SandboxOriginDatabaseTest, BasicTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -55,14 +55,14 @@ TEST(SandboxOriginDatabaseTest, BasicTest) { EXPECT_FALSE(path1.empty()); EXPECT_EQ(path0, path1); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); } TEST(SandboxOriginDatabaseTest, TwoPathTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -83,14 +83,14 @@ TEST(SandboxOriginDatabaseTest, TwoPathTest) { EXPECT_FALSE(path1.empty()); EXPECT_NE(path0, path1); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); } TEST(SandboxOriginDatabaseTest, DropDatabaseTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -103,7 +103,7 @@ TEST(SandboxOriginDatabaseTest, DropDatabaseTest) { EXPECT_TRUE(database.HasOriginPath(origin)); EXPECT_FALSE(path0.empty()); - EXPECT_TRUE(file_util::PathExists(kFSDir.Append(kOriginDatabaseName))); + EXPECT_TRUE(base::PathExists(kFSDir.Append(kOriginDatabaseName))); database.DropDatabase(); @@ -118,7 +118,7 @@ TEST(SandboxOriginDatabaseTest, DeleteOriginTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); SandboxOriginDatabase database(kFSDir); @@ -145,7 +145,7 @@ TEST(SandboxOriginDatabaseTest, ListOriginsTest) { base::ScopedTempDir dir; ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); std::vector<SandboxOriginDatabase::OriginRecord> origins; @@ -195,7 +195,7 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryTest) { ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); const base::FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); const std::string kOrigins[] = { @@ -255,8 +255,8 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryTest) { EXPECT_FALSE(path.empty()); EXPECT_TRUE(database->HasOriginPath(kOrigin)); - EXPECT_FALSE(file_util::PathExists(kGarbageFile)); - EXPECT_FALSE(file_util::PathExists(kGarbageDir)); + EXPECT_FALSE(base::PathExists(kGarbageFile)); + EXPECT_FALSE(base::PathExists(kGarbageDir)); } TEST(SandboxOriginDatabaseTest, DatabaseRecoveryForMissingDBFileTest) { @@ -275,7 +275,7 @@ TEST(SandboxOriginDatabaseTest, DatabaseRecoveryForMissingDBFileTest) { ASSERT_TRUE(dir.CreateUniqueTempDir()); const base::FilePath kFSDir = dir.path().Append(kFileSystemDirName); const base::FilePath kDBDir = kFSDir.Append(kOriginDatabaseName); - EXPECT_FALSE(file_util::PathExists(kFSDir)); + EXPECT_FALSE(base::PathExists(kFSDir)); EXPECT_TRUE(file_util::CreateDirectory(kFSDir)); const std::string kOrigin = "foo.example.com"; diff --git a/webkit/browser/fileapi/transient_file_util_unittest.cc b/webkit/browser/fileapi/transient_file_util_unittest.cc index 66be6db..02a2329 100644 --- a/webkit/browser/fileapi/transient_file_util_unittest.cc +++ b/webkit/browser/fileapi/transient_file_util_unittest.cc @@ -85,7 +85,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { // Make sure the file is there. ASSERT_TRUE(temp_url.is_valid()); - ASSERT_TRUE(file_util::PathExists(temp_path)); + ASSERT_TRUE(base::PathExists(temp_path)); ASSERT_FALSE(file_util::DirectoryExists(temp_path)); // Create a snapshot file. @@ -101,7 +101,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { ASSERT_FALSE(file_info.is_directory); // The file should be still there. - ASSERT_TRUE(file_util::PathExists(temp_path)); + ASSERT_TRUE(base::PathExists(temp_path)); ASSERT_EQ(base::PLATFORM_FILE_OK, file_util()->GetFileInfo(NewOperationContext().get(), temp_url, &file_info, &path)); @@ -113,7 +113,7 @@ TEST_F(TransientFileUtilTest, TransientFile) { base::MessageLoop::current()->RunUntilIdle(); // Now the temporary file and the transient filesystem must be gone too. - ASSERT_FALSE(file_util::PathExists(temp_path)); + ASSERT_FALSE(base::PathExists(temp_path)); ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, file_util()->GetFileInfo(NewOperationContext().get(), temp_url, &file_info, &path)); |