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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 const scoped_refptr<base::SequencedTaskRunner>& db_thread, | 47 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
48 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); | 48 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); |
49 | 49 |
50 // Overrides QuotaManager's implementation. The internal usage data is | 50 // Overrides QuotaManager's implementation. The internal usage data is |
51 // updated when MockQuotaManagerProxy::NotifyStorageModified() is | 51 // updated when MockQuotaManagerProxy::NotifyStorageModified() is |
52 // called. The internal quota value can be updated by calling | 52 // called. The internal quota value can be updated by calling |
53 // a helper method MockQuotaManagerProxy::SetQuota(). | 53 // a helper method MockQuotaManagerProxy::SetQuota(). |
54 virtual void GetUsageAndQuota( | 54 virtual void GetUsageAndQuota( |
55 const GURL& origin, | 55 const GURL& origin, |
56 storage::StorageType type, | 56 storage::StorageType type, |
57 const GetUsageAndQuotaCallback& callback) OVERRIDE; | 57 const GetUsageAndQuotaCallback& callback) override; |
58 | 58 |
59 // Overrides QuotaManager's implementation with a canned implementation that | 59 // Overrides QuotaManager's implementation with a canned implementation that |
60 // allows clients to set up the origin database that should be queried. This | 60 // allows clients to set up the origin database that should be queried. This |
61 // method will only search through the origins added explicitly via AddOrigin. | 61 // method will only search through the origins added explicitly via AddOrigin. |
62 virtual void GetOriginsModifiedSince( | 62 virtual void GetOriginsModifiedSince( |
63 StorageType type, | 63 StorageType type, |
64 base::Time modified_since, | 64 base::Time modified_since, |
65 const GetOriginsCallback& callback) OVERRIDE; | 65 const GetOriginsCallback& callback) override; |
66 | 66 |
67 // Removes an origin from the canned list of origins, but doesn't touch | 67 // Removes an origin from the canned list of origins, but doesn't touch |
68 // anything on disk. The caller must provide |quota_client_mask| which | 68 // anything on disk. The caller must provide |quota_client_mask| which |
69 // specifies the types of QuotaClients which should be removed from this | 69 // specifies the types of QuotaClients which should be removed from this |
70 // origin as a bitmask built from QuotaClient::IDs. Setting the mask to | 70 // origin as a bitmask built from QuotaClient::IDs. Setting the mask to |
71 // QuotaClient::kAllClientsMask will remove all clients from the origin, | 71 // QuotaClient::kAllClientsMask will remove all clients from the origin, |
72 // regardless of type. | 72 // regardless of type. |
73 virtual void DeleteOriginData(const GURL& origin, | 73 virtual void DeleteOriginData(const GURL& origin, |
74 StorageType type, | 74 StorageType type, |
75 int quota_client_mask, | 75 int quota_client_mask, |
76 const StatusCallback& callback) OVERRIDE; | 76 const StatusCallback& callback) override; |
77 | 77 |
78 // Helper method for updating internal quota info. | 78 // Helper method for updating internal quota info. |
79 void SetQuota(const GURL& origin, StorageType type, int64 quota); | 79 void SetQuota(const GURL& origin, StorageType type, int64 quota); |
80 | 80 |
81 // Helper methods for timed-deletion testing: | 81 // Helper methods for timed-deletion testing: |
82 // Adds an origin to the canned list that will be searched through via | 82 // Adds an origin to the canned list that will be searched through via |
83 // GetOriginsModifiedSince. The caller must provide |quota_client_mask| | 83 // GetOriginsModifiedSince. The caller must provide |quota_client_mask| |
84 // which specifies the types of QuotaClients this canned origin contains | 84 // which specifies the types of QuotaClients this canned origin contains |
85 // as a bitmask built from QuotaClient::IDs. | 85 // as a bitmask built from QuotaClient::IDs. |
86 bool AddOrigin(const GURL& origin, | 86 bool AddOrigin(const GURL& origin, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 std::vector<OriginInfo> origins_; | 144 std::vector<OriginInfo> origins_; |
145 UsageAndQuotaMap usage_and_quota_map_; | 145 UsageAndQuotaMap usage_and_quota_map_; |
146 base::WeakPtrFactory<MockQuotaManager> weak_factory_; | 146 base::WeakPtrFactory<MockQuotaManager> weak_factory_; |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); | 148 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); |
149 }; | 149 }; |
150 | 150 |
151 } // namespace content | 151 } // namespace content |
152 | 152 |
153 #endif // CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ | 153 #endif // CONTENT_BROWSER_QUOTA_MOCK_QUOTA_MANAGER_H_ |
OLD | NEW |