Index: webkit/fileapi/obfuscated_file_util_unittest.cc |
diff --git a/webkit/fileapi/obfuscated_file_system_file_util_unittest.cc b/webkit/fileapi/obfuscated_file_util_unittest.cc |
similarity index 76% |
rename from webkit/fileapi/obfuscated_file_system_file_util_unittest.cc |
rename to webkit/fileapi/obfuscated_file_util_unittest.cc |
index 6e61b9af2a578e369c309abb5957cd51c57e7871..2cc24d5c4839166fef7850f77a2ab28a3aa250a1 100644 |
--- a/webkit/fileapi/obfuscated_file_system_file_util_unittest.cc |
+++ b/webkit/fileapi/obfuscated_file_util_unittest.cc |
@@ -16,7 +16,8 @@ |
#include "webkit/fileapi/file_system_context.h" |
#include "webkit/fileapi/file_system_operation_context.h" |
#include "webkit/fileapi/file_system_test_helper.h" |
-#include "webkit/fileapi/obfuscated_file_system_file_util.h" |
+#include "webkit/fileapi/native_file_util.h" |
+#include "webkit/fileapi/obfuscated_file_util.h" |
using namespace fileapi; |
@@ -121,9 +122,9 @@ const OriginEnumerationTestRecord kOriginEnumerationTestRecords[] = { |
// could theoretically be shared. It would basically be a FSFU interface |
// compliance test, and only the subclass-specific bits that look into the |
// implementation would need to be written per-subclass. |
-class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
+class ObfuscatedFileUtilTest : public testing::Test { |
public: |
- ObfuscatedFileSystemFileUtilTest() |
+ ObfuscatedFileUtilTest() |
: origin_(GURL("http://www.example.com")), |
type_(kFileSystemTypeTemporary), |
test_helper_(origin_, type_) { |
@@ -132,14 +133,13 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
void SetUp() { |
ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
- obfuscated_file_system_file_util_ = |
- new ObfuscatedFileSystemFileUtil(data_dir_.path(), |
- new FileSystemFileUtil()); |
+ obfuscated_file_util_ = |
+ new ObfuscatedFileUtil(data_dir_.path(), new NativeFileUtil()); |
test_helper_.SetUp(data_dir_.path(), |
false, // incognito |
false, // unlimited quota |
NULL, // quota::QuotaManagerProxy |
- obfuscated_file_system_file_util_.get()); |
+ obfuscated_file_util_.get()); |
} |
FileSystemOperationContext* NewContext() { |
@@ -147,8 +147,8 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
return context; |
} |
- ObfuscatedFileSystemFileUtil* ofsfu() { |
- return obfuscated_file_system_file_util_.get(); |
+ ObfuscatedFileUtil* ofu() { |
+ return obfuscated_file_util_.get(); |
} |
const FilePath& test_directory() const { |
@@ -167,12 +167,12 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
const FilePath& virtual_path, PlatformFile file_handle) { |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
FilePath local_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetLocalFilePath( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( |
context.get(), virtual_path, &local_path)); |
base::PlatformFileInfo file_info0; |
FilePath data_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), virtual_path, &file_info0, &data_path)); |
EXPECT_EQ(data_path, local_path); |
EXPECT_TRUE(FileExists(data_path)); |
@@ -199,7 +199,7 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
base::PlatformFileInfo file_info1; |
EXPECT_EQ(length, GetSize(data_path)); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), virtual_path, &file_info1, &data_path)); |
EXPECT_EQ(data_path, local_path); |
@@ -212,12 +212,12 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
EXPECT_LE(file_info0.last_modified, file_info1.last_modified); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate( |
context.get(), virtual_path, length * 2)); |
EXPECT_EQ(length * 2, GetSize(data_path)); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate( |
context.get(), virtual_path, 1)); |
EXPECT_EQ(1, GetSize(data_path)); |
} |
@@ -232,14 +232,14 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
bool created = true; |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists( |
+ ofu()->EnsureFileExists( |
context.get(), root_path.Append(*iter), |
&created)); |
ASSERT_FALSE(created); |
} |
for (iter = directories.begin(); iter != directories.end(); ++iter) { |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), |
root_path.Append(*iter))); |
} |
} |
@@ -252,7 +252,7 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
context.reset(NewContext()); |
std::vector<base::FileUtilProxy::Entry> entries; |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->ReadDirectory(context.get(), root_path, &entries)); |
+ ofu()->ReadDirectory(context.get(), root_path, &entries)); |
EXPECT_EQ(0UL, entries.size()); |
files->clear(); |
@@ -268,7 +268,7 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
bool created = false; |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists( |
+ ofu()->EnsureFileExists( |
context.get(), root_path.Append(*iter), &created)); |
ASSERT_TRUE(created); |
} |
@@ -277,7 +277,7 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
bool recursive = false; |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->CreateDirectory( |
+ ofu()->CreateDirectory( |
context.get(), root_path.Append(*iter), exclusive, recursive)); |
} |
ValidateTestDirectory(root_path, *files, *directories); |
@@ -292,7 +292,7 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
std::vector<base::FileUtilProxy::Entry> entries; |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->ReadDirectory(context.get(), root_path, &entries)); |
+ ofu()->ReadDirectory(context.get(), root_path, &entries)); |
std::vector<base::FileUtilProxy::Entry>::iterator entry_iter; |
EXPECT_EQ(files.size() + directories.size(), entries.size()); |
for (entry_iter = entries.begin(); entry_iter != entries.end(); |
@@ -316,12 +316,12 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
base::Time last_modified_time = base::Time::Now(); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Touch( |
+ ofu()->Touch( |
context.get(), path, last_access_time, last_modified_time)); |
FilePath local_path; |
base::PlatformFileInfo file_info; |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), path, &file_info, &local_path)); |
// We compare as time_t here to lower our resolution, to avoid false |
// negatives caused by conversion to the local filesystem's native |
@@ -331,10 +331,10 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
context.reset(NewContext()); |
last_modified_time += base::TimeDelta::FromHours(1); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Touch( |
+ ofu()->Touch( |
context.get(), path, last_access_time, last_modified_time)); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), path, &file_info, &local_path)); |
EXPECT_EQ(file_info.last_modified.ToTimeT(), last_modified_time.ToTimeT()); |
} |
@@ -364,41 +364,41 @@ class ObfuscatedFileSystemFileUtilTest : public testing::Test { |
if (overwrite) { |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), dest_path, &created)); |
+ ofu()->EnsureFileExists(context.get(), dest_path, &created)); |
EXPECT_TRUE(created); |
} |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->CopyInForeignFile(context.get(), src_path, dest_path)); |
+ ofu()->CopyInForeignFile(context.get(), src_path, dest_path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), dest_path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), dest_path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), dest_path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), dest_path)); |
context.reset(NewContext()); |
base::PlatformFileInfo file_info; |
FilePath data_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), dest_path, &file_info, &data_path)); |
EXPECT_NE(data_path, src_path); |
EXPECT_TRUE(FileExists(data_path)); |
EXPECT_EQ(src_file_length, GetSize(data_path)); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteFile(context.get(), dest_path)); |
+ ofu()->DeleteFile(context.get(), dest_path)); |
} |
private: |
ScopedTempDir data_dir_; |
- scoped_refptr<ObfuscatedFileSystemFileUtil> obfuscated_file_system_file_util_; |
+ scoped_refptr<ObfuscatedFileUtil> obfuscated_file_util_; |
GURL origin_; |
fileapi::FileSystemType type_; |
FileSystemTestOriginHelper test_helper_; |
- DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtilTest); |
+ DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtilTest); |
}; |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestCreateAndDeleteFile) { |
+TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { |
base::PlatformFile file_handle = base::kInvalidPlatformFileValue; |
bool created; |
FilePath path = UTF8ToFilePath("fake/file"); |
@@ -406,19 +406,19 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestCreateAndDeleteFile) { |
int file_flags = base::PLATFORM_FILE_CREATE | base::PLATFORM_FILE_WRITE; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->CreateOrOpen( |
+ ofu()->CreateOrOpen( |
context.get(), path, file_flags, &file_handle, |
&created)); |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->DeleteFile(context.get(), path)); |
+ ofu()->DeleteFile(context.get(), path)); |
path = UTF8ToFilePath("test file"); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->CreateOrOpen( |
+ ofu()->CreateOrOpen( |
context.get(), path, file_flags, &file_handle, &created)); |
ASSERT_TRUE(created); |
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); |
@@ -427,13 +427,13 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestCreateAndDeleteFile) { |
context.reset(NewContext()); |
FilePath local_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetLocalFilePath( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( |
context.get(), path, &local_path)); |
EXPECT_TRUE(file_util::PathExists(local_path)); |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteFile(context.get(), path)); |
+ ofu()->DeleteFile(context.get(), path)); |
EXPECT_FALSE(file_util::PathExists(local_path)); |
context.reset(NewContext()); |
@@ -441,13 +441,13 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestCreateAndDeleteFile) { |
bool recursive = true; |
FilePath directory_path = UTF8ToFilePath("series/of/directories"); |
path = directory_path.AppendASCII("file name"); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), directory_path, exclusive, recursive)); |
context.reset(NewContext()); |
file_handle = base::kInvalidPlatformFileValue; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->CreateOrOpen( |
+ ofu()->CreateOrOpen( |
context.get(), path, file_flags, &file_handle, &created)); |
ASSERT_TRUE(created); |
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); |
@@ -455,71 +455,71 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestCreateAndDeleteFile) { |
CheckFileAndCloseHandle(path, file_handle); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetLocalFilePath( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( |
context.get(), path, &local_path)); |
EXPECT_TRUE(file_util::PathExists(local_path)); |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteFile(context.get(), path)); |
+ ofu()->DeleteFile(context.get(), path)); |
EXPECT_FALSE(file_util::PathExists(local_path)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestTruncate) { |
+TEST_F(ObfuscatedFileUtilTest, TestTruncate) { |
bool created = false; |
FilePath path = UTF8ToFilePath("file"); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->Truncate(context.get(), path, 4)); |
+ ofu()->Truncate(context.get(), path, 4)); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), path, &created)); |
+ ofu()->EnsureFileExists(context.get(), path, &created)); |
ASSERT_TRUE(created); |
context.reset(NewContext()); |
FilePath local_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetLocalFilePath( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetLocalFilePath( |
context.get(), path, &local_path)); |
EXPECT_EQ(0, GetSize(local_path)); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate( |
context.get(), path, 10)); |
EXPECT_EQ(10, GetSize(local_path)); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->Truncate( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->Truncate( |
context.get(), path, 1)); |
EXPECT_EQ(1, GetSize(local_path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), path)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestEnsureFileExists) { |
+TEST_F(ObfuscatedFileUtilTest, TestEnsureFileExists) { |
FilePath path = UTF8ToFilePath("fake/file"); |
bool created = false; |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->EnsureFileExists( |
+ ofu()->EnsureFileExists( |
context.get(), path, &created)); |
context.reset(NewContext()); |
path = UTF8ToFilePath("test file"); |
created = false; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), path, &created)); |
+ ofu()->EnsureFileExists(context.get(), path, &created)); |
ASSERT_TRUE(created); |
CheckFileAndCloseHandle(path, base::kInvalidPlatformFileValue); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), path, &created)); |
+ ofu()->EnsureFileExists(context.get(), path, &created)); |
ASSERT_FALSE(created); |
// Also test in a subdirectory. |
@@ -527,65 +527,65 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestEnsureFileExists) { |
context.reset(NewContext()); |
bool exclusive = true; |
bool recursive = true; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path.DirName(), exclusive, recursive)); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), path, &created)); |
+ ofu()->EnsureFileExists(context.get(), path, &created)); |
ASSERT_TRUE(created); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), path)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestDirectoryOps) { |
+TEST_F(ObfuscatedFileUtilTest, TestDirectoryOps) { |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
bool exclusive = false; |
bool recursive = false; |
FilePath path = UTF8ToFilePath("foo/bar"); |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->DeleteSingleDirectory(context.get(), path)); |
+ ofu()->DeleteSingleDirectory(context.get(), path)); |
FilePath root = UTF8ToFilePath(""); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->PathExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->IsDirectoryEmpty(context.get(), root)); |
+ EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), root)); |
context.reset(NewContext()); |
exclusive = false; |
recursive = true; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->IsDirectoryEmpty(context.get(), root)); |
+ EXPECT_FALSE(ofu()->IsDirectoryEmpty(context.get(), root)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), path.DirName())); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), path.DirName())); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->IsDirectoryEmpty(context.get(), path.DirName())); |
+ EXPECT_FALSE(ofu()->IsDirectoryEmpty(context.get(), path.DirName())); |
// Can't remove a non-empty directory. |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_EMPTY, |
- ofsfu()->DeleteSingleDirectory(context.get(), path.DirName())); |
+ ofu()->DeleteSingleDirectory(context.get(), path.DirName())); |
base::PlatformFileInfo file_info; |
FilePath local_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), path, &file_info, &local_path)); |
EXPECT_TRUE(local_path.empty()); |
EXPECT_TRUE(file_info.is_directory); |
@@ -593,116 +593,116 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestDirectoryOps) { |
// Same create again should succeed, since exclusive is false. |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
exclusive = true; |
recursive = true; |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
context.reset(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteSingleDirectory(context.get(), path)); |
+ ofu()->DeleteSingleDirectory(context.get(), path)); |
path = UTF8ToFilePath("foo/bop"); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->PathExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->IsDirectoryEmpty(context.get(), path)); |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofsfu()->GetFileInfo( |
+ EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), path)); |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->GetFileInfo( |
context.get(), path, &file_info, &local_path)); |
exclusive = true; |
recursive = false; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), path)); |
exclusive = true; |
recursive = false; |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
exclusive = true; |
recursive = false; |
path = UTF8ToFilePath("foo"); |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
path = UTF8ToFilePath("blah"); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_FALSE(ofu()->PathExists(context.get(), path)); |
exclusive = true; |
recursive = false; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->PathExists(context.get(), path)); |
+ EXPECT_TRUE(ofu()->PathExists(context.get(), path)); |
exclusive = true; |
recursive = false; |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestReadDirectory) { |
+TEST_F(ObfuscatedFileUtilTest, TestReadDirectory) { |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
bool exclusive = true; |
bool recursive = true; |
FilePath path = UTF8ToFilePath("directory/to/use"); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
TestReadDirectoryHelper(path); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestReadRootWithSlash) { |
+TEST_F(ObfuscatedFileUtilTest, TestReadRootWithSlash) { |
TestReadDirectoryHelper(UTF8ToFilePath("")); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestReadRootWithEmptyString) { |
+TEST_F(ObfuscatedFileUtilTest, TestReadRootWithEmptyString) { |
TestReadDirectoryHelper(UTF8ToFilePath("/")); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestReadDirectoryOnFile) { |
+TEST_F(ObfuscatedFileUtilTest, TestReadDirectoryOnFile) { |
FilePath path = UTF8ToFilePath("file"); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
bool created = false; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), path, &created)); |
+ ofu()->EnsureFileExists(context.get(), path, &created)); |
ASSERT_TRUE(created); |
context.reset(NewContext()); |
std::vector<base::FileUtilProxy::Entry> entries; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->ReadDirectory(context.get(), path, &entries)); |
+ ofu()->ReadDirectory(context.get(), path, &entries)); |
- EXPECT_TRUE(ofsfu()->IsDirectoryEmpty(context.get(), path)); |
+ EXPECT_TRUE(ofu()->IsDirectoryEmpty(context.get(), path)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestTouch) { |
+TEST_F(ObfuscatedFileUtilTest, TestTouch) { |
FilePath path = UTF8ToFilePath("fake/file"); |
base::Time last_access_time = base::Time::Now(); // Ignored, so not tested. |
base::Time last_modified_time = base::Time::Now(); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->Touch( |
+ ofu()->Touch( |
context.get(), path, last_access_time, last_modified_time)); |
// Touch will create a file if it's not there but its parent is. |
@@ -713,43 +713,43 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestTouch) { |
bool recursive = true; |
path = UTF8ToFilePath("directory/to/use"); |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), path, exclusive, recursive)); |
TestTouchHelper(path); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestCopyOrMoveFileNotFound) { |
+TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileNotFound) { |
FilePath source_path = UTF8ToFilePath("path0.txt"); |
FilePath dest_path = UTF8ToFilePath("path1.txt"); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
bool is_copy_not_move = false; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
+ ofu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
is_copy_not_move)); |
context.reset(NewContext()); |
is_copy_not_move = true; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
+ ofu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
is_copy_not_move)); |
source_path = UTF8ToFilePath("dir/dir/file"); |
bool exclusive = true; |
bool recursive = true; |
context.reset(NewContext()); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), source_path.DirName(), exclusive, recursive)); |
is_copy_not_move = false; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
+ ofu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
is_copy_not_move)); |
context.reset(NewContext()); |
is_copy_not_move = true; |
EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
- ofsfu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
+ ofu()->CopyOrMoveFile(context.get(), source_path, dest_path, |
is_copy_not_move)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestCopyOrMoveFileSuccess) { |
+TEST_F(ObfuscatedFileUtilTest, TestCopyOrMoveFileSuccess) { |
const int64 kSourceLength = 5; |
const int64 kDestLength = 50; |
@@ -772,73 +772,73 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestCopyOrMoveFileSuccess) { |
FilePath dest_path = UTF8ToFilePath(test_case.dest_path); |
context.reset(NewContext()); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), source_path.DirName(), exclusive, recursive)); |
context.reset(NewContext()); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), dest_path.DirName(), exclusive, recursive)); |
bool created = false; |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), source_path, &created)); |
+ ofu()->EnsureFileExists(context.get(), source_path, &created)); |
ASSERT_TRUE(created); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Truncate(context.get(), source_path, kSourceLength)); |
+ ofu()->Truncate(context.get(), source_path, kSourceLength)); |
if (test_case.cause_overwrite) { |
context.reset(NewContext()); |
created = false; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), dest_path, &created)); |
+ ofu()->EnsureFileExists(context.get(), dest_path, &created)); |
ASSERT_TRUE(created); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Truncate(context.get(), dest_path, kDestLength)); |
+ ofu()->Truncate(context.get(), dest_path, kDestLength)); |
} |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CopyOrMoveFile(context.get(), |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->CopyOrMoveFile(context.get(), |
source_path, dest_path, test_case.is_copy_not_move)); |
if (test_case.is_copy_not_move) { |
base::PlatformFileInfo file_info; |
FilePath local_path; |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), source_path, &file_info, &local_path)); |
EXPECT_EQ(kSourceLength, file_info.size); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteFile(context.get(), source_path)); |
+ ofu()->DeleteFile(context.get(), source_path)); |
} else { |
base::PlatformFileInfo file_info; |
FilePath local_path; |
context.reset(NewContext()); |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, ofu()->GetFileInfo( |
context.get(), source_path, &file_info, &local_path)); |
} |
base::PlatformFileInfo file_info; |
FilePath local_path; |
- EXPECT_EQ(base::PLATFORM_FILE_OK, ofsfu()->GetFileInfo( |
+ EXPECT_EQ(base::PLATFORM_FILE_OK, ofu()->GetFileInfo( |
context.get(), dest_path, &file_info, &local_path)); |
EXPECT_EQ(kSourceLength, file_info.size); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->DeleteFile(context.get(), dest_path)); |
+ ofu()->DeleteFile(context.get(), dest_path)); |
} |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestCopyInForeignFile) { |
+TEST_F(ObfuscatedFileUtilTest, TestCopyInForeignFile) { |
TestCopyInForeignFileHelper(false /* overwrite */); |
TestCopyInForeignFileHelper(true /* overwrite */); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestEnumerator) { |
+TEST_F(ObfuscatedFileUtilTest, TestEnumerator) { |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
FilePath src_path = UTF8ToFilePath("source dir"); |
bool exclusive = true; |
bool recursive = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, ofsfu()->CreateDirectory( |
+ ASSERT_EQ(base::PLATFORM_FILE_OK, ofu()->CreateDirectory( |
context.get(), src_path, exclusive, recursive)); |
std::set<FilePath::StringType> files; |
@@ -848,25 +848,25 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestEnumerator) { |
FilePath dest_path = UTF8ToFilePath("destination dir"); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), dest_path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), dest_path)); |
context.reset(NewContext()); |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Copy(context.get(), src_path, dest_path)); |
+ ofu()->Copy(context.get(), src_path, dest_path)); |
ValidateTestDirectory(dest_path, files, directories); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), src_path)); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), src_path)); |
context.reset(NewContext()); |
- EXPECT_TRUE(ofsfu()->DirectoryExists(context.get(), dest_path)); |
+ EXPECT_TRUE(ofu()->DirectoryExists(context.get(), dest_path)); |
context.reset(NewContext()); |
recursive = true; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->Delete(context.get(), dest_path, recursive)); |
+ ofu()->Delete(context.get(), dest_path, recursive)); |
context.reset(NewContext()); |
- EXPECT_FALSE(ofsfu()->DirectoryExists(context.get(), dest_path)); |
+ EXPECT_FALSE(ofu()->DirectoryExists(context.get(), dest_path)); |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestMigration) { |
+TEST_F(ObfuscatedFileUtilTest, TestMigration) { |
ScopedTempDir source_dir; |
ASSERT_TRUE(source_dir.CreateUniqueTempDir()); |
FilePath root_path = source_dir.path().AppendASCII("chrome-pLmnMWXE7NzTFRsn"); |
@@ -895,11 +895,11 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestMigration) { |
} |
} |
- EXPECT_TRUE(ofsfu()->MigrateFromOldSandbox(origin_url(), type(), root_path)); |
+ EXPECT_TRUE(ofu()->MigrateFromOldSandbox(origin_url(), type(), root_path)); |
FilePath new_root = |
test_directory().AppendASCII("000").Append( |
- ofsfu()->GetDirectoryNameForType(type())).AppendASCII("Legacy"); |
+ ofu()->GetDirectoryNameForType(type())).AppendASCII("Legacy"); |
for (size_t i = 0; i < arraysize(kMigrationTestCases); ++i) { |
SCOPED_TRACE(testing::Message() << "Validating kMigrationTestPath " << i); |
const MigrationTestCaseRecord& test_case = kMigrationTestCases[i]; |
@@ -908,14 +908,14 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestMigration) { |
local_data_path = local_data_path.NormalizeWindowsPathSeparators(); |
#endif |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
- base::PlatformFileInfo ofsfu_file_info; |
+ base::PlatformFileInfo ofu_file_info; |
FilePath data_path; |
SCOPED_TRACE(testing::Message() << "Path is " << test_case.path); |
EXPECT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->GetFileInfo(context.get(), FilePath(test_case.path), |
- &ofsfu_file_info, &data_path)); |
+ ofu()->GetFileInfo(context.get(), FilePath(test_case.path), |
+ &ofu_file_info, &data_path)); |
if (test_case.is_directory) { |
- EXPECT_TRUE(ofsfu_file_info.is_directory); |
+ EXPECT_TRUE(ofu_file_info.is_directory); |
} else { |
base::PlatformFileInfo platform_file_info; |
SCOPED_TRACE(testing::Message() << "local_data_path is " << |
@@ -926,15 +926,15 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestMigration) { |
EXPECT_FALSE(platform_file_info.is_directory); |
scoped_ptr<FileSystemOperationContext> context(NewContext()); |
EXPECT_EQ(local_data_path, data_path); |
- EXPECT_EQ(platform_file_info.size, ofsfu_file_info.size); |
- EXPECT_FALSE(ofsfu_file_info.is_directory); |
+ EXPECT_EQ(platform_file_info.size, ofu_file_info.size); |
+ EXPECT_FALSE(ofu_file_info.is_directory); |
} |
} |
} |
-TEST_F(ObfuscatedFileSystemFileUtilTest, TestOriginEnumerator) { |
- scoped_ptr<ObfuscatedFileSystemFileUtil::AbstractOriginEnumerator> |
- enumerator(ofsfu()->CreateOriginEnumerator()); |
+TEST_F(ObfuscatedFileUtilTest, TestOriginEnumerator) { |
+ scoped_ptr<ObfuscatedFileUtil::AbstractOriginEnumerator> |
+ enumerator(ofu()->CreateOriginEnumerator()); |
EXPECT_TRUE(enumerator.get()); |
EXPECT_EQ(GURL(), enumerator->Next()); |
EXPECT_FALSE(enumerator->HasFileSystemType(kFileSystemTypeTemporary)); |
@@ -955,7 +955,7 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestOriginEnumerator) { |
context->set_src_type(kFileSystemTypeTemporary); |
bool created = false; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), |
+ ofu()->EnsureFileExists(context.get(), |
FilePath().AppendASCII("file"), &created)); |
EXPECT_TRUE(created); |
} |
@@ -965,12 +965,12 @@ TEST_F(ObfuscatedFileSystemFileUtilTest, TestOriginEnumerator) { |
context->set_src_type(kFileSystemTypePersistent); |
bool created = false; |
ASSERT_EQ(base::PLATFORM_FILE_OK, |
- ofsfu()->EnsureFileExists(context.get(), |
+ ofu()->EnsureFileExists(context.get(), |
FilePath().AppendASCII("file"), &created)); |
EXPECT_TRUE(created); |
} |
} |
- enumerator.reset(ofsfu()->CreateOriginEnumerator()); |
+ enumerator.reset(ofu()->CreateOriginEnumerator()); |
EXPECT_TRUE(enumerator.get()); |
std::set<GURL> origins_found; |
GURL origin; |