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 <limits> | 7 #include <limits> |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 MockQuotaManager::MockQuotaManager( | 37 MockQuotaManager::MockQuotaManager( |
38 bool is_incognito, | 38 bool is_incognito, |
39 const base::FilePath& profile_path, | 39 const base::FilePath& profile_path, |
40 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, | 40 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
41 const scoped_refptr<base::SequencedTaskRunner>& db_thread, | 41 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
42 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy) | 42 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy) |
43 : QuotaManager(is_incognito, | 43 : QuotaManager(is_incognito, |
44 profile_path, | 44 profile_path, |
45 io_thread, | 45 io_thread, |
46 db_thread, | 46 db_thread, |
47 special_storage_policy, | 47 special_storage_policy), |
48 storage::GetQuotaSettingsFunc()), | 48 weak_factory_(this) { |
49 weak_factory_(this) {} | 49 } |
50 | 50 |
51 void MockQuotaManager::GetUsageAndQuota(const GURL& origin, | 51 void MockQuotaManager::GetUsageAndQuota( |
52 storage::StorageType type, | 52 const GURL& origin, |
53 const UsageAndQuotaCallback& callback) { | 53 storage::StorageType type, |
| 54 const GetUsageAndQuotaCallback& callback) { |
54 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; | 55 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; |
55 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); | 56 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); |
56 } | 57 } |
57 | 58 |
58 void MockQuotaManager::SetQuota(const GURL& origin, | 59 void MockQuotaManager::SetQuota(const GURL& origin, |
59 StorageType type, | 60 StorageType type, |
60 int64_t quota) { | 61 int64_t quota) { |
61 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; | 62 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; |
62 } | 63 } |
63 | 64 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 callback.Run(*origins, storage_type); | 142 callback.Run(*origins, storage_type); |
142 } | 143 } |
143 | 144 |
144 void MockQuotaManager::DidDeleteOriginData( | 145 void MockQuotaManager::DidDeleteOriginData( |
145 const StatusCallback& callback, | 146 const StatusCallback& callback, |
146 QuotaStatusCode status) { | 147 QuotaStatusCode status) { |
147 callback.Run(status); | 148 callback.Run(status); |
148 } | 149 } |
149 | 150 |
150 } // namespace content | 151 } // namespace content |
OLD | NEW |