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

Unified Diff: components/filesystem/directory_impl_unittest.cc

Issue 1527183003: Change mojo enums to be scoped enums in the generated C++ bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-binding-equals
Patch Set: rebase Created 4 years, 11 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 53fc2b77667cae4e230218baeeb4b900db8933ed..a5638b75a3fb591928b724d9dd793688d098f699 100644
--- a/components/filesystem/directory_impl_unittest.cc
+++ b/components/filesystem/directory_impl_unittest.cc
@@ -33,31 +33,31 @@ TEST_F(DirectoryImplTest, Read) {
{"my_file2", kFlagWrite | kFlagCreate},
{"my_file3", kFlagAppend | kFlagCreate }};
for (size_t i = 0; i < arraysize(files_to_create); i++) {
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile(files_to_create[i].name, nullptr,
files_to_create[i].open_flags, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
}
// Make a directory.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenDirectory(
"my_dir", nullptr, kFlagRead | kFlagWrite | kFlagCreate, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
mojo::Array<DirectoryEntryPtr> directory_contents;
directory->Read(Capture(&error, &directory_contents));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Expected contents of the 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_dir"] = FS_FILE_TYPE_DIRECTORY;
+ expected_contents["my_file1"] = FsFileType::REGULAR_FILE;
+ expected_contents["my_file2"] = FsFileType::REGULAR_FILE;
+ expected_contents["my_file3"] = FsFileType::REGULAR_FILE;
+ expected_contents["my_dir"] = FsFileType::DIRECTORY;
// Note: We don't expose ".." or ".".
EXPECT_EQ(expected_contents.size(), directory_contents.size());
@@ -79,50 +79,50 @@ TEST_F(DirectoryImplTest, BasicRenameDelete) {
FileError error;
// Create my_file.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_file", nullptr, kFlagWrite | kFlagCreate,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Opening my_file should succeed.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Rename my_file to my_new_file.
directory->Rename("my_file", "my_new_file", Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Opening my_file should fail.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_FAILED, error);
+ EXPECT_EQ(FileError::FAILED, error);
// Opening my_new_file should succeed.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Delete my_new_file (no flags).
directory->Delete("my_new_file", 0, Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
// Opening my_new_file should fail.
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_new_file", nullptr, kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_FAILED, error);
+ EXPECT_EQ(FileError::FAILED, error);
}
TEST_F(DirectoryImplTest, CantOpenDirectoriesAsFiles) {
@@ -133,23 +133,23 @@ TEST_F(DirectoryImplTest, CantOpenDirectoriesAsFiles) {
{
// Create a directory called 'my_file'
DirectoryPtr my_file_directory;
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenDirectory(
"my_file", GetProxy(&my_file_directory),
kFlagRead | kFlagWrite | kFlagCreate,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_OK, error);
+ EXPECT_EQ(FileError::OK, error);
}
{
// Attempt to open that directory as a file. This must fail!
FilePtr file;
- error = FILE_ERROR_FAILED;
+ error = FileError::FAILED;
directory->OpenFile("my_file", GetProxy(&file), kFlagRead | kFlagOpen,
Capture(&error));
ASSERT_TRUE(directory.WaitForIncomingResponse());
- EXPECT_EQ(FILE_ERROR_NOT_A_FILE, error);
+ EXPECT_EQ(FileError::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