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

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

Issue 7129018: Time-based removal of temporary file systems via BrowsingDataRemover (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years, 4 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/test/testing_profile.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
(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
12 #include "base/memory/scoped_ptr.h"
13 #include "googleurl/src/gurl.h"
14 #include "webkit/quota/quota_client.h"
15 #include "webkit/quota/quota_manager.h"
16 #include "webkit/quota/quota_task.h"
17 #include "webkit/quota/quota_types.h"
18
19 namespace quota {
20
21 // Mocks the pieces of QuotaManager's interface that are used for time-based
22 // deletion of a profile's browsing data. Origins can be added to the mock by
23 // calling AddOrigin, and that list of origins is then searched through in
24 // GetOriginsModifiedSince. Neither GetOriginsModifiedSince nor DeleteOriginData
25 // touches the actual origin data stored in the profile.
26 class MockQuotaManager : public QuotaManager {
27 public:
28 // Contains the essential bits of information about an origin that the
29 // MockQuotaManager needs to understand: the origin itself, the StorageType,
30 // and its modification time.
31 struct OriginInfo {
32 OriginInfo(const GURL& origin,
33 StorageType type,
34 base::Time modified);
35 ~OriginInfo();
36
37 GURL origin;
38 StorageType type;
39 base::Time modified;
40 };
41
42 MockQuotaManager(bool is_incognito,
43 const FilePath& profile_path,
44 base::MessageLoopProxy* io_thread,
45 base::MessageLoopProxy* db_thread,
46 SpecialStoragePolicy* special_storage_policy);
47
48 virtual ~MockQuotaManager();
49
50 // Adds an origin to the canned list that will be searched through via
51 // GetOriginsModifiedSince.
52 bool AddOrigin(const GURL& origin, StorageType type, base::Time modified);
53
54 // 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
56 // canned list with the proper StorageType, returns true.
57 bool OriginHasData(const GURL& origin, StorageType type) const;
58
59 // Overrides QuotaManager's implementation with a canned implementation that
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.
62 virtual void GetOriginsModifiedSince(StorageType type,
63 base::Time modified_since,
64 GetOriginsCallback* callback) OVERRIDE;
65
66 // Removes an origin from the canned list of origins, but doesn't touch
67 // anything on disk.
68 virtual void DeleteOriginData(const GURL& origin,
69 StorageType type,
70 StatusCallback* callback) OVERRIDE;
71 private:
72 class GetModifiedSinceTask;
73 class DeleteOriginDataTask;
74
75 // The list of stored origins that have been added via AddOrigin.
76 std::vector<OriginInfo> origins_;
77
78 DISALLOW_COPY_AND_ASSIGN(MockQuotaManager);
79 };
80
81 } // namespace quota
82
83 #endif // WEBKIT_QUOTA_MOCK_QUOTA_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/test/testing_profile.cc ('k') | webkit/quota/mock_quota_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698