OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/public/test/mock_blob_url_request_context.h" | 5 #include "content/public/test/mock_blob_url_request_context.h" |
6 | 6 |
7 #include "webkit/browser/blob/blob_storage_context.h" | 7 #include "storage/browser/blob/blob_storage_context.h" |
8 #include "webkit/browser/blob/blob_url_request_job.h" | 8 #include "storage/browser/blob/blob_url_request_job.h" |
9 #include "webkit/browser/blob/blob_url_request_job_factory.h" | 9 #include "storage/browser/blob/blob_url_request_job_factory.h" |
10 #include "webkit/common/blob/blob_data.h" | 10 #include "storage/common/blob/blob_data.h" |
11 | |
12 | 11 |
13 namespace content { | 12 namespace content { |
14 | 13 |
15 MockBlobURLRequestContext::MockBlobURLRequestContext( | 14 MockBlobURLRequestContext::MockBlobURLRequestContext( |
16 fileapi::FileSystemContext* file_system_context) | 15 storage::FileSystemContext* file_system_context) |
17 : blob_storage_context_(new webkit_blob::BlobStorageContext) { | 16 : blob_storage_context_(new storage::BlobStorageContext) { |
18 // Job factory owns the protocol handler. | 17 // Job factory owns the protocol handler. |
19 job_factory_.SetProtocolHandler( | 18 job_factory_.SetProtocolHandler( |
20 "blob", new webkit_blob::BlobProtocolHandler(blob_storage_context_.get(), | 19 "blob", |
21 file_system_context, | 20 new storage::BlobProtocolHandler(blob_storage_context_.get(), |
22 base::MessageLoopProxy::current())); | 21 file_system_context, |
| 22 base::MessageLoopProxy::current())); |
23 set_job_factory(&job_factory_); | 23 set_job_factory(&job_factory_); |
24 } | 24 } |
25 | 25 |
26 MockBlobURLRequestContext::~MockBlobURLRequestContext() { | 26 MockBlobURLRequestContext::~MockBlobURLRequestContext() { |
27 AssertNoURLRequests(); | 27 AssertNoURLRequests(); |
28 } | 28 } |
29 | 29 |
30 ScopedTextBlob::ScopedTextBlob( | 30 ScopedTextBlob::ScopedTextBlob( |
31 const MockBlobURLRequestContext& request_context, | 31 const MockBlobURLRequestContext& request_context, |
32 const std::string& blob_id, | 32 const std::string& blob_id, |
33 const std::string& data) | 33 const std::string& data) |
34 : blob_id_(blob_id), | 34 : blob_id_(blob_id), |
35 context_(request_context.blob_storage_context()) { | 35 context_(request_context.blob_storage_context()) { |
36 DCHECK(context_); | 36 DCHECK(context_); |
37 scoped_refptr<webkit_blob::BlobData> blob_data( | 37 scoped_refptr<storage::BlobData> blob_data(new storage::BlobData(blob_id_)); |
38 new webkit_blob::BlobData(blob_id_)); | |
39 if (!data.empty()) | 38 if (!data.empty()) |
40 blob_data->AppendData(data); | 39 blob_data->AppendData(data); |
41 handle_ = context_->AddFinishedBlob(blob_data); | 40 handle_ = context_->AddFinishedBlob(blob_data); |
42 } | 41 } |
43 | 42 |
44 ScopedTextBlob::~ScopedTextBlob() { | 43 ScopedTextBlob::~ScopedTextBlob() { |
45 } | 44 } |
46 | 45 |
47 scoped_ptr<webkit_blob::BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() { | 46 scoped_ptr<storage::BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() { |
48 return context_->GetBlobDataFromUUID(blob_id_); | 47 return context_->GetBlobDataFromUUID(blob_id_); |
49 } | 48 } |
50 | 49 |
51 } // namespace content | 50 } // namespace content |
OLD | NEW |