Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: webkit/quota/mock_quota_manager.h

Issue 7839029: QuotaManager::DeleteOriginData now allows deletion of specific QuotaClients (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Kinuko's feedback (modulo kMockStart) Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browsing_data_remover_unittest.cc ('k') | webkit/quota/mock_quota_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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>
11 11
(...skipping 12 matching lines...) Expand all
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 quota_client_mask;
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. The caller must provide |quota_client_mask|
52 bool AddOrigin(const GURL& origin, StorageType type, base::Time modified); 54 // which specifies the types of QuotaClients this canned origin contains
55 // as a bitmask built from QuotaClient::IDs.
56 bool AddOrigin(const GURL& origin,
57 StorageType type,
58 int quota_client_mask,
59 base::Time modified);
53 60
54 // Checks an origin and type against the origins that have been added via 61 // 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 62 // AddOrigin and removed via DeleteOriginData. If the origin exists in the
56 // canned list with the proper StorageType, returns true. 63 // canned list with the proper StorageType and client, returns true.
57 bool OriginHasData(const GURL& origin, StorageType type) const; 64 bool OriginHasData(const GURL& origin,
65 StorageType type,
66 QuotaClient::ID quota_client) const;
58 67
59 // Overrides QuotaManager's implementation with a canned implementation that 68 // Overrides QuotaManager's implementation with a canned implementation that
60 // allows clients to set up the origin database that should be queried. This 69 // 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. 70 // method will only search through the origins added explicitly via AddOrigin.
62 virtual void GetOriginsModifiedSince( 71 virtual void GetOriginsModifiedSince(
63 StorageType type, 72 StorageType type,
64 base::Time modified_since, 73 base::Time modified_since,
65 const GetOriginsCallback& callback) OVERRIDE; 74 const GetOriginsCallback& callback) OVERRIDE;
66 75
67 // Removes an origin from the canned list of origins, but doesn't touch 76 // Removes an origin from the canned list of origins, but doesn't touch
68 // anything on disk. 77 // anything on disk. The caller must provide |quota_client_mask| which
78 // specifies the types of QuotaClients which should be removed from this
79 // origin as a bitmask built from QuotaClient::IDs. Setting the mask to
80 // QuotaClient::kAllClientsMask will remove all clients from the origin,
81 // regardless of type.
69 virtual void DeleteOriginData(const GURL& origin, 82 virtual void DeleteOriginData(const GURL& origin,
70 StorageType type, 83 StorageType type,
84 int quota_client_mask,
71 const StatusCallback& callback) OVERRIDE; 85 const StatusCallback& callback) OVERRIDE;
72 86
73 private: 87 private:
74 class GetModifiedSinceTask; 88 class GetModifiedSinceTask;
75 class DeleteOriginDataTask; 89 class DeleteOriginDataTask;
76 90
77 // The list of stored origins that have been added via AddOrigin. 91 // The list of stored origins that have been added via AddOrigin.
78 std::vector<OriginInfo> origins_; 92 std::vector<OriginInfo> origins_;
79 93
80 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager); 94 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager);
81 }; 95 };
82 96
83 } // namespace quota 97 } // namespace quota
84 98
85 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_ 99 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/browsing_data_remover_unittest.cc ('k') | webkit/quota/mock_quota_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698