Commit e8539907 authored by pilgrim@chromium.org's avatar pilgrim@chromium.org

Move blob/mock_blob_url_request_context to content/

BUG=338338

Review URL: https://codereview.chromium.org/146963006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247618 0039d316-1c4b-4281-b951-d872f2087c98
parent feaebc68
...@@ -21,9 +21,9 @@ ...@@ -21,9 +21,9 @@
#include "chrome/browser/sync_file_system/local/local_file_sync_context.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/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.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/test_file_system_options.h" #include "content/public/test/test_file_system_options.h"
#include "testing/gtest/include/gtest/gtest.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/external_mount_points.h"
#include "webkit/browser/fileapi/file_system_backend.h" #include "webkit/browser/fileapi/file_system_backend.h"
#include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_context.h"
...@@ -39,8 +39,8 @@ using fileapi::FileSystemOperationRunner; ...@@ -39,8 +39,8 @@ using fileapi::FileSystemOperationRunner;
using fileapi::FileSystemURL; using fileapi::FileSystemURL;
using fileapi::FileSystemURLSet; using fileapi::FileSystemURLSet;
using quota::QuotaManager; using quota::QuotaManager;
using webkit_blob::MockBlobURLRequestContext; using content::MockBlobURLRequestContext;
using webkit_blob::ScopedTextBlob; using content::ScopedTextBlob;
namespace sync_file_system { namespace sync_file_system {
......
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
#include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
#include "chrome/browser/sync_file_system/sync_status_code.h" #include "chrome/browser/sync_file_system/sync_status_code.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h" #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "content/public/test/mock_blob_url_request_context.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webkit/browser/blob/mock_blob_url_request_context.h"
#include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/quota/quota_manager.h" #include "webkit/browser/quota/quota_manager.h"
using fileapi::FileSystemContext; using fileapi::FileSystemContext;
using fileapi::FileSystemURL; using fileapi::FileSystemURL;
using fileapi::FileSystemURLSet; using fileapi::FileSystemURLSet;
using webkit_blob::MockBlobURLRequestContext; using content::MockBlobURLRequestContext;
using webkit_blob::ScopedTextBlob; using content::ScopedTextBlob;
namespace sync_file_system { namespace sync_file_system {
......
...@@ -20,9 +20,9 @@ ...@@ -20,9 +20,9 @@
#include "chrome/browser/sync_file_system/sync_status_code.h" #include "chrome/browser/sync_file_system/sync_status_code.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.h" #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/test/mock_blob_url_request_context.h"
#include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webkit/browser/blob/mock_blob_url_request_context.h"
#include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_operation_runner.h"
#include "webkit/browser/fileapi/isolated_context.h" #include "webkit/browser/fileapi/isolated_context.h"
......
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
#include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h" #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h"
#include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h" #include "chrome/browser/sync_file_system/local/syncable_file_system_operation.h"
#include "chrome/browser/sync_file_system/syncable_file_system_util.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/test_browser_thread_bundle.h" #include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "webkit/browser/blob/mock_blob_url_request_context.h"
#include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/fileapi/file_system_operation_runner.h" #include "webkit/browser/fileapi/file_system_operation_runner.h"
using fileapi::FileSystemOperation; using fileapi::FileSystemOperation;
using fileapi::FileSystemURL; using fileapi::FileSystemURL;
using webkit_blob::MockBlobURLRequestContext; using content::MockBlobURLRequestContext;
using webkit_blob::ScopedTextBlob; using content::ScopedTextBlob;
using base::File; using base::File;
namespace sync_file_system { namespace sync_file_system {
......
...@@ -2026,8 +2026,6 @@ ...@@ -2026,8 +2026,6 @@
'../tools/json_schema_compiler/test/simple_api_unittest.cc', '../tools/json_schema_compiler/test/simple_api_unittest.cc',
'../tools/json_schema_compiler/test/error_generation_unittest.cc', '../tools/json_schema_compiler/test/error_generation_unittest.cc',
'../ui/webui/resources/js/cr.js', '../ui/webui/resources/js/cr.js',
'../webkit/browser/blob/mock_blob_url_request_context.cc',
'../webkit/browser/blob/mock_blob_url_request_context.h',
'../webkit/browser/quota/mock_storage_client.cc', '../webkit/browser/quota/mock_storage_client.cc',
'../webkit/browser/quota/mock_storage_client.h', '../webkit/browser/quota/mock_storage_client.h',
], ],
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/message_loop/message_loop_proxy.h" #include "base/message_loop/message_loop_proxy.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "content/public/test/mock_blob_url_request_context.h"
#include "content/public/test/test_file_system_backend.h" #include "content/public/test/test_file_system_backend.h"
#include "content/public/test/test_file_system_context.h" #include "content/public/test/test_file_system_context.h"
#include "net/url_request/url_request.h" #include "net/url_request/url_request.h"
...@@ -19,7 +20,6 @@ ...@@ -19,7 +20,6 @@
#include "url/gurl.h" #include "url/gurl.h"
#include "webkit/browser/blob/blob_storage_context.h" #include "webkit/browser/blob/blob_storage_context.h"
#include "webkit/browser/blob/blob_url_request_job.h" #include "webkit/browser/blob/blob_url_request_job.h"
#include "webkit/browser/blob/mock_blob_url_request_context.h"
#include "webkit/browser/fileapi/file_system_context.h" #include "webkit/browser/fileapi/file_system_context.h"
#include "webkit/browser/fileapi/file_system_file_util.h" #include "webkit/browser/fileapi/file_system_file_util.h"
#include "webkit/browser/fileapi/file_system_operation_context.h" #include "webkit/browser/fileapi/file_system_operation_context.h"
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
using fileapi::FileSystemOperation; using fileapi::FileSystemOperation;
using fileapi::FileSystemOperationRunner; using fileapi::FileSystemOperationRunner;
using fileapi::FileSystemURL; using fileapi::FileSystemURL;
using webkit_blob::MockBlobURLRequestContext; using content::MockBlobURLRequestContext;
using webkit_blob::ScopedTextBlob; using content::ScopedTextBlob;
namespace content { namespace content {
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
'public/test/download_test_observer.h', 'public/test/download_test_observer.h',
'public/test/fake_speech_recognition_manager.cc', 'public/test/fake_speech_recognition_manager.cc',
'public/test/fake_speech_recognition_manager.h', 'public/test/fake_speech_recognition_manager.h',
'public/test/mock_blob_url_request_context.cc',
'public/test/mock_blob_url_request_context.h',
'public/test/mock_download_item.cc', 'public/test/mock_download_item.cc',
'public/test/mock_download_item.h', 'public/test/mock_download_item.h',
'public/test/mock_download_manager.cc', 'public/test/mock_download_manager.cc',
...@@ -589,8 +591,6 @@ ...@@ -589,8 +591,6 @@
'../webkit/browser/appcache/mock_appcache_storage_unittest.cc', '../webkit/browser/appcache/mock_appcache_storage_unittest.cc',
'../webkit/browser/blob/blob_storage_context_unittest.cc', '../webkit/browser/blob/blob_storage_context_unittest.cc',
'../webkit/browser/blob/local_file_stream_reader_unittest.cc', '../webkit/browser/blob/local_file_stream_reader_unittest.cc',
'../webkit/browser/blob/mock_blob_url_request_context.cc',
'../webkit/browser/blob/mock_blob_url_request_context.h',
'../webkit/browser/database/database_quota_client_unittest.cc', '../webkit/browser/database/database_quota_client_unittest.cc',
'../webkit/browser/database/database_tracker_unittest.cc', '../webkit/browser/database/database_tracker_unittest.cc',
'../webkit/browser/database/database_util_unittest.cc', '../webkit/browser/database/database_util_unittest.cc',
......
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "webkit/browser/blob/mock_blob_url_request_context.h" #include "content/public/test/mock_blob_url_request_context.h"
#include "webkit/browser/blob/blob_storage_context.h" #include "webkit/browser/blob/blob_storage_context.h"
#include "webkit/browser/blob/blob_url_request_job.h" #include "webkit/browser/blob/blob_url_request_job.h"
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
#include "webkit/common/blob/blob_data.h" #include "webkit/common/blob/blob_data.h"
namespace webkit_blob { namespace content {
MockBlobURLRequestContext::MockBlobURLRequestContext( MockBlobURLRequestContext::MockBlobURLRequestContext(
fileapi::FileSystemContext* file_system_context) fileapi::FileSystemContext* file_system_context)
: blob_storage_context_(new BlobStorageContext) { : blob_storage_context_(new webkit_blob::BlobStorageContext) {
// Job factory owns the protocol handler. // Job factory owns the protocol handler.
job_factory_.SetProtocolHandler( job_factory_.SetProtocolHandler(
"blob", new BlobProtocolHandler(blob_storage_context_.get(), "blob", new webkit_blob::BlobProtocolHandler(blob_storage_context_.get(),
file_system_context, file_system_context,
base::MessageLoopProxy::current())); base::MessageLoopProxy::current()));
set_job_factory(&job_factory_); set_job_factory(&job_factory_);
...@@ -33,7 +33,8 @@ ScopedTextBlob::ScopedTextBlob( ...@@ -33,7 +33,8 @@ ScopedTextBlob::ScopedTextBlob(
: blob_id_(blob_id), : blob_id_(blob_id),
context_(request_context.blob_storage_context()) { context_(request_context.blob_storage_context()) {
DCHECK(context_); DCHECK(context_);
scoped_refptr<BlobData> blob_data(new BlobData(blob_id_)); scoped_refptr<webkit_blob::BlobData> blob_data(
new webkit_blob::BlobData(blob_id_));
if (!data.empty()) if (!data.empty())
blob_data->AppendData(data); blob_data->AppendData(data);
handle_ = context_->AddFinishedBlob(blob_data); handle_ = context_->AddFinishedBlob(blob_data);
...@@ -42,8 +43,8 @@ ScopedTextBlob::ScopedTextBlob( ...@@ -42,8 +43,8 @@ ScopedTextBlob::ScopedTextBlob(
ScopedTextBlob::~ScopedTextBlob() { ScopedTextBlob::~ScopedTextBlob() {
} }
scoped_ptr<BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() { scoped_ptr<webkit_blob::BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() {
return context_->GetBlobDataFromUUID(blob_id_); return context_->GetBlobDataFromUUID(blob_id_);
} }
} // namespace webkit_blob } // namespace content
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ #ifndef CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
#define WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ #define CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
#include "net/url_request/url_request_context.h" #include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_job.h" #include "net/url_request/url_request_job.h"
...@@ -14,22 +14,24 @@ class FileSystemContext; ...@@ -14,22 +14,24 @@ class FileSystemContext;
} }
namespace webkit_blob { namespace webkit_blob {
class BlobDataHandle; class BlobDataHandle;
class BlobStorageContext; class BlobStorageContext;
}
namespace content {
class MockBlobURLRequestContext : public net::URLRequestContext { class MockBlobURLRequestContext : public net::URLRequestContext {
public: public:
MockBlobURLRequestContext(fileapi::FileSystemContext* file_system_context); MockBlobURLRequestContext(fileapi::FileSystemContext* file_system_context);
virtual ~MockBlobURLRequestContext(); virtual ~MockBlobURLRequestContext();
BlobStorageContext* blob_storage_context() const { webkit_blob::BlobStorageContext* blob_storage_context() const {
return blob_storage_context_.get(); return blob_storage_context_.get();
} }
private: private:
net::URLRequestJobFactoryImpl job_factory_; net::URLRequestJobFactoryImpl job_factory_;
scoped_ptr<BlobStorageContext> blob_storage_context_; scoped_ptr<webkit_blob::BlobStorageContext> blob_storage_context_;
DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext); DISALLOW_COPY_AND_ASSIGN(MockBlobURLRequestContext);
}; };
...@@ -43,16 +45,16 @@ class ScopedTextBlob { ...@@ -43,16 +45,16 @@ class ScopedTextBlob {
~ScopedTextBlob(); ~ScopedTextBlob();
// Returns a BlobDataHandle referring to the scoped blob. // Returns a BlobDataHandle referring to the scoped blob.
scoped_ptr<BlobDataHandle> GetBlobDataHandle(); scoped_ptr<webkit_blob::BlobDataHandle> GetBlobDataHandle();
private: private:
const std::string blob_id_; const std::string blob_id_;
BlobStorageContext* context_; webkit_blob::BlobStorageContext* context_;
scoped_ptr<BlobDataHandle> handle_; scoped_ptr<webkit_blob::BlobDataHandle> handle_;
DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob); DISALLOW_COPY_AND_ASSIGN(ScopedTextBlob);
}; };
} // namespace webkit_blob } // namespace content
#endif // WEBKIT_BLOB_MOCK_BLOB_URL_REQUEST_CONTEXT_H_ #endif // CONTENT_PUBLIC_TEST_MOCK_BLOB_URL_REQUEST_CONTEXT_H_
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