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

Unified Diff: base/files/file_util_proxy_unittest.cc

Issue 145303002: Convert Media Galleries to use base::File (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 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
Index: base/files/file_util_proxy_unittest.cc
diff --git a/base/files/file_util_proxy_unittest.cc b/base/files/file_util_proxy_unittest.cc
index d01d56db824ac02b7197e03170fcf6af45d325c8..30c77d39884c3ce82004bc78e6a9871f62f08936 100644
--- a/base/files/file_util_proxy_unittest.cc
+++ b/base/files/file_util_proxy_unittest.cc
@@ -22,7 +22,7 @@ class FileUtilProxyTest : public testing::Test {
public:
FileUtilProxyTest()
: file_thread_("FileUtilProxyTestFileThread"),
- error_(PLATFORM_FILE_OK),
+ error_(File::FILE_OK),
created_(false),
file_(kInvalidPlatformFileValue),
bytes_written_(-1),
@@ -38,12 +38,12 @@ class FileUtilProxyTest : public testing::Test {
ClosePlatformFile(file_);
}
- void DidFinish(PlatformFileError error) {
+ void DidFinish(File::Error error) {
error_ = error;
MessageLoop::current()->QuitWhenIdle();
}
- void DidCreateOrOpen(PlatformFileError error,
+ void DidCreateOrOpen(File::Error error,
PassPlatformFile file,
bool created) {
error_ = error;
@@ -52,7 +52,7 @@ class FileUtilProxyTest : public testing::Test {
MessageLoop::current()->QuitWhenIdle();
}
- void DidCreateTemporary(PlatformFileError error,
+ void DidCreateTemporary(File::Error error,
PassPlatformFile file,
const FilePath& path) {
error_ = error;
@@ -61,14 +61,14 @@ class FileUtilProxyTest : public testing::Test {
MessageLoop::current()->QuitWhenIdle();
}
- void DidGetFileInfo(PlatformFileError error,
- const PlatformFileInfo& file_info) {
+ void DidGetFileInfo(File::Error error,
+ const File::Info& file_info) {
error_ = error;
file_info_ = file_info;
MessageLoop::current()->QuitWhenIdle();
}
- void DidRead(PlatformFileError error,
+ void DidRead(File::Error error,
const char* data,
int bytes_read) {
error_ = error;
@@ -77,7 +77,7 @@ class FileUtilProxyTest : public testing::Test {
MessageLoop::current()->QuitWhenIdle();
}
- void DidWrite(PlatformFileError error,
+ void DidWrite(File::Error error,
int bytes_written) {
error_ = error;
bytes_written_ = bytes_written;
@@ -106,11 +106,11 @@ class FileUtilProxyTest : public testing::Test {
Thread file_thread_;
ScopedTempDir dir_;
- PlatformFileError error_;
+ File::Error error_;
bool created_;
PlatformFile file_;
FilePath path_;
- PlatformFileInfo file_info_;
+ File::Info file_info_;
std::vector<char> buffer_;
int bytes_written_;
WeakPtrFactory<FileUtilProxyTest> weak_factory_;
@@ -124,7 +124,7 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_Create) {
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(created_);
EXPECT_NE(kInvalidPlatformFileValue, file_);
EXPECT_TRUE(PathExists(test_path()));
@@ -143,7 +143,7 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_Open) {
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_FALSE(created_);
EXPECT_NE(kInvalidPlatformFileValue, file_);
}
@@ -155,7 +155,7 @@ TEST_F(FileUtilProxyTest, CreateOrOpen_OpenNonExistent) {
PLATFORM_FILE_OPEN | PLATFORM_FILE_READ,
Bind(&FileUtilProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_ERROR_NOT_FOUND, error_);
+ EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, error_);
EXPECT_FALSE(created_);
EXPECT_EQ(kInvalidPlatformFileValue, file_);
EXPECT_FALSE(PathExists(test_path()));
@@ -177,7 +177,7 @@ TEST_F(FileUtilProxyTest, Close) {
file,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
// Now it should pass on all platforms.
EXPECT_TRUE(base::Move(test_path(), test_dir_path().AppendASCII("new")));
@@ -188,7 +188,7 @@ TEST_F(FileUtilProxyTest, CreateTemporary) {
file_task_runner(), 0 /* additional_file_flags */,
Bind(&FileUtilProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_TRUE(PathExists(path_));
EXPECT_NE(kInvalidPlatformFileValue, file_);
@@ -235,7 +235,7 @@ TEST_F(FileUtilProxyTest, GetFileInfo_File) {
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_info.size, file_info_.size);
EXPECT_EQ(expected_info.is_directory, file_info_.is_directory);
EXPECT_EQ(expected_info.is_symbolic_link, file_info_.is_symbolic_link);
@@ -258,7 +258,7 @@ TEST_F(FileUtilProxyTest, GetFileInfo_Directory) {
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_info.size, file_info_.size);
EXPECT_EQ(expected_info.is_directory, file_info_.is_directory);
EXPECT_EQ(expected_info.is_symbolic_link, file_info_.is_symbolic_link);
@@ -284,7 +284,7 @@ TEST_F(FileUtilProxyTest, Read) {
MessageLoop::current()->Run();
// Verify.
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(expected_bytes, static_cast<int>(buffer_.size()));
for (size_t i = 0; i < buffer_.size(); ++i) {
EXPECT_EQ(expected_data[i], buffer_[i]);
@@ -305,7 +305,7 @@ TEST_F(FileUtilProxyTest, WriteAndFlush) {
data_bytes,
Bind(&FileUtilProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(data_bytes, bytes_written_);
// Flush the written data. (So that the following read should always
@@ -315,7 +315,7 @@ TEST_F(FileUtilProxyTest, WriteAndFlush) {
file,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
// Verify the written data.
char buffer[10];
@@ -338,7 +338,7 @@ TEST_F(FileUtilProxyTest, Touch) {
last_modified_time,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
MessageLoop::current()->Run();
- EXPECT_EQ(PLATFORM_FILE_OK, error_);
+ EXPECT_EQ(File::FILE_OK, error_);
File::Info info;
GetFileInfo(test_path(), &info);
« no previous file with comments | « base/files/file_util_proxy.cc ('k') | chrome/browser/browsing_data/browsing_data_file_system_helper_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698