| 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 #ifndef CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ | 5 #ifndef CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 6 #define CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ | 6 #define CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // Usage and quota information can be updated by following private helper | 33 // Usage and quota information can be updated by following private helper |
| 34 // methods: SetQuota() and UpdateUsage(). | 34 // methods: SetQuota() and UpdateUsage(). |
| 35 // | 35 // |
| 36 // For time-based deletion test: | 36 // For time-based deletion test: |
| 37 // Origins can be added to the mock by calling AddOrigin, and that list of | 37 // Origins can be added to the mock by calling AddOrigin, and that list of |
| 38 // origins is then searched through in GetOriginsModifiedSince. | 38 // origins is then searched through in GetOriginsModifiedSince. |
| 39 // Neither GetOriginsModifiedSince nor DeleteOriginData touches the actual | 39 // Neither GetOriginsModifiedSince nor DeleteOriginData touches the actual |
| 40 // origin data stored in the profile. | 40 // origin data stored in the profile. |
| 41 class MockQuotaManager : public QuotaManager { | 41 class MockQuotaManager : public QuotaManager { |
| 42 public: | 42 public: |
| 43 MockQuotaManager(bool is_incognito, | 43 MockQuotaManager( |
| 44 const base::FilePath& profile_path, | 44 bool is_incognito, |
| 45 base::SingleThreadTaskRunner* io_thread, | 45 const base::FilePath& profile_path, |
| 46 base::SequencedTaskRunner* db_thread, | 46 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
| 47 SpecialStoragePolicy* special_storage_policy); | 47 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
| 48 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); |
| 48 | 49 |
| 49 // Overrides QuotaManager's implementation. The internal usage data is | 50 // Overrides QuotaManager's implementation. The internal usage data is |
| 50 // updated when MockQuotaManagerProxy::NotifyStorageModified() is | 51 // updated when MockQuotaManagerProxy::NotifyStorageModified() is |
| 51 // called. The internal quota value can be updated by calling | 52 // called. The internal quota value can be updated by calling |
| 52 // a helper method MockQuotaManagerProxy::SetQuota(). | 53 // a helper method MockQuotaManagerProxy::SetQuota(). |
| 53 virtual void GetUsageAndQuota( | 54 virtual void GetUsageAndQuota( |
| 54 const GURL& origin, | 55 const GURL& origin, |
| 55 storage::StorageType type, | 56 storage::StorageType type, |
| 56 const GetUsageAndQuotaCallback& callback) OVERRIDE; | 57 const GetUsageAndQuotaCallback& callback) OVERRIDE; |
| 57 | 58 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 std::vector<OriginInfo> origins_; | 144 std::vector<OriginInfo> origins_; |
| 144 UsageAndQuotaMap usage_and_quota_map_; | 145 UsageAndQuotaMap usage_and_quota_map_; |
| 145 base::WeakPtrFactory<MockQuotaManager> weak_factory_; | 146 base::WeakPtrFactory<MockQuotaManager> weak_factory_; |
| 146 | 147 |
| 147 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); | 148 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 } // namespace content | 151 } // namespace content |
| 151 | 152 |
| 152 #endif // CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ | 153 #endif // CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| OLD | NEW |