OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 6 #define WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 #include <string> |
| 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "googleurl/src/gurl.h" |
| 13 #include "webkit/quota/quota_client.h" |
| 14 #include "webkit/quota/quota_task.h" |
| 15 #include "webkit/quota/quota_types.h" |
| 16 #include "webkit/quota/quota_manager.h" |
| 17 |
| 18 namespace quota { |
| 19 |
| 20 |
| 21 // Mocks the pieces of QuotaManager's interface that are used for time-based |
| 22 // deletion of a profile's browsing data. |
| 23 class MockQuotaManager : public QuotaManager { |
| 24 public: |
| 25 // Contains the essential bits of information about an origin that the |
| 26 // MockQuotaManager needs to understand: the origin itself, the StorageType, |
| 27 // and its modification time. |
| 28 struct OriginInfo { |
| 29 OriginInfo(const GURL& origin, |
| 30 StorageType type, |
| 31 base::Time modified); |
| 32 ~OriginInfo(); |
| 33 |
| 34 GURL origin; |
| 35 StorageType type; |
| 36 base::Time modified; |
| 37 }; |
| 38 |
| 39 MockQuotaManager(bool is_incognito, |
| 40 const FilePath& profile_path, |
| 41 base::MessageLoopProxy* io_thread, |
| 42 base::MessageLoopProxy* db_thread, |
| 43 SpecialStoragePolicy* special_storage_policy); |
| 44 |
| 45 virtual ~MockQuotaManager(); |
| 46 |
| 47 bool AddOrigin(const GURL& origin, StorageType type, base::Time modified); |
| 48 |
| 49 bool OriginHasData(const GURL& origin, StorageType type); |
| 50 |
| 51 virtual void GetOriginsModifiedSince(StorageType type, |
| 52 base::Time modified_since, |
| 53 GetOriginsCallback* callback) OVERRIDE; |
| 54 |
| 55 virtual void DeleteOriginData(const GURL& origin, |
| 56 StorageType type, |
| 57 StatusCallback* callback) OVERRIDE; |
| 58 private: |
| 59 class GetModifiedSinceTask; |
| 60 class DeleteOriginDataTask; |
| 61 |
| 62 std::vector<OriginInfo> origins_; |
| 63 }; |
| 64 |
| 65 } // namespace quota |
| 66 |
| 67 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ |
OLD | NEW |