| Index: webkit/fileapi/syncable/canned_syncable_file_system.cc
|
| ===================================================================
|
| --- webkit/fileapi/syncable/canned_syncable_file_system.cc (revision 186525)
|
| +++ webkit/fileapi/syncable/canned_syncable_file_system.cc (working copy)
|
| @@ -12,6 +12,7 @@
|
| #include "base/single_thread_task_runner.h"
|
| #include "base/task_runner_util.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "webkit/blob/blob_storage_context.h"
|
| #include "webkit/blob/mock_blob_url_request_context.h"
|
| #include "webkit/fileapi/external_mount_points.h"
|
| #include "webkit/fileapi/file_system_context.h"
|
| @@ -124,11 +125,11 @@
|
| public:
|
| WriteHelper() : bytes_written_(0) {}
|
| WriteHelper(MockBlobURLRequestContext* request_context,
|
| - const GURL& blob_url,
|
| + const std::string& blob_id,
|
| const std::string& blob_data)
|
| : bytes_written_(0),
|
| request_context_(request_context),
|
| - blob_data_(new ScopedTextBlob(*request_context, blob_url, blob_data)) {}
|
| + blob_data_(new ScopedTextBlob(*request_context, blob_id, blob_data)) {}
|
|
|
| ~WriteHelper() {
|
| if (request_context_)
|
| @@ -146,6 +147,8 @@
|
| ? bytes_written_ : static_cast<int64>(error));
|
| }
|
|
|
| + ScopedTextBlob* scoped_text_blob() const { return blob_data_.get(); }
|
| +
|
| private:
|
| int64 bytes_written_;
|
| scoped_ptr<MockBlobURLRequestContext> request_context_;
|
| @@ -389,12 +392,12 @@
|
|
|
| int64 CannedSyncableFileSystem::Write(
|
| net::URLRequestContext* url_request_context,
|
| - const FileSystemURL& url, const GURL& blob_url) {
|
| + const FileSystemURL& url, scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle) {
|
| return RunOnThread<int64>(
|
| io_task_runner_,
|
| FROM_HERE,
|
| base::Bind(&CannedSyncableFileSystem::DoWrite,
|
| - base::Unretained(this), url_request_context, url, blob_url));
|
| + base::Unretained(this), url_request_context, url, base::Passed(&blob_data_handle)));
|
| }
|
|
|
| int64 CannedSyncableFileSystem::WriteString(
|
| @@ -553,11 +556,12 @@
|
|
|
| void CannedSyncableFileSystem::DoWrite(
|
| net::URLRequestContext* url_request_context,
|
| - const FileSystemURL& url, const GURL& blob_url,
|
| + const FileSystemURL& url,
|
| + scoped_ptr<webkit_blob::BlobDataHandle> blob_data_handle,
|
| const WriteCallback& callback) {
|
| EXPECT_TRUE(is_filesystem_opened_);
|
| WriteHelper* helper = new WriteHelper;
|
| - NewOperation()->Write(url_request_context, url, blob_url, 0,
|
| + NewOperation()->Write(url_request_context, url, blob_data_handle.Pass(), 0,
|
| base::Bind(&WriteHelper::DidWrite,
|
| base::Owned(helper), callback));
|
| }
|
| @@ -568,9 +572,10 @@
|
| const WriteCallback& callback) {
|
| MockBlobURLRequestContext* url_request_context(
|
| new MockBlobURLRequestContext(file_system_context_));
|
| - const GURL blob_url(std::string("blob:") + data);
|
| - WriteHelper* helper = new WriteHelper(url_request_context, blob_url, data);
|
| - NewOperation()->Write(url_request_context, url, blob_url, 0,
|
| + const std::string blob_id(std::string("blob:") + data);
|
| + WriteHelper* helper = new WriteHelper(url_request_context, blob_id, data);
|
| + NewOperation()->Write(url_request_context, url,
|
| + helper->scoped_text_blob()->GetBlobDataHandle(), 0,
|
| base::Bind(&WriteHelper::DidWrite,
|
| base::Owned(helper), callback));
|
| }
|
|
|