Commit 1f2948ba authored by tzik's avatar tzik Committed by Commit Bot

Migrate base/files/file{,_util}_proxy* to OnceCallback

This replaces Callback to OnceCallback, so that users of this can pass
OnceCallback.

Change-Id: Icc4b8633fb9aa1a6c49ab06583cae985f54df597
Reviewed-on: https://chromium-review.googlesource.com/930445Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: Taiju Tsuiki <tzik@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539010}
parent a6619d74
......@@ -79,10 +79,10 @@ class GenericFileHelper : public FileHelper {
error_ = File::FILE_OK;
}
void Reply(const FileProxy::StatusCallback& callback) {
void Reply(FileProxy::StatusCallback callback) {
PassFile();
if (!callback.is_null())
callback.Run(error_);
std::move(callback).Run(error_);
}
private:
......@@ -100,10 +100,10 @@ class CreateOrOpenHelper : public FileHelper {
error_ = file_.IsValid() ? File::FILE_OK : file_.error_details();
}
void Reply(const FileProxy::StatusCallback& callback) {
void Reply(FileProxy::StatusCallback callback) {
DCHECK(!callback.is_null());
PassFile();
callback.Run(error_);
std::move(callback).Run(error_);
}
private:
......@@ -139,10 +139,10 @@ class CreateTemporaryHelper : public FileHelper {
}
}
void Reply(const FileProxy::CreateTemporaryCallback& callback) {
void Reply(FileProxy::CreateTemporaryCallback callback) {
DCHECK(!callback.is_null());
PassFile();
callback.Run(error_, file_path_);
std::move(callback).Run(error_, file_path_);
}
private:
......@@ -161,10 +161,10 @@ class GetInfoHelper : public FileHelper {
error_ = File::FILE_OK;
}
void Reply(const FileProxy::GetFileInfoCallback& callback) {
void Reply(FileProxy::GetFileInfoCallback callback) {
PassFile();
DCHECK(!callback.is_null());
callback.Run(error_, file_info_);
std::move(callback).Run(error_, file_info_);
}
private:
......@@ -186,10 +186,10 @@ class ReadHelper : public FileHelper {
error_ = (bytes_read_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
}
void Reply(const FileProxy::ReadCallback& callback) {
void Reply(FileProxy::ReadCallback callback) {
PassFile();
DCHECK(!callback.is_null());
callback.Run(error_, buffer_.get(), bytes_read_);
std::move(callback).Run(error_, buffer_.get(), bytes_read_);
}
private:
......@@ -216,10 +216,10 @@ class WriteHelper : public FileHelper {
error_ = (bytes_written_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
}
void Reply(const FileProxy::WriteCallback& callback) {
void Reply(FileProxy::WriteCallback callback) {
PassFile();
if (!callback.is_null())
callback.Run(error_, bytes_written_);
std::move(callback).Run(error_, bytes_written_);
}
private:
......@@ -241,25 +241,26 @@ FileProxy::~FileProxy() {
bool FileProxy::CreateOrOpen(const FilePath& file_path,
uint32_t file_flags,
const StatusCallback& callback) {
StatusCallback callback) {
DCHECK(!file_.IsValid());
CreateOrOpenHelper* helper = new CreateOrOpenHelper(this, File());
return task_runner_->PostTaskAndReply(
FROM_HERE,
BindOnce(&CreateOrOpenHelper::RunWork, Unretained(helper), file_path,
file_flags),
BindOnce(&CreateOrOpenHelper::Reply, Owned(helper), callback));
BindOnce(&CreateOrOpenHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::CreateTemporary(uint32_t additional_file_flags,
const CreateTemporaryCallback& callback) {
CreateTemporaryCallback callback) {
DCHECK(!file_.IsValid());
CreateTemporaryHelper* helper = new CreateTemporaryHelper(this, File());
return task_runner_->PostTaskAndReply(
FROM_HERE,
BindOnce(&CreateTemporaryHelper::RunWork, Unretained(helper),
additional_file_flags),
BindOnce(&CreateTemporaryHelper::Reply, Owned(helper), callback));
BindOnce(&CreateTemporaryHelper::Reply, Owned(helper),
std::move(callback)));
}
bool FileProxy::IsValid() const {
......@@ -283,25 +284,23 @@ PlatformFile FileProxy::GetPlatformFile() const {
return file_.GetPlatformFile();
}
bool FileProxy::Close(const StatusCallback& callback) {
bool FileProxy::Close(StatusCallback callback) {
DCHECK(file_.IsValid());
GenericFileHelper* helper = new GenericFileHelper(this, std::move(file_));
return task_runner_->PostTaskAndReply(
FROM_HERE, BindOnce(&GenericFileHelper::Close, Unretained(helper)),
BindOnce(&GenericFileHelper::Reply, Owned(helper), callback));
BindOnce(&GenericFileHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::GetInfo(const GetFileInfoCallback& callback) {
bool FileProxy::GetInfo(GetFileInfoCallback callback) {
DCHECK(file_.IsValid());
GetInfoHelper* helper = new GetInfoHelper(this, std::move(file_));
return task_runner_->PostTaskAndReply(
FROM_HERE, BindOnce(&GetInfoHelper::RunWork, Unretained(helper)),
BindOnce(&GetInfoHelper::Reply, Owned(helper), callback));
BindOnce(&GetInfoHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::Read(int64_t offset,
int bytes_to_read,
const ReadCallback& callback) {
bool FileProxy::Read(int64_t offset, int bytes_to_read, ReadCallback callback) {
DCHECK(file_.IsValid());
if (bytes_to_read < 0)
return false;
......@@ -309,13 +308,13 @@ bool FileProxy::Read(int64_t offset,
ReadHelper* helper = new ReadHelper(this, std::move(file_), bytes_to_read);
return task_runner_->PostTaskAndReply(
FROM_HERE, BindOnce(&ReadHelper::RunWork, Unretained(helper), offset),
BindOnce(&ReadHelper::Reply, Owned(helper), callback));
BindOnce(&ReadHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::Write(int64_t offset,
const char* buffer,
int bytes_to_write,
const WriteCallback& callback) {
WriteCallback callback) {
DCHECK(file_.IsValid());
if (bytes_to_write <= 0 || buffer == nullptr)
return false;
......@@ -324,36 +323,36 @@ bool FileProxy::Write(int64_t offset,
new WriteHelper(this, std::move(file_), buffer, bytes_to_write);
return task_runner_->PostTaskAndReply(
FROM_HERE, BindOnce(&WriteHelper::RunWork, Unretained(helper), offset),
BindOnce(&WriteHelper::Reply, Owned(helper), callback));
BindOnce(&WriteHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::SetTimes(Time last_access_time,
Time last_modified_time,
const StatusCallback& callback) {
StatusCallback callback) {
DCHECK(file_.IsValid());
GenericFileHelper* helper = new GenericFileHelper(this, std::move(file_));
return task_runner_->PostTaskAndReply(
FROM_HERE,
BindOnce(&GenericFileHelper::SetTimes, Unretained(helper),
last_access_time, last_modified_time),
BindOnce(&GenericFileHelper::Reply, Owned(helper), callback));
BindOnce(&GenericFileHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::SetLength(int64_t length, const StatusCallback& callback) {
bool FileProxy::SetLength(int64_t length, StatusCallback callback) {
DCHECK(file_.IsValid());
GenericFileHelper* helper = new GenericFileHelper(this, std::move(file_));
return task_runner_->PostTaskAndReply(
FROM_HERE,
BindOnce(&GenericFileHelper::SetLength, Unretained(helper), length),
BindOnce(&GenericFileHelper::Reply, Owned(helper), callback));
BindOnce(&GenericFileHelper::Reply, Owned(helper), std::move(callback)));
}
bool FileProxy::Flush(const StatusCallback& callback) {
bool FileProxy::Flush(StatusCallback callback) {
DCHECK(file_.IsValid());
GenericFileHelper* helper = new GenericFileHelper(this, std::move(file_));
return task_runner_->PostTaskAndReply(
FROM_HERE, BindOnce(&GenericFileHelper::Flush, Unretained(helper)),
BindOnce(&GenericFileHelper::Reply, Owned(helper), callback));
BindOnce(&GenericFileHelper::Reply, Owned(helper), std::move(callback)));
}
} // namespace base
......@@ -40,17 +40,14 @@ class BASE_EXPORT FileProxy : public SupportsWeakPtr<FileProxy> {
// This callback is used by methods that report only an error code. It is
// valid to pass a null callback to some functions that takes a
// StatusCallback, in which case the operation will complete silently.
typedef Callback<void(File::Error)> StatusCallback;
typedef Callback<void(File::Error,
const FilePath&)> CreateTemporaryCallback;
typedef Callback<void(File::Error,
const File::Info&)> GetFileInfoCallback;
typedef Callback<void(File::Error,
const char* data,
int bytes_read)> ReadCallback;
typedef Callback<void(File::Error,
int bytes_written)> WriteCallback;
using StatusCallback = OnceCallback<void(File::Error)>;
using CreateTemporaryCallback =
OnceCallback<void(File::Error, const FilePath&)>;
using GetFileInfoCallback =
OnceCallback<void(File::Error, const File::Info&)>;
using ReadCallback =
OnceCallback<void(File::Error, const char* data, int bytes_read)>;
using WriteCallback = OnceCallback<void(File::Error, int bytes_written)>;
FileProxy();
explicit FileProxy(TaskRunner* task_runner);
......@@ -64,7 +61,7 @@ class BASE_EXPORT FileProxy : public SupportsWeakPtr<FileProxy> {
// This returns false if task posting to |task_runner| has failed.
bool CreateOrOpen(const FilePath& file_path,
uint32_t file_flags,
const StatusCallback& callback);
StatusCallback callback);
// Creates a temporary file for writing. The path and an open file are
// returned. It is invalid to pass a null callback. The additional file flags
......@@ -75,7 +72,7 @@ class BASE_EXPORT FileProxy : public SupportsWeakPtr<FileProxy> {
//
// This returns false if task posting to |task_runner| has failed.
bool CreateTemporary(uint32_t additional_file_flags,
const CreateTemporaryCallback& callback);
CreateTemporaryCallback callback);
// Returns true if the underlying |file_| is valid.
bool IsValid() const;
......@@ -98,16 +95,16 @@ class BASE_EXPORT FileProxy : public SupportsWeakPtr<FileProxy> {
// Proxies File::Close. The callback can be null.
// This returns false if task posting to |task_runner| has failed.
bool Close(const StatusCallback& callback);
bool Close(StatusCallback callback);
// Proxies File::GetInfo. The callback can't be null.
// This returns false if task posting to |task_runner| has failed.
bool GetInfo(const GetFileInfoCallback& callback);
bool GetInfo(GetFileInfoCallback callback);
// Proxies File::Read. The callback can't be null.
// This returns false if |bytes_to_read| is less than zero, or
// if task posting to |task_runner| has failed.
bool Read(int64_t offset, int bytes_to_read, const ReadCallback& callback);
bool Read(int64_t offset, int bytes_to_read, ReadCallback callback);
// Proxies File::Write. The callback can be null.
// This returns false if |bytes_to_write| is less than or equal to zero,
......@@ -115,21 +112,21 @@ class BASE_EXPORT FileProxy : public SupportsWeakPtr<FileProxy> {
bool Write(int64_t offset,
const char* buffer,
int bytes_to_write,
const WriteCallback& callback);
WriteCallback callback);
// Proxies File::SetTimes. The callback can be null.
// This returns false if task posting to |task_runner| has failed.
bool SetTimes(Time last_access_time,
Time last_modified_time,
const StatusCallback& callback);
StatusCallback callback);
// Proxies File::SetLength. The callback can be null.
// This returns false if task posting to |task_runner| has failed.
bool SetLength(int64_t length, const StatusCallback& callback);
bool SetLength(int64_t length, StatusCallback callback);
// Proxies File::Flush. The callback can be null.
// This returns false if task posting to |task_runner| has failed.
bool Flush(const StatusCallback& callback);
bool Flush(StatusCallback callback);
private:
friend class FileHelper;
......
......@@ -78,8 +78,9 @@ class FileProxyTest : public testing::Test {
protected:
void CreateProxy(uint32_t flags, FileProxy* proxy) {
proxy->CreateOrOpen(TestPath(), flags, Bind(&FileProxyTest::DidCreateOrOpen,
weak_factory_.GetWeakPtr()));
proxy->CreateOrOpen(
TestPath(), flags,
BindOnce(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_TRUE(proxy->IsValid());
}
......@@ -106,7 +107,7 @@ TEST_F(FileProxyTest, CreateOrOpen_Create) {
FileProxy proxy(file_task_runner());
proxy.CreateOrOpen(
TestPath(), File::FLAG_CREATE | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
......@@ -124,7 +125,7 @@ TEST_F(FileProxyTest, CreateOrOpen_Open) {
FileProxy proxy(file_task_runner());
proxy.CreateOrOpen(
TestPath(), File::FLAG_OPEN | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
......@@ -136,7 +137,7 @@ TEST_F(FileProxyTest, CreateOrOpen_OpenNonExistent) {
FileProxy proxy(file_task_runner());
proxy.CreateOrOpen(
TestPath(), File::FLAG_OPEN | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_ERROR_NOT_FOUND, error_);
EXPECT_FALSE(proxy.IsValid());
......@@ -150,7 +151,7 @@ TEST_F(FileProxyTest, CreateOrOpen_AbandonedCreate) {
FileProxy proxy(file_task_runner());
proxy.CreateOrOpen(
TestPath(), File::FLAG_CREATE | File::FLAG_READ,
Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
}
RunLoop().Run();
ThreadRestrictions::SetIOAllowed(prev);
......@@ -168,7 +169,7 @@ TEST_F(FileProxyTest, Close) {
EXPECT_FALSE(base::Move(TestPath(), TestDirPath().AppendASCII("new")));
#endif
proxy.Close(Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
proxy.Close(BindOnce(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_FALSE(proxy.IsValid());
......@@ -180,9 +181,9 @@ TEST_F(FileProxyTest, Close) {
TEST_F(FileProxyTest, CreateTemporary) {
{
FileProxy proxy(file_task_runner());
proxy.CreateTemporary(
0 /* additional_file_flags */,
Bind(&FileProxyTest::DidCreateTemporary, weak_factory_.GetWeakPtr()));
proxy.CreateTemporary(0 /* additional_file_flags */,
BindOnce(&FileProxyTest::DidCreateTemporary,
weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_TRUE(proxy.IsValid());
......@@ -191,7 +192,7 @@ TEST_F(FileProxyTest, CreateTemporary) {
// The file should be writable.
proxy.Write(0, "test", 4,
Bind(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(4, bytes_written_);
......@@ -247,7 +248,7 @@ TEST_F(FileProxyTest, GetInfo) {
FileProxy proxy(file_task_runner());
CreateProxy(File::FLAG_OPEN | File::FLAG_READ, &proxy);
proxy.GetInfo(
Bind(&FileProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......@@ -270,7 +271,8 @@ TEST_F(FileProxyTest, Read) {
FileProxy proxy(file_task_runner());
CreateProxy(File::FLAG_OPEN | File::FLAG_READ, &proxy);
proxy.Read(0, 128, Bind(&FileProxyTest::DidRead, weak_factory_.GetWeakPtr()));
proxy.Read(0, 128,
BindOnce(&FileProxyTest::DidRead, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......@@ -288,14 +290,14 @@ TEST_F(FileProxyTest, WriteAndFlush) {
const char data[] = "foo!";
int data_bytes = arraysize(data);
proxy.Write(0, data, data_bytes,
Bind(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
BindOnce(&FileProxyTest::DidWrite, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
EXPECT_EQ(data_bytes, bytes_written_);
// Flush the written data. (So that the following read should always
// succeed. On some platforms it may work with or without this flush.)
proxy.Flush(Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
proxy.Flush(BindOnce(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
......@@ -322,8 +324,9 @@ TEST_F(FileProxyTest, MAYBE_SetTimes) {
Time last_accessed_time = Time::Now() - TimeDelta::FromDays(12345);
Time last_modified_time = Time::Now() - TimeDelta::FromHours(98765);
proxy.SetTimes(last_accessed_time, last_modified_time,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
proxy.SetTimes(
last_accessed_time, last_modified_time,
BindOnce(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
......@@ -349,8 +352,8 @@ TEST_F(FileProxyTest, SetLength_Shrink) {
// Run.
FileProxy proxy(file_task_runner());
CreateProxy(File::FLAG_OPEN | File::FLAG_WRITE, &proxy);
proxy.SetLength(7,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
proxy.SetLength(
7, BindOnce(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......@@ -375,8 +378,8 @@ TEST_F(FileProxyTest, SetLength_Expand) {
// Run.
FileProxy proxy(file_task_runner());
CreateProxy(File::FLAG_OPEN | File::FLAG_WRITE, &proxy);
proxy.SetLength(53,
Bind(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
proxy.SetLength(
53, BindOnce(&FileProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......
......@@ -16,10 +16,10 @@ namespace base {
namespace {
void CallWithTranslatedParameter(const FileUtilProxy::StatusCallback& callback,
void CallWithTranslatedParameter(FileUtilProxy::StatusCallback callback,
bool value) {
DCHECK(!callback.is_null());
callback.Run(value ? File::FILE_OK : File::FILE_ERROR_FAILED);
std::move(callback).Run(value ? File::FILE_OK : File::FILE_ERROR_FAILED);
}
class GetFileInfoHelper {
......@@ -36,9 +36,9 @@ class GetFileInfoHelper {
error_ = File::FILE_ERROR_FAILED;
}
void Reply(const FileUtilProxy::GetFileInfoCallback& callback) {
void Reply(FileUtilProxy::GetFileInfoCallback callback) {
if (!callback.is_null()) {
callback.Run(error_, file_info_);
std::move(callback).Run(error_, file_info_);
}
}
......@@ -52,30 +52,27 @@ class GetFileInfoHelper {
// Retrieves the information about a file. It is invalid to pass NULL for the
// callback.
bool FileUtilProxy::GetFileInfo(
TaskRunner* task_runner,
const FilePath& file_path,
const GetFileInfoCallback& callback) {
bool FileUtilProxy::GetFileInfo(TaskRunner* task_runner,
const FilePath& file_path,
GetFileInfoCallback callback) {
GetFileInfoHelper* helper = new GetFileInfoHelper;
return task_runner->PostTaskAndReply(
FROM_HERE,
BindOnce(&GetFileInfoHelper::RunWorkForFilePath, Unretained(helper),
file_path),
BindOnce(&GetFileInfoHelper::Reply, Owned(helper), callback));
BindOnce(&GetFileInfoHelper::Reply, Owned(helper), std::move(callback)));
}
// static
bool FileUtilProxy::Touch(
TaskRunner* task_runner,
const FilePath& file_path,
const Time& last_access_time,
const Time& last_modified_time,
const StatusCallback& callback) {
bool FileUtilProxy::Touch(TaskRunner* task_runner,
const FilePath& file_path,
const Time& last_access_time,
const Time& last_modified_time,
StatusCallback callback) {
return base::PostTaskAndReplyWithResult(
task_runner,
FROM_HERE,
Bind(&TouchFile, file_path, last_access_time, last_modified_time),
Bind(&CallWithTranslatedParameter, callback));
task_runner, FROM_HERE,
BindOnce(&TouchFile, file_path, last_access_time, last_modified_time),
BindOnce(&CallWithTranslatedParameter, std::move(callback)));
}
} // namespace base
......@@ -22,27 +22,25 @@ class BASE_EXPORT FileUtilProxy {
// This callback is used by methods that report only an error code. It is
// valid to pass a null callback to any function that takes a StatusCallback,
// in which case the operation will complete silently.
typedef Callback<void(File::Error)> StatusCallback;
using StatusCallback = OnceCallback<void(File::Error)>;
typedef Callback<void(File::Error,
const File::Info&)> GetFileInfoCallback;
using GetFileInfoCallback =
OnceCallback<void(File::Error, const File::Info&)>;
// Retrieves the information about a file. It is invalid to pass a null
// callback.
// This returns false if task posting to |task_runner| has failed.
static bool GetFileInfo(
TaskRunner* task_runner,
const FilePath& file_path,
const GetFileInfoCallback& callback);
static bool GetFileInfo(TaskRunner* task_runner,
const FilePath& file_path,
GetFileInfoCallback callback);
// Touches a file. The callback can be null.
// This returns false if task posting to |task_runner| has failed.
static bool Touch(
TaskRunner* task_runner,
const FilePath& file_path,
const Time& last_access_time,
const Time& last_modified_time,
const StatusCallback& callback);
static bool Touch(TaskRunner* task_runner,
const FilePath& file_path,
const Time& last_access_time,
const Time& last_modified_time,
StatusCallback callback);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(FileUtilProxy);
......
......@@ -65,7 +65,7 @@ TEST_F(FileUtilProxyTest, GetFileInfo_File) {
// Run.
FileUtilProxy::GetFileInfo(
file_task_runner(), TestPath(),
Bind(&FileUtilProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
BindOnce(&FileUtilProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......@@ -87,7 +87,7 @@ TEST_F(FileUtilProxyTest, GetFileInfo_Directory) {
// Run.
FileUtilProxy::GetFileInfo(
file_task_runner(), TestPath(),
Bind(&FileUtilProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
BindOnce(&FileUtilProxyTest::DidGetFileInfo, weak_factory_.GetWeakPtr()));
RunLoop().Run();
// Verify.
......@@ -107,7 +107,7 @@ TEST_F(FileUtilProxyTest, Touch) {
FileUtilProxy::Touch(
file_task_runner(), TestPath(), last_accessed_time, last_modified_time,
Bind(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
BindOnce(&FileUtilProxyTest::DidFinish, weak_factory_.GetWeakPtr()));
RunLoop().Run();
EXPECT_EQ(File::FILE_OK, error_);
......
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