Commit ccce250d authored by mtomasz@chromium.org's avatar mtomasz@chromium.org

[fsp] Refactor FakeProvidedFileSystem to be more flexible.

Before, the FakeProvidedFileSystem had some hardcoded responses. However, since
FileStreamWriter is coming soon, we will need to verify if the file on the
file system is changed correctly.

For that, FakeProvidedFileSystem has been refactored, so it is possible to add
and get fake files and verify their values.

TEST=unit_tests: *FileSystemProvider*
BUG=391362

Review URL: https://codereview.chromium.org/393233002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283538 0039d316-1c4b-4281-b951-d872f2087c98
parent f147ae30
......@@ -14,38 +14,67 @@ namespace chromeos {
namespace file_system_provider {
namespace {
// Adds a fake entry to the entry list.
void AddDirectoryEntry(fileapi::AsyncFileUtil::EntryList* entry_list,
const std::string& name,
fileapi::DirectoryEntry::DirectoryEntryType type,
int64 size,
std::string last_modified_time_string) {
base::Time last_modified_time;
const bool result = base::Time::FromString(last_modified_time_string.c_str(),
&last_modified_time);
DCHECK(result);
entry_list->push_back(
fileapi::DirectoryEntry(name, type, size, last_modified_time));
}
} // namespace
const char kFakeFileName[] = "hello.txt";
const char kFakeFilePath[] = "/hello.txt";
const char kFakeFileText[] =
"This is a testing file. Lorem ipsum dolor sit amet est.";
const size_t kFakeFileSize = sizeof(kFakeFileText) - 1u;
const char kFakeFileModificationTime[] = "Fri Apr 25 01:47:53 UTC 2014";
const char kFakeFileMimeType[] = "text/plain";
} // namespace
const char kFakeFilePath[] = "/hello.txt";
FakeProvidedFileSystem::FakeProvidedFileSystem(
const ProvidedFileSystemInfo& file_system_info)
: file_system_info_(file_system_info),
last_file_handle_(0),
weak_ptr_factory_(this) {
AddEntry(
base::FilePath::FromUTF8Unsafe("/"), true, "", 0, base::Time(), "", "");
base::Time modification_time;
DCHECK(base::Time::FromString(kFakeFileModificationTime, &modification_time));
AddEntry(base::FilePath::FromUTF8Unsafe(kFakeFilePath),
false,
kFakeFileName,
kFakeFileSize,
modification_time,
kFakeFileMimeType,
kFakeFileText);
}
FakeProvidedFileSystem::~FakeProvidedFileSystem() {}
void FakeProvidedFileSystem::AddEntry(const base::FilePath& entry_path,
bool is_directory,
const std::string& name,
int64 size,
base::Time modification_time,
std::string mime_type,
std::string contents) {
DCHECK(entries_.find(entry_path) == entries_.end());
EntryMetadata metadata;
metadata.is_directory = is_directory;
metadata.name = name;
metadata.size = size;
metadata.modification_time = modification_time;
metadata.mime_type = mime_type;
entries_[entry_path] = FakeEntry(metadata, contents);
}
bool FakeProvidedFileSystem::GetEntry(const base::FilePath& entry_path,
FakeEntry* fake_entry) const {
const Entries::const_iterator entry_it = entries_.find(entry_path);
if (entry_it == entries_.end())
return false;
*fake_entry = entry_it->second;
return true;
}
void FakeProvidedFileSystem::RequestUnmount(
const fileapi::AsyncFileUtil::StatusCallback& callback) {
base::MessageLoopProxy::current()->PostTask(
......@@ -55,103 +84,52 @@ void FakeProvidedFileSystem::RequestUnmount(
void FakeProvidedFileSystem::GetMetadata(
const base::FilePath& entry_path,
const ProvidedFileSystemInterface::GetMetadataCallback& callback) {
if (entry_path.AsUTF8Unsafe() == "/") {
EntryMetadata metadata;
metadata.size = 0;
metadata.is_directory = true;
base::Time modification_time;
const bool result = base::Time::FromString("Thu Apr 24 00:46:52 UTC 2014",
&modification_time);
DCHECK(result);
metadata.modification_time = modification_time;
const Entries::const_iterator entry_it = entries_.find(entry_path);
if (entry_it == entries_.end()) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, metadata, base::File::FILE_OK));
return;
}
if (entry_path.AsUTF8Unsafe() == kFakeFilePath) {
EntryMetadata metadata;
metadata.size = kFakeFileSize;
metadata.is_directory = false;
base::Time modification_time;
const bool result =
base::Time::FromString(kFakeFileModificationTime, &modification_time);
DCHECK(result);
metadata.modification_time = modification_time;
metadata.mime_type = "text/plain";
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, metadata, base::File::FILE_OK));
FROM_HERE,
base::Bind(
callback, EntryMetadata(), base::File::FILE_ERROR_NOT_FOUND));
return;
}
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback, EntryMetadata(), base::File::FILE_ERROR_NOT_FOUND));
base::Bind(callback, entry_it->second.metadata, base::File::FILE_OK));
}
void FakeProvidedFileSystem::ReadDirectory(
const base::FilePath& directory_path,
const fileapi::AsyncFileUtil::ReadDirectoryCallback& callback) {
// Return fake contents for the root directory only.
if (directory_path.AsUTF8Unsafe() != "/") {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
base::File::FILE_ERROR_NOT_FOUND,
fileapi::AsyncFileUtil::EntryList(),
false /* has_more */));
return;
}
{
fileapi::AsyncFileUtil::EntryList entry_list;
AddDirectoryEntry(&entry_list,
kFakeFileName,
fileapi::DirectoryEntry::FILE,
kFakeFileSize,
"Thu Apr 24 00:46:52 UTC 2014");
AddDirectoryEntry(&entry_list,
"world.txt",
fileapi::DirectoryEntry::FILE,
1024 /* size */,
"Wed Apr 23 00:20:30 UTC 2014");
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(
callback, base::File::FILE_OK, entry_list, true /* has_more */));
fileapi::AsyncFileUtil::EntryList entry_list;
for (Entries::const_iterator it = entries_.begin(); it != entries_.end();
++it) {
const base::FilePath file_path = it->first;
if (file_path == directory_path || directory_path.IsParent(file_path)) {
const EntryMetadata& metadata = it->second.metadata;
entry_list.push_back(fileapi::DirectoryEntry(
metadata.name,
metadata.is_directory ? fileapi::DirectoryEntry::DIRECTORY
: fileapi::DirectoryEntry::FILE,
metadata.size,
metadata.modification_time));
}
}
{
fileapi::AsyncFileUtil::EntryList entry_list;
AddDirectoryEntry(&entry_list,
"pictures",
fileapi::DirectoryEntry::DIRECTORY,
0 /* size */,
"Tue May 22 00:40:50 UTC 2014");
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(
callback, base::File::FILE_OK, entry_list, false /* has_more */));
}
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(
callback, base::File::FILE_OK, entry_list, false /* has_more */));
}
void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path,
void FakeProvidedFileSystem::OpenFile(const base::FilePath& entry_path,
OpenFileMode mode,
const OpenFileCallback& callback) {
if (mode == OPEN_FILE_MODE_WRITE) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
0 /* file_handle */,
base::File::FILE_ERROR_ACCESS_DENIED));
}
const Entries::const_iterator entry_it = entries_.find(entry_path);
if (file_path.AsUTF8Unsafe() != "/hello.txt") {
if (entry_it == entries_.end()) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(
......@@ -160,7 +138,7 @@ void FakeProvidedFileSystem::OpenFile(const base::FilePath& file_path,
}
const int file_handle = ++last_file_handle_;
opened_files_[file_handle] = file_path;
opened_files_[file_handle] = entry_path;
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, file_handle, base::File::FILE_OK));
}
......@@ -170,6 +148,7 @@ void FakeProvidedFileSystem::CloseFile(
const fileapi::AsyncFileUtil::StatusCallback& callback) {
const OpenedFilesMap::iterator opened_file_it =
opened_files_.find(file_handle);
if (opened_file_it == opened_files_.end()) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, base::File::FILE_ERROR_NOT_FOUND));
......@@ -189,6 +168,7 @@ void FakeProvidedFileSystem::ReadFile(
const ProvidedFileSystemInterface::ReadChunkReceivedCallback& callback) {
const OpenedFilesMap::iterator opened_file_it =
opened_files_.find(file_handle);
if (opened_file_it == opened_files_.end() ||
opened_file_it->second.AsUTF8Unsafe() != kFakeFilePath) {
base::MessageLoopProxy::current()->PostTask(
......@@ -200,12 +180,24 @@ void FakeProvidedFileSystem::ReadFile(
return;
}
const Entries::const_iterator entry_it =
entries_.find(opened_file_it->second);
if (entry_it == entries_.end()) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
0 /* chunk_length */,
false /* has_more */,
base::File::FILE_ERROR_INVALID_OPERATION));
return;
}
// Send the response byte by byte.
size_t current_offset = static_cast<size_t>(offset);
size_t current_length = static_cast<size_t>(length);
int64 current_offset = offset;
int current_length = length;
// Reading behind EOF is fine, it will just return 0 bytes.
if (current_offset >= kFakeFileSize || !current_length) {
if (current_offset >= entry_it->second.metadata.size || !current_length) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(callback,
......@@ -214,10 +206,11 @@ void FakeProvidedFileSystem::ReadFile(
base::File::FILE_OK));
}
while (current_offset < kFakeFileSize && current_length) {
buffer->data()[current_offset - offset] = kFakeFileText[current_offset];
const FakeEntry& entry = entry_it->second;
while (current_offset < entry.metadata.size && current_length) {
buffer->data()[current_offset - offset] = entry.contents[current_offset];
const bool has_more =
(current_offset + 1 < kFakeFileSize) && (current_length - 1);
(current_offset + 1 < entry.metadata.size) && (current_length - 1);
base::MessageLoopProxy::current()->PostTask(
FROM_HERE,
base::Bind(
......@@ -232,6 +225,7 @@ void FakeProvidedFileSystem::CreateDirectory(
bool exclusive,
bool recursive,
const fileapi::AsyncFileUtil::StatusCallback& callback) {
// TODO(mtomasz): Implement it once needed.
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, base::File::FILE_OK));
}
......@@ -240,6 +234,7 @@ void FakeProvidedFileSystem::DeleteEntry(
const base::FilePath& entry_path,
bool recursive,
const fileapi::AsyncFileUtil::StatusCallback& callback) {
// TODO(mtomasz): Implement it once needed.
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(callback, base::File::FILE_OK));
}
......
......@@ -13,6 +13,10 @@
class Profile;
namespace base {
class Time;
} // namespace base
namespace net {
class IOBuffer;
} // namespace net
......@@ -22,11 +26,22 @@ namespace file_system_provider {
class RequestManager;
extern const char kFakeFileName[];
// Path of a sample fake file, which is added to the fake file system by
// default.
extern const char kFakeFilePath[];
extern const char kFakeFileText[];
extern const size_t kFakeFileSize;
extern const char kFakeFileModificationTime[];
// Represents a file or a directory on a fake file system.
struct FakeEntry {
FakeEntry() {}
FakeEntry(EntryMetadata& metadata, const std::string& contents)
: metadata(metadata), contents(contents) {}
virtual ~FakeEntry() {}
EntryMetadata metadata;
std::string contents;
};
// Fake provided file system implementation. Does not communicate with target
// extensions. Used for unit tests.
......@@ -36,6 +51,20 @@ class FakeProvidedFileSystem : public ProvidedFileSystemInterface {
const ProvidedFileSystemInfo& file_system_info);
virtual ~FakeProvidedFileSystem();
// Adds a fake entry to the fake file system.
void AddEntry(const base::FilePath& entry_path,
bool is_directory,
const std::string& name,
int64 size,
base::Time modification_time,
std::string mime_type,
std::string contents);
// Fetches a pointer to a fake entry registered in the fake file system. If
// found, then the result is written to |fake_entry| and true is returned.
// Otherwise, false is returned. |fake_entry| must not be NULL.
bool GetEntry(const base::FilePath& entry_path, FakeEntry* fake_entry) const;
// ProvidedFileSystemInterface overrides.
virtual void RequestUnmount(
const fileapi::AsyncFileUtil::StatusCallback& callback) OVERRIDE;
......@@ -77,9 +106,11 @@ class FakeProvidedFileSystem : public ProvidedFileSystemInterface {
const ProvidedFileSystemInfo& file_system_info);
private:
typedef std::map<base::FilePath, FakeEntry> Entries;
typedef std::map<int, base::FilePath> OpenedFilesMap;
ProvidedFileSystemInfo file_system_info_;
Entries entries_;
OpenedFilesMap opened_files_;
int last_file_handle_;
......
......@@ -101,6 +101,12 @@ class FileSystemProviderFileStreamReader : public testing::Test {
"Testing File System",
false /* writable */);
ASSERT_TRUE(result);
FakeProvidedFileSystem* provided_file_system =
static_cast<FakeProvidedFileSystem*>(
service->GetProvidedFileSystem(kExtensionId, kFileSystemId));
DCHECK(provided_file_system);
ASSERT_TRUE(provided_file_system->GetEntry(
base::FilePath::FromUTF8Unsafe(kFakeFilePath), &fake_file_));
const ProvidedFileSystemInfo& file_system_info =
service->GetProvidedFileSystem(kExtensionId, kFileSystemId)
->GetFileSystemInfo();
......@@ -113,9 +119,6 @@ class FileSystemProviderFileStreamReader : public testing::Test {
wrong_file_url_ = CreateFileSystemURL(
mount_point_name, base::FilePath::FromUTF8Unsafe("im-not-here.txt"));
ASSERT_TRUE(wrong_file_url_.is_valid());
ASSERT_TRUE(base::Time::FromString(kFakeFileModificationTime,
&file_modification_time_));
}
virtual void TearDown() OVERRIDE {
......@@ -128,9 +131,9 @@ class FileSystemProviderFileStreamReader : public testing::Test {
base::ScopedTempDir data_dir_;
scoped_ptr<TestingProfileManager> profile_manager_;
TestingProfile* profile_; // Owned by TestingProfileManager.
FakeEntry fake_file_;
fileapi::FileSystemURL file_url_;
fileapi::FileSystemURL wrong_file_url_;
base::Time file_modification_time_;
};
TEST_F(FileSystemProviderFileStreamReader, Read_AllAtOnce) {
......@@ -138,35 +141,39 @@ TEST_F(FileSystemProviderFileStreamReader, Read_AllAtOnce) {
const int64 initial_offset = 0;
FileStreamReader reader(
NULL, file_url_, initial_offset, file_modification_time_);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize));
NULL, file_url_, initial_offset, fake_file_.metadata.modification_time);
scoped_refptr<net::IOBuffer> io_buffer(
new net::IOBuffer(fake_file_.metadata.size));
const int result =
reader.Read(io_buffer.get(),
kFakeFileSize,
fake_file_.metadata.size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
EXPECT_EQ(net::ERR_IO_PENDING, result);
base::RunLoop().RunUntilIdle();
ASSERT_EQ(1u, logger.results().size());
EXPECT_LT(0, logger.results()[0]);
EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0]));
EXPECT_EQ(fake_file_.metadata.size, logger.results()[0]);
std::string buffer_as_string(io_buffer->data(), kFakeFileSize);
EXPECT_EQ(kFakeFileText, buffer_as_string);
std::string buffer_as_string(io_buffer->data(), fake_file_.metadata.size);
EXPECT_EQ(fake_file_.contents, buffer_as_string);
}
TEST_F(FileSystemProviderFileStreamReader, Read_WrongFile) {
EventLogger logger;
const int64 initial_offset = 0;
FileStreamReader reader(
NULL, wrong_file_url_, initial_offset, file_modification_time_);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize));
FileStreamReader reader(NULL,
wrong_file_url_,
initial_offset,
fake_file_.metadata.modification_time);
scoped_refptr<net::IOBuffer> io_buffer(
new net::IOBuffer(fake_file_.metadata.size));
const int result =
reader.Read(io_buffer.get(),
kFakeFileSize,
fake_file_.metadata.size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
EXPECT_EQ(net::ERR_IO_PENDING, result);
base::RunLoop().RunUntilIdle();
......@@ -180,9 +187,9 @@ TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) {
const int64 initial_offset = 0;
FileStreamReader reader(
NULL, file_url_, initial_offset, file_modification_time_);
NULL, file_url_, initial_offset, fake_file_.metadata.modification_time);
for (size_t offset = 0; offset < kFakeFileSize; ++offset) {
for (int64 offset = 0; offset < fake_file_.metadata.size; ++offset) {
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(1));
const int result =
reader.Read(io_buffer.get(),
......@@ -190,9 +197,9 @@ TEST_F(FileSystemProviderFileStreamReader, Read_InChunks) {
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
EXPECT_EQ(net::ERR_IO_PENDING, result);
base::RunLoop().RunUntilIdle();
ASSERT_EQ(offset + 1u, logger.results().size());
ASSERT_EQ(offset + 1, static_cast<int64>(logger.results().size()));
EXPECT_EQ(1, logger.results()[offset]);
EXPECT_EQ(kFakeFileText[offset], io_buffer->data()[0]);
EXPECT_EQ(fake_file_.contents[offset], io_buffer->data()[0]);
}
}
......@@ -201,12 +208,12 @@ TEST_F(FileSystemProviderFileStreamReader, Read_Slice) {
// Trim first 3 and last 3 characters.
const int64 initial_offset = 3;
const int length = static_cast<int>(kFakeFileSize) - initial_offset - 3;
ASSERT_GT(kFakeFileSize, static_cast<size_t>(initial_offset));
const int length = fake_file_.metadata.size - initial_offset - 3;
ASSERT_GT(fake_file_.metadata.size, initial_offset);
ASSERT_LT(0, length);
FileStreamReader reader(
NULL, file_url_, initial_offset, file_modification_time_);
NULL, file_url_, initial_offset, fake_file_.metadata.modification_time);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(length));
const int result =
......@@ -220,7 +227,8 @@ TEST_F(FileSystemProviderFileStreamReader, Read_Slice) {
EXPECT_EQ(length, logger.results()[0]);
std::string buffer_as_string(io_buffer->data(), length);
std::string expected_buffer(kFakeFileText + initial_offset, length);
std::string expected_buffer(fake_file_.contents.data() + initial_offset,
length);
EXPECT_EQ(expected_buffer, buffer_as_string);
}
......@@ -229,10 +237,10 @@ TEST_F(FileSystemProviderFileStreamReader, Read_Beyond) {
// Request reading 1KB more than available.
const int64 initial_offset = 0;
const int length = static_cast<int>(kFakeFileSize) + 1024;
const int length = fake_file_.metadata.size + 1024;
FileStreamReader reader(
NULL, file_url_, initial_offset, file_modification_time_);
NULL, file_url_, initial_offset, fake_file_.metadata.modification_time);
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(length));
const int result =
......@@ -244,10 +252,10 @@ TEST_F(FileSystemProviderFileStreamReader, Read_Beyond) {
ASSERT_EQ(1u, logger.results().size());
EXPECT_LT(0, logger.results()[0]);
EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0]));
EXPECT_EQ(fake_file_.metadata.size, logger.results()[0]);
std::string buffer_as_string(io_buffer->data(), kFakeFileSize);
EXPECT_EQ(kFakeFileText, buffer_as_string);
std::string buffer_as_string(io_buffer->data(), fake_file_.metadata.size);
EXPECT_EQ(fake_file_.contents, buffer_as_string);
}
TEST_F(FileSystemProviderFileStreamReader, Read_ModifiedFile) {
......@@ -256,10 +264,11 @@ TEST_F(FileSystemProviderFileStreamReader, Read_ModifiedFile) {
const int64 initial_offset = 0;
FileStreamReader reader(NULL, file_url_, initial_offset, base::Time::Max());
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize));
scoped_refptr<net::IOBuffer> io_buffer(
new net::IOBuffer(fake_file_.metadata.size));
const int result =
reader.Read(io_buffer.get(),
kFakeFileSize,
fake_file_.metadata.size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
EXPECT_EQ(net::ERR_IO_PENDING, result);
......@@ -275,20 +284,21 @@ TEST_F(FileSystemProviderFileStreamReader, Read_ExpectedModificationTimeNull) {
const int64 initial_offset = 0;
FileStreamReader reader(NULL, file_url_, initial_offset, base::Time());
scoped_refptr<net::IOBuffer> io_buffer(new net::IOBuffer(kFakeFileSize));
scoped_refptr<net::IOBuffer> io_buffer(
new net::IOBuffer(fake_file_.metadata.size));
const int result =
reader.Read(io_buffer.get(),
kFakeFileSize,
fake_file_.metadata.size,
base::Bind(&EventLogger::OnRead, logger.GetWeakPtr()));
EXPECT_EQ(net::ERR_IO_PENDING, result);
base::RunLoop().RunUntilIdle();
ASSERT_EQ(1u, logger.results().size());
EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0]));
EXPECT_EQ(fake_file_.metadata.size, logger.results()[0]);
std::string buffer_as_string(io_buffer->data(), kFakeFileSize);
EXPECT_EQ(kFakeFileText, buffer_as_string);
std::string buffer_as_string(io_buffer->data(), fake_file_.metadata.size);
EXPECT_EQ(fake_file_.contents, buffer_as_string);
}
TEST_F(FileSystemProviderFileStreamReader, GetLength) {
......@@ -296,7 +306,7 @@ TEST_F(FileSystemProviderFileStreamReader, GetLength) {
const int64 initial_offset = 0;
FileStreamReader reader(
NULL, file_url_, initial_offset, file_modification_time_);
NULL, file_url_, initial_offset, fake_file_.metadata.modification_time);
const int result = reader.GetLength(
base::Bind(&EventLogger::OnGetLength, logger.GetWeakPtr()));
......@@ -305,15 +315,17 @@ TEST_F(FileSystemProviderFileStreamReader, GetLength) {
ASSERT_EQ(1u, logger.results().size());
EXPECT_LT(0, logger.results()[0]);
EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0]));
EXPECT_EQ(fake_file_.metadata.size, logger.results()[0]);
}
TEST_F(FileSystemProviderFileStreamReader, GetLength_WrongFile) {
EventLogger logger;
const int64 initial_offset = 0;
FileStreamReader reader(
NULL, wrong_file_url_, initial_offset, file_modification_time_);
FileStreamReader reader(NULL,
wrong_file_url_,
initial_offset,
fake_file_.metadata.modification_time);
const int result = reader.GetLength(
base::Bind(&EventLogger::OnGetLength, logger.GetWeakPtr()));
......@@ -353,7 +365,7 @@ TEST_F(FileSystemProviderFileStreamReader,
ASSERT_EQ(1u, logger.results().size());
EXPECT_LT(0, logger.results()[0]);
EXPECT_EQ(kFakeFileSize, static_cast<size_t>(logger.results()[0]));
EXPECT_EQ(fake_file_.metadata.size, logger.results()[0]);
}
} // namespace file_system_provider
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment