| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" | 5 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 14 #include "base/guid.h" | 14 #include "base/guid.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/task_runner_util.h" | 17 #include "base/task_runner_util.h" |
| 18 #include "base/thread_task_runner_handle.h" | 18 #include "base/thread_task_runner_handle.h" |
| 19 #include "chrome/browser/sync_file_system/file_change.h" | 19 #include "chrome/browser/sync_file_system/file_change.h" |
| 20 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" | 20 #include "chrome/browser/sync_file_system/local/local_file_change_tracker.h" |
| 21 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" | 21 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h" |
| 22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" | 22 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" |
| 23 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" | 23 #include "chrome/browser/sync_file_system/syncable_file_system_util.h" |
| 24 #include "content/public/test/mock_blob_url_request_context.h" | 24 #include "content/public/test/mock_blob_url_request_context.h" |
| 25 #include "content/public/test/mock_special_storage_policy.h" | 25 #include "content/public/test/mock_special_storage_policy.h" |
| 26 #include "content/public/test/test_file_system_options.h" | 26 #include "content/public/test/test_file_system_options.h" |
| 27 #include "testing/gtest/include/gtest/gtest.h" | 27 #include "testing/gtest/include/gtest/gtest.h" |
| 28 #include "webkit/browser/fileapi/external_mount_points.h" | 28 #include "storage/browser/fileapi/external_mount_points.h" |
| 29 #include "webkit/browser/fileapi/file_system_backend.h" | 29 #include "storage/browser/fileapi/file_system_backend.h" |
| 30 #include "webkit/browser/fileapi/file_system_context.h" | 30 #include "storage/browser/fileapi/file_system_context.h" |
| 31 #include "webkit/browser/fileapi/file_system_operation_context.h" | 31 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 32 #include "webkit/browser/fileapi/file_system_operation_runner.h" | 32 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 33 #include "webkit/browser/quota/quota_manager.h" | 33 #include "storage/browser/quota/quota_manager.h" |
| 34 #include "webkit/common/blob/shareable_file_reference.h" | 34 #include "storage/common/blob/shareable_file_reference.h" |
| 35 | 35 |
| 36 using base::File; | 36 using base::File; |
| 37 using fileapi::FileSystemContext; | 37 using storage::FileSystemContext; |
| 38 using fileapi::FileSystemOperationRunner; | 38 using storage::FileSystemOperationRunner; |
| 39 using fileapi::FileSystemURL; | 39 using storage::FileSystemURL; |
| 40 using fileapi::FileSystemURLSet; | 40 using storage::FileSystemURLSet; |
| 41 using quota::QuotaManager; | 41 using quota::QuotaManager; |
| 42 using content::MockBlobURLRequestContext; | 42 using content::MockBlobURLRequestContext; |
| 43 using content::ScopedTextBlob; | 43 using content::ScopedTextBlob; |
| 44 | 44 |
| 45 namespace sync_file_system { | 45 namespace sync_file_system { |
| 46 | 46 |
| 47 namespace { | 47 namespace { |
| 48 | 48 |
| 49 template <typename R> | 49 template <typename R> |
| 50 void AssignAndQuit(base::TaskRunner* original_task_runner, | 50 void AssignAndQuit(base::TaskRunner* original_task_runner, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 runner1->PostTask(FROM_HERE, | 97 runner1->PostTask(FROM_HERE, |
| 98 base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2))); | 98 base::Bind(&EnsureRunningOn, make_scoped_refptr(runner2))); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void OnCreateSnapshotFileAndVerifyData( | 101 void OnCreateSnapshotFileAndVerifyData( |
| 102 const std::string& expected_data, | 102 const std::string& expected_data, |
| 103 const CannedSyncableFileSystem::StatusCallback& callback, | 103 const CannedSyncableFileSystem::StatusCallback& callback, |
| 104 base::File::Error result, | 104 base::File::Error result, |
| 105 const base::File::Info& file_info, | 105 const base::File::Info& file_info, |
| 106 const base::FilePath& platform_path, | 106 const base::FilePath& platform_path, |
| 107 const scoped_refptr<webkit_blob::ShareableFileReference>& /* file_ref */) { | 107 const scoped_refptr<storage::ShareableFileReference>& /* file_ref */) { |
| 108 if (result != base::File::FILE_OK) { | 108 if (result != base::File::FILE_OK) { |
| 109 callback.Run(result); | 109 callback.Run(result); |
| 110 return; | 110 return; |
| 111 } | 111 } |
| 112 EXPECT_EQ(expected_data.size(), static_cast<size_t>(file_info.size)); | 112 EXPECT_EQ(expected_data.size(), static_cast<size_t>(file_info.size)); |
| 113 std::string data; | 113 std::string data; |
| 114 const bool read_status = base::ReadFileToString(platform_path, &data); | 114 const bool read_status = base::ReadFileToString(platform_path, &data); |
| 115 EXPECT_TRUE(read_status); | 115 EXPECT_TRUE(read_status); |
| 116 EXPECT_EQ(expected_data, data); | 116 EXPECT_EQ(expected_data, data); |
| 117 callback.Run(result); | 117 callback.Run(result); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void OnCreateSnapshotFile( | 120 void OnCreateSnapshotFile( |
| 121 base::File::Info* file_info_out, | 121 base::File::Info* file_info_out, |
| 122 base::FilePath* platform_path_out, | 122 base::FilePath* platform_path_out, |
| 123 const CannedSyncableFileSystem::StatusCallback& callback, | 123 const CannedSyncableFileSystem::StatusCallback& callback, |
| 124 base::File::Error result, | 124 base::File::Error result, |
| 125 const base::File::Info& file_info, | 125 const base::File::Info& file_info, |
| 126 const base::FilePath& platform_path, | 126 const base::FilePath& platform_path, |
| 127 const scoped_refptr<webkit_blob::ShareableFileReference>& file_ref) { | 127 const scoped_refptr<storage::ShareableFileReference>& file_ref) { |
| 128 DCHECK(!file_ref.get()); | 128 DCHECK(!file_ref.get()); |
| 129 DCHECK(file_info_out); | 129 DCHECK(file_info_out); |
| 130 DCHECK(platform_path_out); | 130 DCHECK(platform_path_out); |
| 131 *file_info_out = file_info; | 131 *file_info_out = file_info; |
| 132 *platform_path_out = platform_path; | 132 *platform_path_out = platform_path; |
| 133 callback.Run(result); | 133 callback.Run(result); |
| 134 } | 134 } |
| 135 | 135 |
| 136 void OnReadDirectory( | 136 void OnReadDirectory(CannedSyncableFileSystem::FileEntryList* entries_out, |
| 137 CannedSyncableFileSystem::FileEntryList* entries_out, | 137 const CannedSyncableFileSystem::StatusCallback& callback, |
| 138 const CannedSyncableFileSystem::StatusCallback& callback, | 138 base::File::Error error, |
| 139 base::File::Error error, | 139 const storage::FileSystemOperation::FileEntryList& entries, |
| 140 const fileapi::FileSystemOperation::FileEntryList& entries, | 140 bool has_more) { |
| 141 bool has_more) { | |
| 142 DCHECK(entries_out); | 141 DCHECK(entries_out); |
| 143 entries_out->reserve(entries_out->size() + entries.size()); | 142 entries_out->reserve(entries_out->size() + entries.size()); |
| 144 std::copy(entries.begin(), entries.end(), std::back_inserter(*entries_out)); | 143 std::copy(entries.begin(), entries.end(), std::back_inserter(*entries_out)); |
| 145 | 144 |
| 146 if (!has_more) | 145 if (!has_more) |
| 147 callback.Run(error); | 146 callback.Run(error); |
| 148 } | 147 } |
| 149 | 148 |
| 150 class WriteHelper { | 149 class WriteHelper { |
| 151 public: | 150 public: |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 } | 203 } |
| 205 | 204 |
| 206 } // namespace | 205 } // namespace |
| 207 | 206 |
| 208 CannedSyncableFileSystem::CannedSyncableFileSystem( | 207 CannedSyncableFileSystem::CannedSyncableFileSystem( |
| 209 const GURL& origin, | 208 const GURL& origin, |
| 210 leveldb::Env* env_override, | 209 leveldb::Env* env_override, |
| 211 base::SingleThreadTaskRunner* io_task_runner, | 210 base::SingleThreadTaskRunner* io_task_runner, |
| 212 base::SingleThreadTaskRunner* file_task_runner) | 211 base::SingleThreadTaskRunner* file_task_runner) |
| 213 : origin_(origin), | 212 : origin_(origin), |
| 214 type_(fileapi::kFileSystemTypeSyncable), | 213 type_(storage::kFileSystemTypeSyncable), |
| 215 result_(base::File::FILE_OK), | 214 result_(base::File::FILE_OK), |
| 216 sync_status_(sync_file_system::SYNC_STATUS_OK), | 215 sync_status_(sync_file_system::SYNC_STATUS_OK), |
| 217 env_override_(env_override), | 216 env_override_(env_override), |
| 218 io_task_runner_(io_task_runner), | 217 io_task_runner_(io_task_runner), |
| 219 file_task_runner_(file_task_runner), | 218 file_task_runner_(file_task_runner), |
| 220 is_filesystem_set_up_(false), | 219 is_filesystem_set_up_(false), |
| 221 is_filesystem_opened_(false), | 220 is_filesystem_opened_(false), |
| 222 sync_status_observers_(new ObserverList) { | 221 sync_status_observers_(new ObserverList) { |
| 223 } | 222 } |
| 224 | 223 |
| 225 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} | 224 CannedSyncableFileSystem::~CannedSyncableFileSystem() {} |
| 226 | 225 |
| 227 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { | 226 void CannedSyncableFileSystem::SetUp(QuotaMode quota_mode) { |
| 228 ASSERT_FALSE(is_filesystem_set_up_); | 227 ASSERT_FALSE(is_filesystem_set_up_); |
| 229 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); | 228 ASSERT_TRUE(data_dir_.CreateUniqueTempDir()); |
| 230 | 229 |
| 231 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = | 230 scoped_refptr<quota::SpecialStoragePolicy> storage_policy = |
| 232 new content::MockSpecialStoragePolicy(); | 231 new content::MockSpecialStoragePolicy(); |
| 233 | 232 |
| 234 if (quota_mode == QUOTA_ENABLED) { | 233 if (quota_mode == QUOTA_ENABLED) { |
| 235 quota_manager_ = new QuotaManager(false /* is_incognito */, | 234 quota_manager_ = new QuotaManager(false /* is_incognito */, |
| 236 data_dir_.path(), | 235 data_dir_.path(), |
| 237 io_task_runner_, | 236 io_task_runner_, |
| 238 base::ThreadTaskRunnerHandle::Get().get(), | 237 base::ThreadTaskRunnerHandle::Get().get(), |
| 239 storage_policy.get()); | 238 storage_policy.get()); |
| 240 } | 239 } |
| 241 | 240 |
| 242 std::vector<std::string> additional_allowed_schemes; | 241 std::vector<std::string> additional_allowed_schemes; |
| 243 additional_allowed_schemes.push_back(origin_.scheme()); | 242 additional_allowed_schemes.push_back(origin_.scheme()); |
| 244 fileapi::FileSystemOptions options( | 243 storage::FileSystemOptions options( |
| 245 fileapi::FileSystemOptions::PROFILE_MODE_NORMAL, | 244 storage::FileSystemOptions::PROFILE_MODE_NORMAL, |
| 246 additional_allowed_schemes, | 245 additional_allowed_schemes, |
| 247 env_override_); | 246 env_override_); |
| 248 | 247 |
| 249 ScopedVector<fileapi::FileSystemBackend> additional_backends; | 248 ScopedVector<storage::FileSystemBackend> additional_backends; |
| 250 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); | 249 additional_backends.push_back(SyncFileSystemBackend::CreateForTesting()); |
| 251 | 250 |
| 252 file_system_context_ = new FileSystemContext( | 251 file_system_context_ = new FileSystemContext( |
| 253 io_task_runner_, | 252 io_task_runner_, |
| 254 file_task_runner_, | 253 file_task_runner_, |
| 255 fileapi::ExternalMountPoints::CreateRefCounted().get(), | 254 storage::ExternalMountPoints::CreateRefCounted().get(), |
| 256 storage_policy.get(), | 255 storage_policy.get(), |
| 257 quota_manager_ ? quota_manager_->proxy() : NULL, | 256 quota_manager_ ? quota_manager_->proxy() : NULL, |
| 258 additional_backends.Pass(), | 257 additional_backends.Pass(), |
| 259 std::vector<fileapi::URLRequestAutoMountHandler>(), | 258 std::vector<storage::URLRequestAutoMountHandler>(), |
| 260 data_dir_.path(), options); | 259 data_dir_.path(), |
| 260 options); |
| 261 | 261 |
| 262 is_filesystem_set_up_ = true; | 262 is_filesystem_set_up_ = true; |
| 263 } | 263 } |
| 264 | 264 |
| 265 void CannedSyncableFileSystem::TearDown() { | 265 void CannedSyncableFileSystem::TearDown() { |
| 266 quota_manager_ = NULL; | 266 quota_manager_ = NULL; |
| 267 file_system_context_ = NULL; | 267 file_system_context_ = NULL; |
| 268 | 268 |
| 269 // Make sure we give some more time to finish tasks on other threads. | 269 // Make sure we give some more time to finish tasks on other threads. |
| 270 EnsureLastTaskRuns(io_task_runner_); | 270 EnsureLastTaskRuns(io_task_runner_); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 io_task_runner_, | 448 io_task_runner_, |
| 449 FROM_HERE, | 449 FROM_HERE, |
| 450 base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath, | 450 base::Bind(&CannedSyncableFileSystem::DoGetMetadataAndPlatformPath, |
| 451 base::Unretained(this), | 451 base::Unretained(this), |
| 452 url, | 452 url, |
| 453 info, | 453 info, |
| 454 platform_path)); | 454 platform_path)); |
| 455 } | 455 } |
| 456 | 456 |
| 457 File::Error CannedSyncableFileSystem::ReadDirectory( | 457 File::Error CannedSyncableFileSystem::ReadDirectory( |
| 458 const fileapi::FileSystemURL& url, | 458 const storage::FileSystemURL& url, |
| 459 FileEntryList* entries) { | 459 FileEntryList* entries) { |
| 460 return RunOnThread<File::Error>( | 460 return RunOnThread<File::Error>( |
| 461 io_task_runner_, | 461 io_task_runner_, |
| 462 FROM_HERE, | 462 FROM_HERE, |
| 463 base::Bind(&CannedSyncableFileSystem::DoReadDirectory, | 463 base::Bind(&CannedSyncableFileSystem::DoReadDirectory, |
| 464 base::Unretained(this), | 464 base::Unretained(this), |
| 465 url, | 465 url, |
| 466 entries)); | 466 entries)); |
| 467 } | 467 } |
| 468 | 468 |
| 469 int64 CannedSyncableFileSystem::Write( | 469 int64 CannedSyncableFileSystem::Write( |
| 470 net::URLRequestContext* url_request_context, | 470 net::URLRequestContext* url_request_context, |
| 471 const FileSystemURL& url, | 471 const FileSystemURL& url, |
| 472 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle) { | 472 scoped_ptr<storage::BlobDataHandle> blob_data_handle) { |
| 473 return RunOnThread<int64>(io_task_runner_, | 473 return RunOnThread<int64>(io_task_runner_, |
| 474 FROM_HERE, | 474 FROM_HERE, |
| 475 base::Bind(&CannedSyncableFileSystem::DoWrite, | 475 base::Bind(&CannedSyncableFileSystem::DoWrite, |
| 476 base::Unretained(this), | 476 base::Unretained(this), |
| 477 url_request_context, | 477 url_request_context, |
| 478 url, | 478 url, |
| 479 base::Passed(&blob_data_handle))); | 479 base::Passed(&blob_data_handle))); |
| 480 } | 480 } |
| 481 | 481 |
| 482 int64 CannedSyncableFileSystem::WriteString( | 482 int64 CannedSyncableFileSystem::WriteString( |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 void CannedSyncableFileSystem::OnWriteEnabled(const FileSystemURL& url) { | 558 void CannedSyncableFileSystem::OnWriteEnabled(const FileSystemURL& url) { |
| 559 sync_status_observers_->Notify(&LocalFileSyncStatus::Observer::OnWriteEnabled, | 559 sync_status_observers_->Notify(&LocalFileSyncStatus::Observer::OnWriteEnabled, |
| 560 url); | 560 url); |
| 561 } | 561 } |
| 562 | 562 |
| 563 void CannedSyncableFileSystem::DoOpenFileSystem( | 563 void CannedSyncableFileSystem::DoOpenFileSystem( |
| 564 const OpenFileSystemCallback& callback) { | 564 const OpenFileSystemCallback& callback) { |
| 565 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 565 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 566 EXPECT_FALSE(is_filesystem_opened_); | 566 EXPECT_FALSE(is_filesystem_opened_); |
| 567 file_system_context_->OpenFileSystem( | 567 file_system_context_->OpenFileSystem( |
| 568 origin_, type_, | 568 origin_, |
| 569 fileapi::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, | 569 type_, |
| 570 storage::OPEN_FILE_SYSTEM_CREATE_IF_NONEXISTENT, |
| 570 callback); | 571 callback); |
| 571 } | 572 } |
| 572 | 573 |
| 573 void CannedSyncableFileSystem::DoCreateDirectory( | 574 void CannedSyncableFileSystem::DoCreateDirectory( |
| 574 const FileSystemURL& url, | 575 const FileSystemURL& url, |
| 575 const StatusCallback& callback) { | 576 const StatusCallback& callback) { |
| 576 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 577 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 577 EXPECT_TRUE(is_filesystem_opened_); | 578 EXPECT_TRUE(is_filesystem_opened_); |
| 578 operation_runner()->CreateDirectory( | 579 operation_runner()->CreateDirectory( |
| 579 url, false /* exclusive */, false /* recursive */, callback); | 580 url, false /* exclusive */, false /* recursive */, callback); |
| 580 } | 581 } |
| 581 | 582 |
| 582 void CannedSyncableFileSystem::DoCreateFile( | 583 void CannedSyncableFileSystem::DoCreateFile( |
| 583 const FileSystemURL& url, | 584 const FileSystemURL& url, |
| 584 const StatusCallback& callback) { | 585 const StatusCallback& callback) { |
| 585 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 586 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 586 EXPECT_TRUE(is_filesystem_opened_); | 587 EXPECT_TRUE(is_filesystem_opened_); |
| 587 operation_runner()->CreateFile(url, false /* exclusive */, callback); | 588 operation_runner()->CreateFile(url, false /* exclusive */, callback); |
| 588 } | 589 } |
| 589 | 590 |
| 590 void CannedSyncableFileSystem::DoCopy( | 591 void CannedSyncableFileSystem::DoCopy( |
| 591 const FileSystemURL& src_url, | 592 const FileSystemURL& src_url, |
| 592 const FileSystemURL& dest_url, | 593 const FileSystemURL& dest_url, |
| 593 const StatusCallback& callback) { | 594 const StatusCallback& callback) { |
| 594 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 595 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 595 EXPECT_TRUE(is_filesystem_opened_); | 596 EXPECT_TRUE(is_filesystem_opened_); |
| 596 operation_runner()->Copy( | 597 operation_runner()->Copy( |
| 597 src_url, dest_url, | 598 src_url, |
| 598 fileapi::FileSystemOperation::OPTION_NONE, | 599 dest_url, |
| 599 fileapi::FileSystemOperationRunner::CopyProgressCallback(), callback); | 600 storage::FileSystemOperation::OPTION_NONE, |
| 601 storage::FileSystemOperationRunner::CopyProgressCallback(), |
| 602 callback); |
| 600 } | 603 } |
| 601 | 604 |
| 602 void CannedSyncableFileSystem::DoMove( | 605 void CannedSyncableFileSystem::DoMove( |
| 603 const FileSystemURL& src_url, | 606 const FileSystemURL& src_url, |
| 604 const FileSystemURL& dest_url, | 607 const FileSystemURL& dest_url, |
| 605 const StatusCallback& callback) { | 608 const StatusCallback& callback) { |
| 606 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 609 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 607 EXPECT_TRUE(is_filesystem_opened_); | 610 EXPECT_TRUE(is_filesystem_opened_); |
| 608 operation_runner()->Move( | 611 operation_runner()->Move( |
| 609 src_url, dest_url, fileapi::FileSystemOperation::OPTION_NONE, callback); | 612 src_url, dest_url, storage::FileSystemOperation::OPTION_NONE, callback); |
| 610 } | 613 } |
| 611 | 614 |
| 612 void CannedSyncableFileSystem::DoTruncateFile( | 615 void CannedSyncableFileSystem::DoTruncateFile( |
| 613 const FileSystemURL& url, int64 size, | 616 const FileSystemURL& url, int64 size, |
| 614 const StatusCallback& callback) { | 617 const StatusCallback& callback) { |
| 615 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 618 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 616 EXPECT_TRUE(is_filesystem_opened_); | 619 EXPECT_TRUE(is_filesystem_opened_); |
| 617 operation_runner()->Truncate(url, size, callback); | 620 operation_runner()->Truncate(url, size, callback); |
| 618 } | 621 } |
| 619 | 622 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 const StatusCallback& callback) { | 681 const StatusCallback& callback) { |
| 679 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 682 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 680 EXPECT_TRUE(is_filesystem_opened_); | 683 EXPECT_TRUE(is_filesystem_opened_); |
| 681 operation_runner()->ReadDirectory( | 684 operation_runner()->ReadDirectory( |
| 682 url, base::Bind(&OnReadDirectory, entries, callback)); | 685 url, base::Bind(&OnReadDirectory, entries, callback)); |
| 683 } | 686 } |
| 684 | 687 |
| 685 void CannedSyncableFileSystem::DoWrite( | 688 void CannedSyncableFileSystem::DoWrite( |
| 686 net::URLRequestContext* url_request_context, | 689 net::URLRequestContext* url_request_context, |
| 687 const FileSystemURL& url, | 690 const FileSystemURL& url, |
| 688 scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle, | 691 scoped_ptr<storage::BlobDataHandle> blob_data_handle, |
| 689 const WriteCallback& callback) { | 692 const WriteCallback& callback) { |
| 690 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 693 EXPECT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 691 EXPECT_TRUE(is_filesystem_opened_); | 694 EXPECT_TRUE(is_filesystem_opened_); |
| 692 WriteHelper* helper = new WriteHelper; | 695 WriteHelper* helper = new WriteHelper; |
| 693 operation_runner()->Write(url_request_context, url, | 696 operation_runner()->Write(url_request_context, url, |
| 694 blob_data_handle.Pass(), 0, | 697 blob_data_handle.Pass(), 0, |
| 695 base::Bind(&WriteHelper::DidWrite, | 698 base::Bind(&WriteHelper::DidWrite, |
| 696 base::Owned(helper), callback)); | 699 base::Owned(helper), callback)); |
| 697 } | 700 } |
| 698 | 701 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 sync_status_ = status; | 758 sync_status_ = status; |
| 756 quit_closure.Run(); | 759 quit_closure.Run(); |
| 757 } | 760 } |
| 758 | 761 |
| 759 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { | 762 void CannedSyncableFileSystem::InitializeSyncStatusObserver() { |
| 760 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); | 763 ASSERT_TRUE(io_task_runner_->RunsTasksOnCurrentThread()); |
| 761 backend()->sync_context()->sync_status()->AddObserver(this); | 764 backend()->sync_context()->sync_status()->AddObserver(this); |
| 762 } | 765 } |
| 763 | 766 |
| 764 } // namespace sync_file_system | 767 } // namespace sync_file_system |
| OLD | NEW |