OLD | NEW |
---|---|
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 <utility> | |
9 #include <set> | 10 #include <set> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/task.h" | 14 #include "base/task.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "webkit/quota/quota_client.h" | 17 #include "webkit/quota/quota_client.h" |
17 | 18 |
18 namespace quota { | 19 namespace quota { |
(...skipping 22 matching lines...) Expand all Loading... | |
41 | 42 |
42 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); | 43 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); |
43 | 44 |
44 base::Time IncrementMockTime(); | 45 base::Time IncrementMockTime(); |
45 | 46 |
46 // QuotaClient methods. | 47 // QuotaClient methods. |
47 virtual QuotaClient::ID id() const OVERRIDE; | 48 virtual QuotaClient::ID id() const OVERRIDE; |
48 virtual void OnQuotaManagerDestroyed() OVERRIDE; | 49 virtual void OnQuotaManagerDestroyed() OVERRIDE; |
49 virtual void GetOriginUsage(const GURL& origin_url, | 50 virtual void GetOriginUsage(const GURL& origin_url, |
50 StorageType type, | 51 StorageType type, |
51 GetUsageCallback* callback) OVERRIDE; | 52 GetUsageCallback callback) OVERRIDE; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
52 virtual void GetOriginsForType(StorageType type, | 53 virtual void GetOriginsForType(StorageType type, |
53 GetOriginsCallback* callback) OVERRIDE; | 54 GetOriginsCallback callback) OVERRIDE; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
54 virtual void GetOriginsForHost(StorageType type, const std::string& host, | 55 virtual void GetOriginsForHost(StorageType type, const std::string& host, |
55 GetOriginsCallback* callback) OVERRIDE; | 56 GetOriginsCallback callback) OVERRIDE; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
56 virtual void DeleteOriginData(const GURL& origin, | 57 virtual void DeleteOriginData(const GURL& origin, |
57 StorageType type, | 58 StorageType type, |
58 DeletionCallback* callback) OVERRIDE; | 59 DeletionCallback callback) OVERRIDE; |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
59 | 60 |
60 private: | 61 private: |
61 void RunGetOriginUsage(const GURL& origin_url, | 62 void RunGetOriginUsage(const GURL& origin_url, |
62 StorageType type, | 63 StorageType type, |
63 GetUsageCallback* callback); | 64 GetUsageCallback callback); |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
64 void RunGetOriginsForType(StorageType type, | 65 void RunGetOriginsForType(StorageType type, |
65 GetOriginsCallback* callback); | 66 GetOriginsCallback callback); |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
66 void RunGetOriginsForHost(StorageType type, | 67 void RunGetOriginsForHost(StorageType type, |
67 const std::string& host, | 68 const std::string& host, |
68 GetOriginsCallback* callback); | 69 GetOriginsCallback callback); |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
69 void RunDeleteOriginData(const GURL& origin_url, | 70 void RunDeleteOriginData(const GURL& origin_url, |
70 StorageType type, | 71 StorageType type, |
71 DeletionCallback* callback); | 72 DeletionCallback callback); |
awong
2011/09/29 18:05:15
const &.
tzik
2011/10/11 04:53:57
Done.
| |
72 | 73 |
73 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; | 74 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; |
74 const ID id_; | 75 const ID id_; |
75 | 76 |
76 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; | 77 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; |
77 OriginDataMap origin_data_; | 78 OriginDataMap origin_data_; |
78 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; | 79 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; |
79 ErrorOriginSet error_origins_; | 80 ErrorOriginSet error_origins_; |
80 | 81 |
81 std::set<GetUsageCallback*> usage_callbacks_; | |
82 std::set<GetOriginsCallback*> origins_callbacks_; | |
83 std::set<DeletionCallback*> deletion_callbacks_; | |
84 | |
85 int mock_time_counter_; | 82 int mock_time_counter_; |
86 | 83 |
87 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; | 84 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; |
88 | 85 |
89 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); | 86 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); |
90 }; | 87 }; |
91 | 88 |
92 } // namespace quota | 89 } // namespace quota |
93 | 90 |
94 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ | 91 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ |
OLD | NEW |