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/browser/quota/mock_quota_manager.h" | 5 #include "content/browser/quota/mock_quota_manager.h" |
6 | 6 |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
11 #include "url/gurl.h" | 11 #include "url/gurl.h" |
12 | 12 |
13 using quota::kQuotaStatusOk; | 13 using storage::kQuotaStatusOk; |
14 | 14 |
15 namespace content { | 15 namespace content { |
16 | 16 |
17 MockQuotaManager::OriginInfo::OriginInfo( | 17 MockQuotaManager::OriginInfo::OriginInfo( |
18 const GURL& origin, | 18 const GURL& origin, |
19 StorageType type, | 19 StorageType type, |
20 int quota_client_mask, | 20 int quota_client_mask, |
21 base::Time modified) | 21 base::Time modified) |
22 : origin(origin), | 22 : origin(origin), |
23 type(type), | 23 type(type), |
(...skipping 12 matching lines...) Expand all Loading... |
36 base::SingleThreadTaskRunner* io_thread, | 36 base::SingleThreadTaskRunner* io_thread, |
37 base::SequencedTaskRunner* db_thread, | 37 base::SequencedTaskRunner* db_thread, |
38 SpecialStoragePolicy* special_storage_policy) | 38 SpecialStoragePolicy* special_storage_policy) |
39 : QuotaManager(is_incognito, profile_path, io_thread, db_thread, | 39 : QuotaManager(is_incognito, profile_path, io_thread, db_thread, |
40 special_storage_policy), | 40 special_storage_policy), |
41 weak_factory_(this) { | 41 weak_factory_(this) { |
42 } | 42 } |
43 | 43 |
44 void MockQuotaManager::GetUsageAndQuota( | 44 void MockQuotaManager::GetUsageAndQuota( |
45 const GURL& origin, | 45 const GURL& origin, |
46 quota::StorageType type, | 46 storage::StorageType type, |
47 const GetUsageAndQuotaCallback& callback) { | 47 const GetUsageAndQuotaCallback& callback) { |
48 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; | 48 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; |
49 callback.Run(quota::kQuotaStatusOk, info.usage, info.quota); | 49 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); |
50 } | 50 } |
51 | 51 |
52 void MockQuotaManager::SetQuota(const GURL& origin, StorageType type, | 52 void MockQuotaManager::SetQuota(const GURL& origin, StorageType type, |
53 int64 quota) { | 53 int64 quota) { |
54 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; | 54 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; |
55 } | 55 } |
56 | 56 |
57 bool MockQuotaManager::AddOrigin( | 57 bool MockQuotaManager::AddOrigin( |
58 const GURL& origin, | 58 const GURL& origin, |
59 StorageType type, | 59 StorageType type, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 callback.Run(*origins, storage_type); | 138 callback.Run(*origins, storage_type); |
139 } | 139 } |
140 | 140 |
141 void MockQuotaManager::DidDeleteOriginData( | 141 void MockQuotaManager::DidDeleteOriginData( |
142 const StatusCallback& callback, | 142 const StatusCallback& callback, |
143 QuotaStatusCode status) { | 143 QuotaStatusCode status) { |
144 callback.Run(status); | 144 callback.Run(status); |
145 } | 145 } |
146 | 146 |
147 } // namespace content | 147 } // namespace content |
OLD | NEW |