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

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

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