| 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" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } | 26 } |
| 27 | 27 |
| 28 MockQuotaManager::OriginInfo::~OriginInfo() {} | 28 MockQuotaManager::OriginInfo::~OriginInfo() {} |
| 29 | 29 |
| 30 MockQuotaManager::StorageInfo::StorageInfo() : usage(0), quota(kint64max) {} | 30 MockQuotaManager::StorageInfo::StorageInfo() : usage(0), quota(kint64max) {} |
| 31 MockQuotaManager::StorageInfo::~StorageInfo() {} | 31 MockQuotaManager::StorageInfo::~StorageInfo() {} |
| 32 | 32 |
| 33 MockQuotaManager::MockQuotaManager( | 33 MockQuotaManager::MockQuotaManager( |
| 34 bool is_incognito, | 34 bool is_incognito, |
| 35 const base::FilePath& profile_path, | 35 const base::FilePath& profile_path, |
| 36 base::SingleThreadTaskRunner* io_thread, | 36 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
| 37 base::SequencedTaskRunner* db_thread, | 37 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
| 38 SpecialStoragePolicy* special_storage_policy) | 38 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy) |
| 39 : QuotaManager(is_incognito, profile_path, io_thread, db_thread, | 39 : QuotaManager(is_incognito, |
| 40 special_storage_policy), | 40 profile_path, |
| 41 io_thread, |
| 42 db_thread, |
| 43 special_storage_policy), |
| 41 weak_factory_(this) { | 44 weak_factory_(this) { |
| 42 } | 45 } |
| 43 | 46 |
| 44 void MockQuotaManager::GetUsageAndQuota( | 47 void MockQuotaManager::GetUsageAndQuota( |
| 45 const GURL& origin, | 48 const GURL& origin, |
| 46 storage::StorageType type, | 49 storage::StorageType type, |
| 47 const GetUsageAndQuotaCallback& callback) { | 50 const GetUsageAndQuotaCallback& callback) { |
| 48 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; | 51 StorageInfo& info = usage_and_quota_map_[std::make_pair(origin, type)]; |
| 49 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); | 52 callback.Run(storage::kQuotaStatusOk, info.usage, info.quota); |
| 50 } | 53 } |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 callback.Run(*origins, storage_type); | 141 callback.Run(*origins, storage_type); |
| 139 } | 142 } |
| 140 | 143 |
| 141 void MockQuotaManager::DidDeleteOriginData( | 144 void MockQuotaManager::DidDeleteOriginData( |
| 142 const StatusCallback& callback, | 145 const StatusCallback& callback, |
| 143 QuotaStatusCode status) { | 146 QuotaStatusCode status) { |
| 144 callback.Run(status); | 147 callback.Run(status); |
| 145 } | 148 } |
| 146 | 149 |
| 147 } // namespace content | 150 } // namespace content |
| OLD | NEW |