Index: webkit/browser/fileapi/native_file_util_unittest.cc |
diff --git a/webkit/browser/fileapi/native_file_util_unittest.cc b/webkit/browser/fileapi/native_file_util_unittest.cc |
index 587bf9a6bf95a08ccd3ab585b81200d0943212d9..cdf088ff37a83767f941cc87285ba79b3ad55d03 100644 |
--- a/webkit/browser/fileapi/native_file_util_unittest.cc |
+++ b/webkit/browser/fileapi/native_file_util_unittest.cc |
@@ -52,7 +52,7 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { |
base::PlatformFile file_handle; |
bool created = false; |
int flags = base::PLATFORM_FILE_WRITE | base::PLATFORM_FILE_ASYNC; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateOrOpen(file_name, |
base::PLATFORM_FILE_CREATE | flags, |
&file_handle, &created)); |
@@ -63,16 +63,16 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { |
EXPECT_EQ(0, GetSize(file_name)); |
EXPECT_NE(base::kInvalidPlatformFileValue, file_handle); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Close(file_handle)); |
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Close(file_handle)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateOrOpen(file_name, |
base::PLATFORM_FILE_OPEN | flags, |
&file_handle, &created)); |
ASSERT_FALSE(created); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Close(file_handle)); |
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Close(file_handle)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::DeleteFile(file_name)); |
EXPECT_FALSE(base::PathExists(file_name)); |
EXPECT_FALSE(NativeFileUtil::PathExists(file_name)); |
@@ -81,21 +81,21 @@ TEST_F(NativeFileUtilTest, CreateCloseAndDeleteFile) { |
TEST_F(NativeFileUtilTest, EnsureFileExists) { |
base::FilePath file_name = Path("foobar"); |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(file_name, &created)); |
ASSERT_TRUE(created); |
EXPECT_TRUE(FileExists(file_name)); |
EXPECT_EQ(0, GetSize(file_name)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(file_name, &created)); |
EXPECT_FALSE(created); |
} |
TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { |
base::FilePath dir_name = Path("test_dir"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateDirectory(dir_name, |
false /* exclusive */, |
false /* recursive */)); |
@@ -103,12 +103,12 @@ TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { |
EXPECT_TRUE(NativeFileUtil::DirectoryExists(dir_name)); |
EXPECT_TRUE(base::DirectoryExists(dir_name)); |
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, |
+ ASSERT_EQ(base::File::FILE_ERROR_EXISTS, |
NativeFileUtil::CreateDirectory(dir_name, |
true /* exclusive */, |
false /* recursive */)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::DeleteDirectory(dir_name)); |
EXPECT_FALSE(base::DirectoryExists(dir_name)); |
EXPECT_FALSE(NativeFileUtil::DirectoryExists(dir_name)); |
@@ -116,18 +116,18 @@ TEST_F(NativeFileUtilTest, CreateAndDeleteDirectory) { |
TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { |
base::FilePath file_name = Path("test_file"); |
- base::PlatformFileInfo native_info; |
- ASSERT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ base::File::Info native_info; |
+ ASSERT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::GetFileInfo(file_name, &native_info)); |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(file_name, &created)); |
ASSERT_TRUE(created); |
base::File::Info info; |
ASSERT_TRUE(base::GetFileInfo(file_name, &info)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::GetFileInfo(file_name, &native_info)); |
ASSERT_EQ(info.size, native_info.size); |
ASSERT_EQ(info.is_directory, native_info.is_directory); |
@@ -141,7 +141,7 @@ TEST_F(NativeFileUtilTest, TouchFileAndGetFileInfo) { |
const base::Time new_modified = |
info.last_modified + base::TimeDelta::FromHours(5); |
- EXPECT_EQ(base::PLATFORM_FILE_OK, |
+ EXPECT_EQ(base::File::FILE_OK, |
NativeFileUtil::Touch(file_name, |
new_accessed, new_modified)); |
@@ -157,16 +157,16 @@ TEST_F(NativeFileUtilTest, CreateFileEnumerator) { |
base::FilePath path_12 = Path("dir1").AppendASCII("dir12"); |
base::FilePath path_121 = |
Path("dir1").AppendASCII("dir12").AppendASCII("file121"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateDirectory(path_1, false, false)); |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(path_2, &created)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(path_11, &created)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateDirectory(path_12, false, false)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(path_121, &created)); |
{ |
@@ -200,11 +200,11 @@ TEST_F(NativeFileUtilTest, CreateFileEnumerator) { |
TEST_F(NativeFileUtilTest, Truncate) { |
base::FilePath file_name = Path("truncated"); |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(file_name, &created)); |
ASSERT_TRUE(created); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::Truncate(file_name, 1020)); |
EXPECT_TRUE(FileExists(file_name)); |
@@ -218,21 +218,21 @@ TEST_F(NativeFileUtilTest, CopyFile) { |
const NativeFileUtil::CopyOrMoveMode nosync = NativeFileUtil::COPY_NOSYNC; |
const NativeFileUtil::CopyOrMoveMode sync = NativeFileUtil::COPY_SYNC; |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(created); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::Truncate(from_file, 1020)); |
EXPECT_TRUE(FileExists(from_file)); |
EXPECT_EQ(1020, GetSize(from_file)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file1, FileSystemOperation::OPTION_NONE, nosync)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file2, FileSystemOperation::OPTION_NONE, sync)); |
@@ -244,11 +244,11 @@ TEST_F(NativeFileUtilTest, CopyFile) { |
EXPECT_EQ(1020, GetSize(to_file2)); |
base::FilePath dir = Path("dir"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateDirectory(dir, false, false)); |
ASSERT_TRUE(base::DirectoryExists(dir)); |
base::FilePath to_dir_file = dir.AppendASCII("file"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_dir_file, |
FileSystemOperation::OPTION_NONE, nosync)); |
@@ -257,26 +257,26 @@ TEST_F(NativeFileUtilTest, CopyFile) { |
// Following tests are error checking. |
// Source doesn't exist. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
Path("nonexists"), Path("file"), |
FileSystemOperation::OPTION_NONE, nosync)); |
// Source is not a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE, |
NativeFileUtil::CopyOrMoveFile( |
dir, Path("file"), FileSystemOperation::OPTION_NONE, nosync)); |
// Destination is not a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, |
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, |
NativeFileUtil::CopyOrMoveFile( |
from_file, dir, FileSystemOperation::OPTION_NONE, nosync)); |
// Destination's parent doesn't exist. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
from_file, Path("nodir").AppendASCII("file"), |
FileSystemOperation::OPTION_NONE, nosync)); |
// Destination's parent is a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
from_file, Path("tofile1").AppendASCII("file"), |
FileSystemOperation::OPTION_NONE, nosync)); |
@@ -287,16 +287,16 @@ TEST_F(NativeFileUtilTest, MoveFile) { |
base::FilePath to_file = Path("tofile"); |
const NativeFileUtil::CopyOrMoveMode move = NativeFileUtil::MOVE; |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(created); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Truncate(from_file, 1020)); |
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(from_file, 1020)); |
EXPECT_TRUE(FileExists(from_file)); |
EXPECT_EQ(1020, GetSize(from_file)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file, FileSystemOperation::OPTION_NONE, move)); |
@@ -304,17 +304,17 @@ TEST_F(NativeFileUtilTest, MoveFile) { |
EXPECT_TRUE(FileExists(to_file)); |
EXPECT_EQ(1020, GetSize(to_file)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(FileExists(from_file)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, NativeFileUtil::Truncate(from_file, 1020)); |
+ ASSERT_EQ(base::File::FILE_OK, NativeFileUtil::Truncate(from_file, 1020)); |
base::FilePath dir = Path("dir"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CreateDirectory(dir, false, false)); |
ASSERT_TRUE(base::DirectoryExists(dir)); |
base::FilePath to_dir_file = dir.AppendASCII("file"); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_dir_file, |
FileSystemOperation::OPTION_NONE, move)); |
@@ -324,33 +324,33 @@ TEST_F(NativeFileUtilTest, MoveFile) { |
// Following is error checking. |
// Source doesn't exist. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
Path("nonexists"), Path("file"), |
FileSystemOperation::OPTION_NONE, move)); |
// Source is not a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_A_FILE, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_A_FILE, |
NativeFileUtil::CopyOrMoveFile( |
dir, Path("file"), FileSystemOperation::OPTION_NONE, move)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(FileExists(from_file)); |
// Destination is not a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_INVALID_OPERATION, |
+ EXPECT_EQ(base::File::FILE_ERROR_INVALID_OPERATION, |
NativeFileUtil::CopyOrMoveFile( |
from_file, dir, FileSystemOperation::OPTION_NONE, move)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(FileExists(from_file)); |
// Destination's parent doesn't exist. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
from_file, Path("nodir").AppendASCII("file"), |
FileSystemOperation::OPTION_NONE, move)); |
// Destination's parent is a file. |
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NOT_FOUND, |
+ EXPECT_EQ(base::File::FILE_ERROR_NOT_FOUND, |
NativeFileUtil::CopyOrMoveFile( |
from_file, Path("tofile1").AppendASCII("file"), |
FileSystemOperation::OPTION_NONE, move)); |
@@ -362,49 +362,49 @@ TEST_F(NativeFileUtilTest, PreserveLastModified) { |
base::FilePath to_file2 = Path("tofile2"); |
base::FilePath to_file3 = Path("tofile3"); |
bool created = false; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::EnsureFileExists(from_file, &created)); |
ASSERT_TRUE(created); |
EXPECT_TRUE(FileExists(from_file)); |
- base::PlatformFileInfo file_info1; |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ base::File::Info file_info1; |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::GetFileInfo(from_file, &file_info1)); |
// Test for copy (nosync). |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file1, |
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, |
NativeFileUtil::COPY_NOSYNC)); |
- base::PlatformFileInfo file_info2; |
+ base::File::Info file_info2; |
ASSERT_TRUE(FileExists(to_file1)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::GetFileInfo(to_file1, &file_info2)); |
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); |
// Test for copy (sync). |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file2, |
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, |
NativeFileUtil::COPY_SYNC)); |
ASSERT_TRUE(FileExists(to_file2)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::GetFileInfo(to_file1, &file_info2)); |
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); |
// Test for move. |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::CopyOrMoveFile( |
from_file, to_file3, |
FileSystemOperation::OPTION_PRESERVE_LAST_MODIFIED, |
NativeFileUtil::MOVE)); |
ASSERT_TRUE(FileExists(to_file3)); |
- ASSERT_EQ(base::PLATFORM_FILE_OK, |
+ ASSERT_EQ(base::File::FILE_OK, |
NativeFileUtil::GetFileInfo(to_file2, &file_info2)); |
EXPECT_EQ(file_info1.last_modified, file_info2.last_modified); |
} |