Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(430)

Unified Diff: components/filesystem/directory_impl_unittest.cc

Issue 1166763002: Reland "Mandoline filesystem: Build the filesystem on windows." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DWORD -> INT for real checking. (This was wrong.) Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/filesystem/directory_impl.cc ('k') | components/filesystem/file_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/filesystem/directory_impl_unittest.cc
diff --git a/components/filesystem/directory_impl_unittest.cc b/components/filesystem/directory_impl_unittest.cc
index 34cda903d400301068b9fbf68cfcf7f5f61f5291..f7058d45031dacb25712ea13a26a8b4123ac975e 100644
--- a/components/filesystem/directory_impl_unittest.cc
+++ b/components/filesystem/directory_impl_unittest.cc
@@ -15,7 +15,7 @@ using DirectoryImplTest = FilesTestBase;
TEST_F(DirectoryImplTest, Read) {
DirectoryPtr directory;
GetTemporaryRoot(&directory);
- Error error;
+ FileError error;
// Make some files.
const struct {
@@ -27,32 +27,32 @@ TEST_F(DirectoryImplTest, Read) {
{"my_file3", kFlagWrite | kFlagCreate | kFlagAppend},
{"my_file4", kFlagWrite | kFlagCreate}};
for (size_t i = 0; i < arraysize(files_to_create); i++) {
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile(files_to_create[i].name, nullptr,
files_to_create[i].open_flags, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
}
// Make a directory.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenDirectory(
"my_dir", nullptr, kFlagRead | kFlagWrite | kFlagCreate, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
mojo::Array<DirectoryEntryPtr> directory_contents;
directory->Read(Capture(&error, &directory_contents));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Expected contents of the directory.
- std::map<std::string, FileType> expected_contents;
- expected_contents["my_file1"] = FILE_TYPE_REGULAR_FILE;
- expected_contents["my_file2"] = FILE_TYPE_REGULAR_FILE;
- expected_contents["my_file3"] = FILE_TYPE_REGULAR_FILE;
- expected_contents["my_file4"] = FILE_TYPE_REGULAR_FILE;
- expected_contents["my_dir"] = FILE_TYPE_DIRECTORY;
+ std::map<std::string, FsFileType> expected_contents;
+ expected_contents["my_file1"] = FS_FILE_TYPE_REGULAR_FILE;
+ expected_contents["my_file2"] = FS_FILE_TYPE_REGULAR_FILE;
+ expected_contents["my_file3"] = FS_FILE_TYPE_REGULAR_FILE;
+ expected_contents["my_file4"] = FS_FILE_TYPE_REGULAR_FILE;
+ expected_contents["my_dir"] = FS_FILE_TYPE_DIRECTORY;
// Note: We don't expose ".." or ".".
EXPECT_EQ(expected_contents.size(), directory_contents.size());
@@ -71,80 +71,80 @@ TEST_F(DirectoryImplTest, Read) {
TEST_F(DirectoryImplTest, BasicRenameDelete) {
DirectoryPtr directory;
GetTemporaryRoot(&directory);
- Error error;
+ FileError error;
// Create my_file.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_file", nullptr, kFlagWrite | kFlagCreate,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Opening my_file should succeed.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Rename my_file to my_new_file.
directory->Rename("my_file", "my_new_file", Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Opening my_file should fail.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_FAILED, error);
+ EXPECT_EQ(FILE_ERROR_FAILED, error);
// Opening my_new_file should succeed.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Delete my_new_file (no flags).
directory->Delete("my_new_file", 0, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
// Opening my_new_file should fail.
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_FAILED, error);
+ EXPECT_EQ(FILE_ERROR_FAILED, error);
}
TEST_F(DirectoryImplTest, CantOpenDirectoriesAsFiles) {
DirectoryPtr directory;
GetTemporaryRoot(&directory);
- Error error;
+ FileError error;
{
// Create a directory called 'my_file'
DirectoryPtr my_file_directory;
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenDirectory(
"my_file", GetProxy(&my_file_directory),
kFlagRead | kFlagWrite | kFlagCreate,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_OK, error);
+ EXPECT_EQ(FILE_ERROR_OK, error);
}
{
// Attempt to open that directory as a file. This must fail!
FilePtr file;
- error = ERROR_FAILED;
+ error = FILE_ERROR_FAILED;
directory->OpenFile("my_file", GetProxy(&file), kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(ERROR_NOT_A_FILE, error);
+ EXPECT_EQ(FILE_ERROR_NOT_A_FILE, error);
}
}
« no previous file with comments | « components/filesystem/directory_impl.cc ('k') | components/filesystem/file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698