#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/file_util.h"
+#include "base/files/file.h"
+#include "base/files/file_util.h"
#include "base/guid.h"
-#include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/task_runner_util.h"
+#include "base/thread_task_runner_handle.h"
#include "chrome/browser/sync_file_system/file_change.h"
#include "chrome/browser/sync_file_system/local/local_file_change_tracker.h"
#include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h"
+#include "content/public/test/mock_blob_url_request_context.h"
+#include "content/public/test/mock_special_storage_policy.h"
#include "content/public/test/test_file_system_options.h"
+#include "storage/browser/fileapi/external_mount_points.h"
+#include "storage/browser/fileapi/file_system_backend.h"
+#include "storage/browser/fileapi/file_system_context.h"
+#include "storage/browser/fileapi/file_system_operation_context.h"
+#include "storage/browser/fileapi/file_system_operation_runner.h"
+#include "storage/browser/quota/quota_manager.h"
+#include "storage/common/blob/shareable_file_reference.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/browser/blob/mock_blob_url_request_context.h"
-#include "webkit/browser/fileapi/external_mount_points.h"
-#include "webkit/browser/fileapi/file_system_backend.h"
-#include "webkit/browser/fileapi/file_system_context.h"
-#include "webkit/browser/fileapi/file_system_operation_context.h"
-#include "webkit/browser/fileapi/file_system_operation_runner.h"
-#include "webkit/browser/quota/mock_special_storage_policy.h"
-#include "webkit/browser/quota/quota_manager.h"
-#include "webkit/common/blob/shareable_file_reference.h"
-
-using base::PlatformFileError;
-using fileapi::FileSystemContext;
-using fileapi::FileSystemOperationRunner;
-using fileapi::FileSystemURL;
-using fileapi::FileSystemURLSet;
-using quota::QuotaManager;
-using webkit_blob::MockBlobURLRequestContext;
-using webkit_blob::ScopedTextBlob;
+
+using base::File;
+using storage::FileSystemContext;
+using storage::FileSystemOperationRunner;
+using storage::FileSystemURL;
+using storage::FileSystemURLSet;
+using storage::QuotaManager;
+using content::MockBlobURLRequestContext;
+using content::ScopedTextBlob;
namespace sync_file_system {
namespace {
-void Quit() { base::MessageLoop::current()->Quit(); }
-
template <typename R>
void AssignAndQuit(base::TaskRunner* original_task_runner,
+ const base::Closure& quit_closure,
R* result_out, R result) {
DCHECK(result_out);
*result_out = result;
- original_task_runner->PostTask(FROM_HERE, base::Bind(&Quit));
+ original_task_runner->PostTask(FROM_HERE, quit_closure);
}
template <typename R>
const tracked_objects::Location& location,
const base::Callback<void(const base::Callback<void(R)>& callback)>& task) {
R result;
+ base::RunLoop run_loop;
task_runner->PostTask(
location,
base::Bind(task, base::Bind(&AssignAndQuit<R>,
- base::MessageLoopProxy::current(),
+ base::ThreadTaskRunnerHandle::Get(),
+ run_loop.QuitClosure(),
&result)));
- base::MessageLoop::current()->Run();
+ run_loop.Run();
return result;
}
void RunOnThread(base::SingleThreadTaskRunner* task_runner,
const tracked_objects::Location& location,
const base::Closure& task) {
+ base::RunLoop run_loop;
task_runner->PostTaskAndReply(
location, task,
base::Bind(base::IgnoreResult(
- base::Bind(&base::MessageLoopProxy::PostTask,
- base::MessageLoopProxy::current(),
- FROM_HERE, base::Bind(&Quit)))));
- base::MessageLoop::current()->Run();
+ base::Bind(&base::SingleThreadTaskRunner::PostTask,
+ base::ThreadTaskRunnerHandle::Get(),
+ FROM_HERE, run_loop.QuitClosure()))));
+ run_loop.Run();
}
void EnsureRunningOn(base::SingleThreadTaskRunner* runner) {
void VerifySameTaskRunner(
base::SingleThreadTaskRunner* runner1,
base::SingleThreadTaskRunner* runner2) {
- ASSERT_TRUE(runner1 != NULL);
- ASSERT_TRUE(runner2 != NULL);
+ ASSERT_TRUE(runner1 != nullptr);
+ ASSERT_TRUE(runner2 != nullptr);
runner1->PostTask(FROM_HERE,
base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2)));
}
void OnCreateSnapshotFileAndVerifyData(
const std::string& expected_data,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
- const scoped_refptr<webkit_blob::ShareableFileReference>& /* file_ref */) {
- if (result != base::PLATFORM_FILE_OK) {
+ const scoped_refptr<storage::ShareableFileReference>& /* file_ref */) {
+ if (result != base::File::FILE_OK) {
callback.Run(result);
return;
}
}
void OnCreateSnapshotFile(
- base::PlatformFileInfo* file_info_out,
+ base::File::Info* file_info_out,
base::FilePath* platform_path_out,
const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError result,
- const base::PlatformFileInfo& file_info,
+ base::File::Error result,
+ const base::File::Info& file_info,
const base::FilePath& platform_path,
- const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) {
+ const scoped_refptr<storage::ShareableFileReference>& file_ref) {
DCHECK(!file_ref.get());
DCHECK(file_info_out);
DCHECK(platform_path_out);
callback.Run(result);
}
-void OnReadDirectory(
- CannedSyncableFileSystem::FileEntryList* entries_out,
- const CannedSyncableFileSystem::StatusCallback& callback,
- base::PlatformFileError error,
- const fileapi::FileSystemOperation::FileEntryList& entries,
- bool has_more) {
+void OnReadDirectory(CannedSyncableFileSystem::FileEntryList* entries_out,
+ const CannedSyncableFileSystem::StatusCallback& callback,
+ base::File::Error error,
+ const storage::FileSystemOperation::FileEntryList& entries,
+ bool has_more) {
DCHECK(entries_out);
entries_out->reserve(entries_out->size() + entries.size());
std::copy(entries.begin(), entries.end(), std::back_inserter(*entries_out));
~WriteHelper() {
if (request_context_) {
- base::MessageLoop::current()->DeleteSoon(FROM_HERE,
- request_context_.release());
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(
+ FROM_HERE, request_context_.release());
}
}
ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
void DidWrite(const base::Callback<void(int64 result)>& completion_callback,
- PlatformFileError error, int64 bytes, bool complete) {
- if (error == base::PLATFORM_FILE_OK) {
+ File::Error error, int64 bytes, bool complete) {
+ if (error == base::File::FILE_OK) {
bytes_written_ += bytes;
if (!complete)
return;
}
- completion_callback.Run(error == base::PLATFORM_FILE_OK
- ? bytes_written_ : static_cast<int64>(error));
+ completion_callback.Run(error == base::File::FILE_OK ?
+ bytes_written_ : static_cast<int64>(error));
}
private:
DISALLOW_COPY_AND_ASSIGN(WriteHelper);
};
-void DidGetUsageAndQuota(const quota::StatusCallback& callback,
- int64* usage_out, int64* quota_out,
- quota::QuotaStatusCode status,
- int64 usage, int64 quota) {
+void DidGetUsageAndQuota(const storage::StatusCallback& callback,
+ int64* usage_out,
+ int64* quota_out,
+ storage::QuotaStatusCode status,
+ int64 usage,
+ int64 quota) {
*usage_out = usage;
*quota_out = quota;
callback.Run(status);
CannedSyncableFileSystem::CannedSyncableFileSystem(
const GURL& origin,
- base::SingleThreadTaskRunner* io_task_runner,
- base::SingleThreadTaskRunner* file_task_runner)
+ leveldb::Env* env_override,
+ const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner,
+ const scoped_refptr<base::SingleThreadTaskRunner>& file_task_runner)
: origin_(origin),
- type_(fileapi::kFileSystemTypeSyncable),
- result_(base::PLATFORM_FILE_OK),
+ type_(storage::kFileSystemTypeSyncable),
+ result_(base::File::FILE_OK),
sync_status_(sync_file_system::SYNC_STATUS_OK),
+ env_override_(env_override),
io_task_runner_(io_task_runner),
file_task_runner_(file_task_runner),
is_filesystem_set_up_(false),
CannedSyncableFileSystem::~CannedSyncableFileSystem() {}
-void CannedSyncableFileSystem::SetUp() {
+void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) {
ASSERT_FALSE(is_filesystem_set_up_);
ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
- scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
- new quota::MockSpecialStoragePolicy();
+ scoped_refptr<storage::SpecialStoragePolicy> storage_policy =
+ new content::MockSpecialStoragePolicy();
- quota_manager_ = new QuotaManager(false /* is_incognito */,
- data_dir_.path(),
- io_task_runner_.get(),
- base::MessageLoopProxy::current().get(),
- storage_policy.get());
+ if (quota_mode == QUOTA_ENABLED) {
+ quota_manager_ = new QuotaManager(false /* is_incognito */,
+ data_dir_.path(),
+ io_task_runner_.get(),
+ base::ThreadTaskRunnerHandle::Get().get(),
+ storage_policy.get());
+ }
std::vector<std::string> additional_allowed_schemes;
additional_allowed_schemes.push_back(origin_.scheme());
- fileapi::FileSystemOptions options(
- fileapi::FileSystemOptions::PROFILE_MODE_NORMAL,
- additional_allowed_schemes);
+ storage::FileSystemOptions options(
+ storage::FileSystemOptions::PROFILE_MODE_NORMAL,
+ additional_allowed_schemes,
+ env_override_);
- ScopedVector<fileapi::FileSystemBackend> additional_backends;
+ ScopedVector<storage::FileSystemBackend> additional_backends;
additional_backends.push_back(SyncFileSystemBackend::CreateForTesting());
file_system_context_ = new FileSystemContext(
io_task_runner_.get(),
file_task_runner_.get(),
- fileapi::ExternalMountPoints::CreateRefCounted().get(),
+ storage::ExternalMountPoints::CreateRefCounted().get(),
storage_policy.get(),
- quota_manager_->proxy(),
+ quota_manager_.get() ? quota_manager_->proxy() : nullptr,
additional_backends.Pass(),
- data_dir_.path(), options);
+ std::vector<storage::URLRequestAutoMountHandler>(),
+ data_dir_.path(),
+ options);
is_filesystem_set_up_ = true;
}
void CannedSyncableFileSystem::TearDown() {
- quota_manager_ = NULL;
- file_system_context_ = NULL;
+ quota_manager_ = nullptr;
+ file_system_context_ = nullptr;
// Make sure we give some more time to finish tasks on other threads.
EnsureLastTaskRuns(io_task_runner_.get());
return file_system_context_->CrackURL(url);
}
-PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
+File::Error CannedSyncableFileSystem::OpenFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
+ base::RunLoop run_loop;
io_task_runner_->PostTask(
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoOpenFileSystem,
base::Unretained(this),
base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
base::Unretained(this),
- base::MessageLoopProxy::current())));
- base::MessageLoop::current()->Run();
+ base::ThreadTaskRunnerHandle::Get(),
+ run_loop.QuitClosure())));
+ run_loop.Run();
if (backend()->sync_context()) {
// Register 'this' as a sync status observer.
SyncStatusCode CannedSyncableFileSystem::MaybeInitializeFileSystemContext(
LocalFileSyncContext* sync_context) {
DCHECK(sync_context);
+ base::RunLoop run_loop;
sync_status_ = sync_file_system::SYNC_STATUS_UNKNOWN;
VerifySameTaskRunner(io_task_runner_.get(),
sync_context->io_task_runner_.get());
origin_,
file_system_context_.get(),
base::Bind(&CannedSyncableFileSystem::DidInitializeFileSystemContext,
- base::Unretained(this)));
- base::MessageLoop::current()->Run();
+ base::Unretained(this),
+ run_loop.QuitClosure()));
+ run_loop.Run();
return sync_status_;
}
-PlatformFileError CannedSyncableFileSystem::CreateDirectory(
+File::Error CannedSyncableFileSystem::CreateDirectory(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateDirectory,
url));
}
-PlatformFileError CannedSyncableFileSystem::CreateFile(
- const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+File::Error CannedSyncableFileSystem::CreateFile(const FileSystemURL& url) {
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoCreateFile,
url));
}
-PlatformFileError CannedSyncableFileSystem::Copy(
+File::Error CannedSyncableFileSystem::Copy(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
- io_task_runner_.get(),
- FROM_HERE,
- base::Bind(&CannedSyncableFileSystem::DoCopy,
- base::Unretained(this),
- src_url,
- dest_url));
+ return RunOnThread<File::Error>(io_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&CannedSyncableFileSystem::DoCopy,
+ base::Unretained(this),
+ src_url,
+ dest_url));
}
-PlatformFileError CannedSyncableFileSystem::Move(
+File::Error CannedSyncableFileSystem::Move(
const FileSystemURL& src_url, const FileSystemURL& dest_url) {
- return RunOnThread<PlatformFileError>(
- io_task_runner_.get(),
- FROM_HERE,
- base::Bind(&CannedSyncableFileSystem::DoMove,
- base::Unretained(this),
- src_url,
- dest_url));
+ return RunOnThread<File::Error>(io_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&CannedSyncableFileSystem::DoMove,
+ base::Unretained(this),
+ src_url,
+ dest_url));
}
-PlatformFileError CannedSyncableFileSystem::TruncateFile(
+File::Error CannedSyncableFileSystem::TruncateFile(
const FileSystemURL& url, int64 size) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTruncateFile,
size));
}
-PlatformFileError CannedSyncableFileSystem::TouchFile(
+File::Error CannedSyncableFileSystem::TouchFile(
const FileSystemURL& url,
const base::Time& last_access_time,
const base::Time& last_modified_time) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoTouchFile,
last_modified_time));
}
-PlatformFileError CannedSyncableFileSystem::Remove(
+File::Error CannedSyncableFileSystem::Remove(
const FileSystemURL& url, bool recursive) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoRemove,
recursive));
}
-PlatformFileError CannedSyncableFileSystem::FileExists(
+File::Error CannedSyncableFileSystem::FileExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoFileExists,
url));
}
-PlatformFileError CannedSyncableFileSystem::DirectoryExists(
+File::Error CannedSyncableFileSystem::DirectoryExists(
const FileSystemURL& url) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoDirectoryExists,
url));
}
-PlatformFileError CannedSyncableFileSystem::VerifyFile(
+File::Error CannedSyncableFileSystem::VerifyFile(
const FileSystemURL& url,
const std::string& expected_data) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoVerifyFile,
expected_data));
}
-PlatformFileError CannedSyncableFileSystem::GetMetadataAndPlatformPath(
+File::Error CannedSyncableFileSystem::GetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath,
platform_path));
}
-PlatformFileError CannedSyncableFileSystem::ReadDirectory(
- const fileapi::FileSystemURL& url,
+File::Error CannedSyncableFileSystem::ReadDirectory(
+ const storage::FileSystemURL& url,
FileEntryList* entries) {
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoReadDirectory,
- base::Unretained(this),
- url,
- entries));
+ base::Unretained(this),
+ url,
+ entries));
}
int64 CannedSyncableFileSystem::Write(
net::URLRequestContext* url_request_context,
const FileSystemURL& url,
- scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle) {
+ scoped_ptr<storage::BlobDataHandle> blob_data_handle) {
return RunOnThread<int64>(io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoWrite,
data));
}
-PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() {
+File::Error CannedSyncableFileSystem::DeleteFileSystem() {
EXPECT_TRUE(is_filesystem_set_up_);
- return RunOnThread<PlatformFileError>(
+ return RunOnThread<File::Error>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&FileSystemContext::DeleteFileSystem,
type_));
}
-quota::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota(
- int64* usage, int64* quota) {
- return RunOnThread<quota::QuotaStatusCode>(
+storage::QuotaStatusCode CannedSyncableFileSystem::GetUsageAndQuota(
+ int64* usage,
+ int64* quota) {
+ return RunOnThread<storage::QuotaStatusCode>(
io_task_runner_.get(),
FROM_HERE,
base::Bind(&CannedSyncableFileSystem::DoGetUsageAndQuota,
void CannedSyncableFileSystem::GetChangedURLsInTracker(
FileSystemURLSet* urls) {
- RunOnThread(
- file_task_runner_.get(),
- FROM_HERE,
- base::Bind(&LocalFileChangeTracker::GetAllChangedURLs,
- base::Unretained(backend()->change_tracker()),
- urls));
+ RunOnThread(file_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&LocalFileChangeTracker::GetAllChangedURLs,
+ base::Unretained(backend()->change_tracker()),
+ urls));
}
void CannedSyncableFileSystem::ClearChangeForURLInTracker(
const FileSystemURL& url) {
- RunOnThread(
- file_task_runner_.get(),
- FROM_HERE,
- base::Bind(&LocalFileChangeTracker::ClearChangesForURL,
- base::Unretained(backend()->change_tracker()),
- url));
+ RunOnThread(file_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&LocalFileChangeTracker::ClearChangesForURL,
+ base::Unretained(backend()->change_tracker()),
+ url));
}
void CannedSyncableFileSystem::GetChangesForURLInTracker(
const FileSystemURL& url,
FileChangeList* changes) {
- RunOnThread(
- file_task_runner_.get(),
- FROM_HERE,
- base::Bind(&LocalFileChangeTracker::GetChangesForURL,
- base::Unretained(backend()->change_tracker()),
- url, changes));
+ RunOnThread(file_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(&LocalFileChangeTracker::GetChangesForURL,
+ base::Unretained(backend()->change_tracker()),
+ url,
+ changes));
}
SyncFileSystemBackend* CannedSyncableFileSystem::backend() {
- return SyncFileSystemBackend::GetBackend(file_system_context_);
+ return SyncFileSystemBackend::GetBackend(file_system_context_.get());
}
FileSystemOperationRunner* CannedSyncableFileSystem::operation_runner() {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
EXPECT_FALSE(is_filesystem_opened_);
file_system_context_->OpenFileSystem(
- origin_, type_,
- fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
+ origin_,
+ type_,
+ storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT,
callback);
}
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
EXPECT_TRUE(is_filesystem_opened_);
operation_runner()->Copy(
- src_url, dest_url,
- fileapi::FileSystemOperation::OPTION_NONE,
- fileapi::FileSystemOperationRunner::CopyProgressCallback(), callback);
+ src_url,
+ dest_url,
+ storage::FileSystemOperation::OPTION_NONE,
+ storage::FileSystemOperationRunner::CopyProgressCallback(),
+ callback);
}
void CannedSyncableFileSystem::DoMove(
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
EXPECT_TRUE(is_filesystem_opened_);
operation_runner()->Move(
- src_url, dest_url, fileapi::FileSystemOperation::OPTION_NONE, callback);
+ src_url, dest_url, storage::FileSystemOperation::OPTION_NONE, callback);
}
void CannedSyncableFileSystem::DoTruncateFile(
void CannedSyncableFileSystem::DoGetMetadataAndPlatformPath(
const FileSystemURL& url,
- base::PlatformFileInfo* info,
+ base::File::Info* info,
base::FilePath* platform_path,
const StatusCallback& callback) {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
void CannedSyncableFileSystem::DoWrite(
net::URLRequestContext* url_request_context,
const FileSystemURL& url,
- scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle,
+ scoped_ptr<storage::BlobDataHandle> blob_data_handle,
const WriteCallback& callback) {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
EXPECT_TRUE(is_filesystem_opened_);
void CannedSyncableFileSystem::DoGetUsageAndQuota(
int64* usage,
int64* quota,
- const quota::StatusCallback& callback) {
+ const storage::StatusCallback& callback) {
EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread());
EXPECT_TRUE(is_filesystem_opened_);
+ DCHECK(quota_manager_.get());
quota_manager_->GetUsageAndQuota(
origin_, storage_type(),
base::Bind(&DidGetUsageAndQuota, callback, usage, quota));
void CannedSyncableFileSystem::DidOpenFileSystem(
base::SingleThreadTaskRunner* original_task_runner,
+ const base::Closure& quit_closure,
const GURL& root,
const std::string& name,
- PlatformFileError result) {
+ File::Error result) {
if (io_task_runner_->RunsTasksOnCurrentThread()) {
EXPECT_FALSE(is_filesystem_opened_);
is_filesystem_opened_ = true;
base::Bind(&CannedSyncableFileSystem::DidOpenFileSystem,
base::Unretained(this),
make_scoped_refptr(original_task_runner),
+ quit_closure,
root, name, result));
return;
}
result_ = result;
root_url_ = root;
- base::MessageLoop::current()->Quit();
+ quit_closure.Run();
}
void CannedSyncableFileSystem::DidInitializeFileSystemContext(
+ const base::Closure& quit_closure,
SyncStatusCode status) {
sync_status_ = status;
- base::MessageLoop::current()->Quit();
+ quit_closure.Run();
}
void CannedSyncableFileSystem::InitializeSyncStatusObserver() {