Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ | 5 #ifndef WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 6 #define WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ | 6 #define WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 // GetOriginsModifiedSince. Neither GetOriginsModifiedSince nor DeleteOriginData | 24 // GetOriginsModifiedSince. Neither GetOriginsModifiedSince nor DeleteOriginData |
| 25 // touches the actual origin data stored in the profile. | 25 // touches the actual origin data stored in the profile. |
| 26 class MockQuotaManager : public QuotaManager { | 26 class MockQuotaManager : public QuotaManager { |
| 27 public: | 27 public: |
| 28 // Contains the essential bits of information about an origin that the | 28 // Contains the essential bits of information about an origin that the |
| 29 // MockQuotaManager needs to understand: the origin itself, the StorageType, | 29 // MockQuotaManager needs to understand: the origin itself, the StorageType, |
| 30 // and its modification time. | 30 // and its modification time. |
| 31 struct OriginInfo { | 31 struct OriginInfo { |
| 32 OriginInfo(const GURL& origin, | 32 OriginInfo(const GURL& origin, |
| 33 StorageType type, | 33 StorageType type, |
| 34 int quota_client_mask, | |
| 34 base::Time modified); | 35 base::Time modified); |
| 35 ~OriginInfo(); | 36 ~OriginInfo(); |
| 36 | 37 |
| 37 GURL origin; | 38 GURL origin; |
| 38 StorageType type; | 39 StorageType type; |
| 40 int mask; | |
|
jochen (gone - plz use gerrit)
2011/09/12 11:23:00
quota_client_mask so it's clear what it is?
| |
| 39 base::Time modified; | 41 base::Time modified; |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 MockQuotaManager(bool is_incognito, | 44 MockQuotaManager(bool is_incognito, |
| 43 const FilePath& profile_path, | 45 const FilePath& profile_path, |
| 44 base::MessageLoopProxy* io_thread, | 46 base::MessageLoopProxy* io_thread, |
| 45 base::MessageLoopProxy* db_thread, | 47 base::MessageLoopProxy* db_thread, |
| 46 SpecialStoragePolicy* special_storage_policy); | 48 SpecialStoragePolicy* special_storage_policy); |
| 47 | 49 |
| 48 virtual ~MockQuotaManager(); | 50 virtual ~MockQuotaManager(); |
| 49 | 51 |
| 50 // Adds an origin to the canned list that will be searched through via | 52 // Adds an origin to the canned list that will be searched through via |
| 51 // GetOriginsModifiedSince. | 53 // GetOriginsModifiedSince. |
| 52 bool AddOrigin(const GURL& origin, StorageType type, base::Time modified); | 54 bool AddOrigin(const GURL& origin, |
| 55 StorageType type, | |
| 56 int quota_client_mask, | |
| 57 base::Time modified); | |
| 53 | 58 |
| 54 // Checks an origin and type against the origins that have been added via | 59 // Checks an origin and type against the origins that have been added via |
| 55 // AddOrigin and removed via DeleteOriginData. If the origin exists in the | 60 // AddOrigin and removed via DeleteOriginData. If the origin exists in the |
| 56 // canned list with the proper StorageType, returns true. | 61 // canned list with the proper StorageType and client, returns true. |
| 57 bool OriginHasData(const GURL& origin, StorageType type) const; | 62 bool OriginHasData(const GURL& origin, |
| 63 StorageType type, | |
| 64 QuotaClient::ID quota_client) const; | |
| 58 | 65 |
| 59 // Overrides QuotaManager's implementation with a canned implementation that | 66 // Overrides QuotaManager's implementation with a canned implementation that |
| 60 // allows clients to set up the origin database that should be queried. This | 67 // 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. | 68 // method will only search through the origins added explicitly via AddOrigin. |
| 62 virtual void GetOriginsModifiedSince(StorageType type, | 69 virtual void GetOriginsModifiedSince(StorageType type, |
| 63 base::Time modified_since, | 70 base::Time modified_since, |
| 64 GetOriginsCallback* callback) OVERRIDE; | 71 GetOriginsCallback* callback) OVERRIDE; |
| 65 | 72 |
| 66 // Removes an origin from the canned list of origins, but doesn't touch | 73 // Removes an origin from the canned list of origins, but doesn't touch |
| 67 // anything on disk. | 74 // anything on disk. |
| 68 virtual void DeleteOriginData(const GURL& origin, | 75 virtual void DeleteOriginData(const GURL& origin, |
| 69 StorageType type, | 76 StorageType type, |
| 77 int quota_client_mask, | |
| 70 StatusCallback* callback) OVERRIDE; | 78 StatusCallback* callback) OVERRIDE; |
| 71 private: | 79 private: |
| 72 class GetModifiedSinceTask; | 80 class GetModifiedSinceTask; |
| 73 class DeleteOriginDataTask; | 81 class DeleteOriginDataTask; |
| 74 | 82 |
| 75 // The list of stored origins that have been added via AddOrigin. | 83 // The list of stored origins that have been added via AddOrigin. |
| 76 std::vector<OriginInfo> origins_; | 84 std::vector<OriginInfo> origins_; |
| 77 | 85 |
| 78 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); | 86 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); |
| 79 }; | 87 }; |
| 80 | 88 |
| 81 } // namespace quota | 89 } // namespace quota |
| 82 | 90 |
| 83 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ | 91 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| OLD | NEW |