| Index: webkit/fileapi/syncable/canned_syncable_file_system.cc
|
| diff --git a/webkit/fileapi/syncable/canned_syncable_file_system.cc b/webkit/fileapi/syncable/canned_syncable_file_system.cc
|
| index 50e4c51027ee3fe7e0ff37bf6438b5308c5568cc..24ca9e067fce2179df140746ac7749bc83987341 100644
|
| --- a/webkit/fileapi/syncable/canned_syncable_file_system.cc
|
| +++ b/webkit/fileapi/syncable/canned_syncable_file_system.cc
|
| @@ -29,12 +29,15 @@ CannedSyncableFileSystem::CannedSyncableFileSystem(
|
| test_helper_(origin, kFileSystemTypeSyncable),
|
| result_(base::PLATFORM_FILE_OK),
|
| sync_status_(SYNC_STATUS_OK),
|
| + is_filesystem_set_up_(false),
|
| + is_filesystem_opened_(false),
|
| weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
|
| }
|
|
|
| CannedSyncableFileSystem::~CannedSyncableFileSystem() {}
|
|
|
| void CannedSyncableFileSystem::SetUp() {
|
| + ASSERT_FALSE(is_filesystem_set_up_);
|
| ASSERT_TRUE(data_dir_.CreateUniqueTempDir());
|
|
|
| scoped_refptr<quota::SpecialStoragePolicy> storage_policy =
|
| @@ -55,6 +58,7 @@ void CannedSyncableFileSystem::SetUp() {
|
| CreateAllowFileAccessOptions());
|
|
|
| test_helper_.SetUp(file_system_context_.get(), NULL);
|
| + is_filesystem_set_up_ = true;
|
| }
|
|
|
| void CannedSyncableFileSystem::TearDown() {
|
| @@ -63,10 +67,14 @@ void CannedSyncableFileSystem::TearDown() {
|
| }
|
|
|
| FileSystemURL CannedSyncableFileSystem::URL(const std::string& path) const {
|
| + EXPECT_TRUE(is_filesystem_set_up_);
|
| + EXPECT_TRUE(is_filesystem_opened_);
|
| return FileSystemURL(GURL(root_url_.spec() + path));
|
| }
|
|
|
| PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
|
| + EXPECT_TRUE(is_filesystem_set_up_);
|
| + EXPECT_FALSE(is_filesystem_opened_);
|
| file_system_context_->OpenSyncableFileSystem(
|
| service_name_,
|
| test_helper_.origin(), test_helper_.type(),
|
| @@ -79,6 +87,7 @@ PlatformFileError CannedSyncableFileSystem::OpenFileSystem() {
|
|
|
| PlatformFileError CannedSyncableFileSystem::CreateDirectory(
|
| const FileSystemURL& url) {
|
| + EXPECT_TRUE(is_filesystem_opened_);
|
| result_ = base::PLATFORM_FILE_ERROR_FAILED;
|
| test_helper_.NewOperation()->CreateDirectory(
|
| url, false /* exclusive */, false /* recursive */,
|
| @@ -90,6 +99,7 @@ PlatformFileError CannedSyncableFileSystem::CreateDirectory(
|
|
|
| PlatformFileError CannedSyncableFileSystem::CreateFile(
|
| const FileSystemURL& url) {
|
| + EXPECT_TRUE(is_filesystem_opened_);
|
| result_ = base::PLATFORM_FILE_ERROR_FAILED;
|
| test_helper_.NewOperation()->CreateFile(
|
| url, false /* exclusive */,
|
| @@ -101,6 +111,7 @@ PlatformFileError CannedSyncableFileSystem::CreateFile(
|
|
|
| PlatformFileError CannedSyncableFileSystem::TruncateFile(
|
| const FileSystemURL& url, int64 size) {
|
| + EXPECT_TRUE(is_filesystem_opened_);
|
| result_ = base::PLATFORM_FILE_ERROR_FAILED;
|
| test_helper_.NewOperation()->Truncate(
|
| url, size,
|
| @@ -112,6 +123,7 @@ PlatformFileError CannedSyncableFileSystem::TruncateFile(
|
|
|
| PlatformFileError CannedSyncableFileSystem::Remove(
|
| const FileSystemURL& url, bool recursive) {
|
| + EXPECT_TRUE(is_filesystem_opened_);
|
| result_ = base::PLATFORM_FILE_ERROR_FAILED;
|
| test_helper_.NewOperation()->Remove(
|
| url, recursive,
|
| @@ -122,6 +134,7 @@ PlatformFileError CannedSyncableFileSystem::Remove(
|
| }
|
|
|
| PlatformFileError CannedSyncableFileSystem::DeleteFileSystem() {
|
| + EXPECT_TRUE(is_filesystem_set_up_);
|
| file_system_context_->DeleteFileSystem(
|
| test_helper_.origin(), test_helper_.type(),
|
| base::Bind(&CannedSyncableFileSystem::StatusCallback,
|
| @@ -134,6 +147,7 @@ void CannedSyncableFileSystem::DidOpenFileSystem(
|
| PlatformFileError result, const std::string& name, const GURL& root) {
|
| result_ = result;
|
| root_url_ = root;
|
| + is_filesystem_opened_ = true;
|
| }
|
|
|
| void CannedSyncableFileSystem::StatusCallback(PlatformFileError result) {
|
|
|