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

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

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/mock_render_thread.cc ('k') | content/public/test/render_view_test.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_storage_client.h" 5 #include "content/public/test/mock_storage_client.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
11 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
12 #include "base/single_thread_task_runner.h" 11 #include "base/message_loop/message_loop_proxy.h"
13 #include "base/stl_util.h" 12 #include "base/stl_util.h"
14 #include "base/thread_task_runner_handle.h"
15 #include "net/base/net_util.h" 13 #include "net/base/net_util.h"
16 #include "storage/browser/quota/quota_manager_proxy.h" 14 #include "storage/browser/quota/quota_manager_proxy.h"
17 15
18 using storage::kQuotaErrorInvalidModification; 16 using storage::kQuotaErrorInvalidModification;
19 using storage::kQuotaStatusOk; 17 using storage::kQuotaStatusOk;
20 18
21 namespace content { 19 namespace content {
22 20
23 using std::make_pair; 21 using std::make_pair;
24 22
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 return id_; 85 return id_;
88 } 86 }
89 87
90 void MockStorageClient::OnQuotaManagerDestroyed() { 88 void MockStorageClient::OnQuotaManagerDestroyed() {
91 delete this; 89 delete this;
92 } 90 }
93 91
94 void MockStorageClient::GetOriginUsage(const GURL& origin_url, 92 void MockStorageClient::GetOriginUsage(const GURL& origin_url,
95 StorageType type, 93 StorageType type,
96 const GetUsageCallback& callback) { 94 const GetUsageCallback& callback) {
97 base::ThreadTaskRunnerHandle::Get()->PostTask( 95 base::MessageLoopProxy::current()->PostTask(
98 FROM_HERE, 96 FROM_HERE,
99 base::Bind(&MockStorageClient::RunGetOriginUsage, 97 base::Bind(&MockStorageClient::RunGetOriginUsage,
100 weak_factory_.GetWeakPtr(), origin_url, type, callback)); 98 weak_factory_.GetWeakPtr(), origin_url, type, callback));
101 } 99 }
102 100
103 void MockStorageClient::GetOriginsForType( 101 void MockStorageClient::GetOriginsForType(
104 StorageType type, const GetOriginsCallback& callback) { 102 StorageType type, const GetOriginsCallback& callback) {
105 base::ThreadTaskRunnerHandle::Get()->PostTask( 103 base::MessageLoopProxy::current()->PostTask(
106 FROM_HERE, base::Bind(&MockStorageClient::RunGetOriginsForType, 104 FROM_HERE,
107 weak_factory_.GetWeakPtr(), type, callback)); 105 base::Bind(&MockStorageClient::RunGetOriginsForType,
106 weak_factory_.GetWeakPtr(), type, callback));
108 } 107 }
109 108
110 void MockStorageClient::GetOriginsForHost( 109 void MockStorageClient::GetOriginsForHost(
111 StorageType type, const std::string& host, 110 StorageType type, const std::string& host,
112 const GetOriginsCallback& callback) { 111 const GetOriginsCallback& callback) {
113 base::ThreadTaskRunnerHandle::Get()->PostTask( 112 base::MessageLoopProxy::current()->PostTask(
114 FROM_HERE, base::Bind(&MockStorageClient::RunGetOriginsForHost, 113 FROM_HERE,
115 weak_factory_.GetWeakPtr(), type, host, callback)); 114 base::Bind(&MockStorageClient::RunGetOriginsForHost,
115 weak_factory_.GetWeakPtr(), type, host, callback));
116 } 116 }
117 117
118 void MockStorageClient::DeleteOriginData( 118 void MockStorageClient::DeleteOriginData(
119 const GURL& origin, StorageType type, 119 const GURL& origin, StorageType type,
120 const DeletionCallback& callback) { 120 const DeletionCallback& callback) {
121 base::ThreadTaskRunnerHandle::Get()->PostTask( 121 base::MessageLoopProxy::current()->PostTask(
122 FROM_HERE, 122 FROM_HERE,
123 base::Bind(&MockStorageClient::RunDeleteOriginData, 123 base::Bind(&MockStorageClient::RunDeleteOriginData,
124 weak_factory_.GetWeakPtr(), origin, type, callback)); 124 weak_factory_.GetWeakPtr(), origin, type, callback));
125 } 125 }
126 126
127 bool MockStorageClient::DoesSupport(storage::StorageType type) const { 127 bool MockStorageClient::DoesSupport(storage::StorageType type) const {
128 return true; 128 return true;
129 } 129 }
130 130
131 void MockStorageClient::RunGetOriginUsage( 131 void MockStorageClient::RunGetOriginUsage(
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 int64 delta = itr->second; 180 int64 delta = itr->second;
181 quota_manager_proxy_-> 181 quota_manager_proxy_->
182 NotifyStorageModified(id(), origin_url, type, -delta); 182 NotifyStorageModified(id(), origin_url, type, -delta);
183 origin_data_.erase(itr); 183 origin_data_.erase(itr);
184 } 184 }
185 185
186 callback.Run(kQuotaStatusOk); 186 callback.Run(kQuotaStatusOk);
187 } 187 }
188 188
189 } // namespace content 189 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/mock_render_thread.cc ('k') | content/public/test/render_view_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698