| 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 weak_factory_(this) { | 48 storage::GetQuotaSettingsFunc()), |
| 49 } | 49 weak_factory_(this) {} |
| 50 | 50 |
| 51 void MockQuotaManager::GetUsageAndQuota( | 51 void MockQuotaManager::GetUsageAndQuota(const GURL& origin, |
| 52 const GURL& origin, | 52 storage::StorageType type, |
| 53 storage::StorageType type, | 53 const UsageAndQuotaCallback& callback) { |
| 54 const GetUsageAndQuotaCallback& callback) { | |
| 55 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; | 54 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; |
| 56 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); | 55 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); |
| 57 } | 56 } |
| 58 | 57 |
| 59 void MockQuotaManager::SetQuota(const GURL& origin, | 58 void MockQuotaManager::SetQuota(const GURL& origin, |
| 60 StorageType type, | 59 StorageType type, |
| 61 int64_t quota) { | 60 int64_t quota) { |
| 62 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; | 61 usage_and_quota_map_[std::make_pair(origin, type)].quota = quota; |
| 63 } | 62 } |
| 64 | 63 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 callback.Run(*origins, storage_type); | 141 callback.Run(*origins, storage_type); |
| 143 } | 142 } |
| 144 | 143 |
| 145 void MockQuotaManager::DidDeleteOriginData( | 144 void MockQuotaManager::DidDeleteOriginData( |
| 146 const StatusCallback& callback, | 145 const StatusCallback& callback, |
| 147 QuotaStatusCode status) { | 146 QuotaStatusCode status) { |
| 148 callback.Run(status); | 147 callback.Run(status); |
| 149 } | 148 } |
| 150 | 149 |
| 151 } // namespace content | 150 } // namespace content |
| OLD | NEW |