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

Unified Diff: content/browser/fileapi/file_writer_delegate_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: content/browser/fileapi/file_writer_delegate_unittest.cc
diff --git a/content/browser/fileapi/file_writer_delegate_unittest.cc b/content/browser/fileapi/file_writer_delegate_unittest.cc
index 08e720f84bea3f421e0f24008436f2eb99e8c894..2a02f8f7460d62415532df22d7d9756822ebb6ef 100644
--- a/content/browser/fileapi/file_writer_delegate_unittest.cc
+++ b/content/browser/fileapi/file_writer_delegate_unittest.cc
@@ -43,25 +43,25 @@ const int kDataSize = ARRAYSIZE_UNSAFE(kData) - 1;
class Result {
public:
Result()
- : status_(base::PLATFORM_FILE_OK),
+ : status_(base::File::FILE_OK),
bytes_written_(0),
write_status_(FileWriterDelegate::SUCCESS_IO_PENDING) {}
- base::PlatformFileError status() const { return status_; }
+ base::File::Error status() const { return status_; }
int64 bytes_written() const { return bytes_written_; }
FileWriterDelegate::WriteProgressStatus write_status() const {
return write_status_;
}
- void DidWrite(base::PlatformFileError status, int64 bytes,
+ void DidWrite(base::File::Error status, int64 bytes,
FileWriterDelegate::WriteProgressStatus write_status) {
write_status_ = write_status;
- if (status == base::PLATFORM_FILE_OK) {
+ if (status == base::File::FILE_OK) {
bytes_written_ += bytes;
if (write_status_ != FileWriterDelegate::SUCCESS_IO_PENDING)
base::MessageLoop::current()->Quit();
} else {
- EXPECT_EQ(base::PLATFORM_FILE_OK, status_);
+ EXPECT_EQ(base::File::FILE_OK, status_);
status_ = status;
base::MessageLoop::current()->Quit();
}
@@ -69,7 +69,7 @@ class Result {
private:
// For post-operation status.
- base::PlatformFileError status_;
+ base::File::Error status_;
int64 bytes_written_;
FileWriterDelegate::WriteProgressStatus write_status_;
};
@@ -97,8 +97,8 @@ class FileWriterDelegateTest : public PlatformTest {
base::RunLoop().RunUntilIdle();
FileSystemURL url = GetFileSystemURL(test_file_path);
- base::PlatformFileInfo file_info;
- EXPECT_EQ(base::PLATFORM_FILE_OK,
+ base::File::Info file_info;
+ EXPECT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::GetMetadata(
file_system_context_, url, &file_info));
return file_info.size;
@@ -223,7 +223,7 @@ void FileWriterDelegateTest::SetUp() {
file_system_context_ = CreateFileSystemContextForTesting(
NULL, dir_.path());
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(
file_system_context_, GetFileSystemURL("test")));
net::URLRequest::Deprecated::RegisterProtocolFactory("blob", &Factory);
@@ -252,7 +252,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimit) {
ASSERT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
TEST_F(FileWriterDelegateTest, WriteSuccessWithJustQuota) {
@@ -272,7 +272,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithJustQuota) {
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
TEST_F(FileWriterDelegateTest, DISABLED_WriteFailureByQuota) {
@@ -292,7 +292,7 @@ TEST_F(FileWriterDelegateTest, DISABLED_WriteFailureByQuota) {
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
ASSERT_EQ(FileWriterDelegate::ERROR_WRITE_STARTED, result.write_status());
}
@@ -313,7 +313,7 @@ TEST_F(FileWriterDelegateTest, WriteZeroBytesSuccessfullyWithZeroQuota) {
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kAllowedGrowth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status());
}
@@ -321,7 +321,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimitConcurrent) {
scoped_ptr<FileWriterDelegate> file_writer_delegate2;
scoped_ptr<net::URLRequest> request2;
- ASSERT_EQ(base::PLATFORM_FILE_OK,
+ ASSERT_EQ(base::File::FILE_OK,
AsyncFileTestHelper::CreateFile(
file_system_context_, GetFileSystemURL("test2")));
@@ -354,9 +354,9 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimitConcurrent) {
EXPECT_EQ(GetFileSizeOnDisk("test") + GetFileSizeOnDisk("test2"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
EXPECT_EQ(kDataSize, result2.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result2.status());
+ EXPECT_EQ(base::File::FILE_OK, result2.status());
}
TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
@@ -380,7 +380,7 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
ASSERT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite kDataSize bytes data while allowed_growth is 20.
@@ -395,7 +395,7 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
EXPECT_EQ(kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status());
}
@@ -415,7 +415,7 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
EXPECT_EQ(offset + kDataSize, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite 45 bytes data while allowed_growth is -20.
@@ -434,7 +434,7 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
EXPECT_EQ(pre_write_usage, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kDataSize, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_OK, result.status());
+ EXPECT_EQ(base::File::FILE_OK, result.status());
}
// Trying to overwrite 45 bytes data with offset pre_write_usage - 20,
@@ -454,7 +454,7 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) {
EXPECT_EQ(pre_write_usage + allowed_growth, usage());
EXPECT_EQ(GetFileSizeOnDisk("test"), usage());
EXPECT_EQ(kOverlap + allowed_growth, result.bytes_written());
- EXPECT_EQ(base::PLATFORM_FILE_ERROR_NO_SPACE, result.status());
+ EXPECT_EQ(base::File::FILE_ERROR_NO_SPACE, result.status());
}
}
« no previous file with comments | « content/browser/fileapi/file_system_url_request_job_unittest.cc ('k') | content/browser/fileapi/fileapi_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698