Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(739)

Side by Side Diff: content/public/test/mock_blob_url_request_context.cc

Issue 1159623009: content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test build fix. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/frame_load_waiter.cc ('k') | content/public/test/mock_render_thread.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/thread_task_runner_handle.h"
7 #include "storage/browser/blob/blob_data_builder.h" 8 #include "storage/browser/blob/blob_data_builder.h"
8 #include "storage/browser/blob/blob_storage_context.h" 9 #include "storage/browser/blob/blob_storage_context.h"
9 #include "storage/browser/blob/blob_url_request_job.h" 10 #include "storage/browser/blob/blob_url_request_job.h"
10 #include "storage/browser/blob/blob_url_request_job_factory.h" 11 #include "storage/browser/blob/blob_url_request_job_factory.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 MockBlobURLRequestContext::MockBlobURLRequestContext( 15 MockBlobURLRequestContext::MockBlobURLRequestContext(
15 storage::FileSystemContext* file_system_context) 16 storage::FileSystemContext* file_system_context)
16 : blob_storage_context_(new storage::BlobStorageContext) { 17 : blob_storage_context_(new storage::BlobStorageContext) {
17 // Job factory owns the protocol handler. 18 // Job factory owns the protocol handler.
18 job_factory_.SetProtocolHandler( 19 job_factory_.SetProtocolHandler(
19 "blob", 20 "blob", new storage::BlobProtocolHandler(
20 new storage::BlobProtocolHandler(blob_storage_context_.get(), 21 blob_storage_context_.get(), file_system_context,
21 file_system_context, 22 base::ThreadTaskRunnerHandle::Get()));
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 storage::BlobDataBuilder blob_builder(blob_id_); 37 storage::BlobDataBuilder blob_builder(blob_id_);
38 if (!data.empty()) 38 if (!data.empty())
39 blob_builder.AppendData(data); 39 blob_builder.AppendData(data);
40 handle_ = context_->AddFinishedBlob(&blob_builder); 40 handle_ = context_->AddFinishedBlob(&blob_builder);
41 } 41 }
42 42
43 ScopedTextBlob::~ScopedTextBlob() { 43 ScopedTextBlob::~ScopedTextBlob() {
44 } 44 }
45 45
46 scoped_ptr<storage::BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() { 46 scoped_ptr<storage::BlobDataHandle> ScopedTextBlob::GetBlobDataHandle() {
47 return context_->GetBlobDataFromUUID(blob_id_); 47 return context_->GetBlobDataFromUUID(blob_id_);
48 } 48 }
49 49
50 } // namespace content 50 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/frame_load_waiter.cc ('k') | content/public/test/mock_render_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698