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

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

Issue 7322005: Revert 91690 - Implement QM::GetOriginsModifiedSince for browser data deleter support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 | « no previous file | webkit/quota/mock_storage_client.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) 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_STORAGE_CLIENT_H_ 5 #ifndef WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
6 #define WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ 6 #define WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/task.h" 13 #include "base/task.h"
14 #include "base/time.h"
15 #include "googleurl/src/gurl.h" 14 #include "googleurl/src/gurl.h"
16 #include "webkit/quota/quota_client.h" 15 #include "webkit/quota/quota_client.h"
17 16
18 namespace quota { 17 namespace quota {
19 18
20 class QuotaManagerProxy; 19 class QuotaManagerProxy;
21 20
22 struct MockOriginData { 21 struct MockOriginData {
23 const char* origin; 22 const char* origin;
24 StorageType type; 23 StorageType type;
25 int64 usage; 24 int64 usage;
26 }; 25 };
27 26
28 // Mock storage class for testing. 27 // Mock storage class for testing.
29 class MockStorageClient : public QuotaClient { 28 class MockStorageClient : public QuotaClient {
30 public: 29 public:
31 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, 30 MockStorageClient(QuotaManagerProxy* quota_manager_proxy,
32 const MockOriginData* mock_data, size_t mock_data_size); 31 const MockOriginData* mock_data, size_t mock_data_size);
33 virtual ~MockStorageClient(); 32 virtual ~MockStorageClient();
34 33
35 // To add or modify mock data in this client. 34 // To add or modify mock data in this client.
36 void AddOriginAndNotify( 35 void AddOriginAndNotify(
37 const GURL& origin_url, StorageType type, int64 size); 36 const GURL& origin_url, StorageType type, int64 size);
38 void ModifyOriginAndNotify( 37 void ModifyOriginAndNotify(
39 const GURL& origin_url, StorageType type, int64 delta); 38 const GURL& origin_url, StorageType type, int64 delta);
40 39
41 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); 40 void AddOriginToErrorSet(const GURL& origin_url, StorageType type);
42 41
43 base::Time IncrementMockTime();
44
45 // QuotaClient methods. 42 // QuotaClient methods.
46 virtual QuotaClient::ID id() const OVERRIDE; 43 virtual QuotaClient::ID id() const OVERRIDE;
47 virtual void OnQuotaManagerDestroyed() OVERRIDE; 44 virtual void OnQuotaManagerDestroyed() OVERRIDE;
48 virtual void GetOriginUsage(const GURL& origin_url, 45 virtual void GetOriginUsage(const GURL& origin_url,
49 StorageType type, 46 StorageType type,
50 GetUsageCallback* callback) OVERRIDE; 47 GetUsageCallback* callback) OVERRIDE;
51 virtual void GetOriginsForType(StorageType type, 48 virtual void GetOriginsForType(StorageType type,
52 GetOriginsCallback* callback) OVERRIDE; 49 GetOriginsCallback* callback) OVERRIDE;
53 virtual void GetOriginsForHost(StorageType type, const std::string& host, 50 virtual void GetOriginsForHost(StorageType type, const std::string& host,
54 GetOriginsCallback* callback) OVERRIDE; 51 GetOriginsCallback* callback) OVERRIDE;
(...skipping 19 matching lines...) Expand all
74 71
75 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; 72 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap;
76 OriginDataMap origin_data_; 73 OriginDataMap origin_data_;
77 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; 74 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet;
78 ErrorOriginSet error_origins_; 75 ErrorOriginSet error_origins_;
79 76
80 std::set<GetUsageCallback*> usage_callbacks_; 77 std::set<GetUsageCallback*> usage_callbacks_;
81 std::set<GetOriginsCallback*> origins_callbacks_; 78 std::set<GetOriginsCallback*> origins_callbacks_;
82 std::set<DeletionCallback*> deletion_callbacks_; 79 std::set<DeletionCallback*> deletion_callbacks_;
83 80
84 int mock_time_counter_;
85
86 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; 81 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_;
87 82
88 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); 83 DISALLOW_COPY_AND_ASSIGN(MockStorageClient);
89 }; 84 };
90 85
91 } // namespace quota 86 } // namespace quota
92 87
93 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ 88 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/quota/mock_storage_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698