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