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 <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 struct MockOriginData { | 23 struct MockOriginData { |
24 const char* origin; | 24 const char* origin; |
25 StorageType type; | 25 StorageType type; |
26 int64 usage; | 26 int64 usage; |
27 }; | 27 }; |
28 | 28 |
29 // Mock storage class for testing. | 29 // Mock storage class for testing. |
30 class MockStorageClient : public QuotaClient { | 30 class MockStorageClient : public QuotaClient { |
31 public: | 31 public: |
32 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, | 32 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, |
33 const MockOriginData* mock_data, size_t mock_data_size); | 33 const MockOriginData* mock_data, |
34 size_t mock_data_size); | |
35 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, | |
36 const MockOriginData* mock_data, | |
37 QuotaClient::ID id, | |
38 size_t mock_data_size); | |
34 virtual ~MockStorageClient(); | 39 virtual ~MockStorageClient(); |
35 | 40 |
36 // To add or modify mock data in this client. | 41 // To add or modify mock data in this client. |
37 void AddOriginAndNotify( | 42 void AddOriginAndNotify( |
38 const GURL& origin_url, StorageType type, int64 size); | 43 const GURL& origin_url, StorageType type, int64 size); |
39 void ModifyOriginAndNotify( | 44 void ModifyOriginAndNotify( |
40 const GURL& origin_url, StorageType type, int64 delta); | 45 const GURL& origin_url, StorageType type, int64 delta); |
41 void TouchAllOriginsAndNotify(); | 46 void TouchAllOriginsAndNotify(); |
42 | 47 |
43 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); | 48 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); |
(...skipping 20 matching lines...) Expand all Loading... | |
64 const GetUsageCallback& callback); | 69 const GetUsageCallback& callback); |
65 void RunGetOriginsForType(StorageType type, | 70 void RunGetOriginsForType(StorageType type, |
66 const GetOriginsCallback& callback); | 71 const GetOriginsCallback& callback); |
67 void RunGetOriginsForHost(StorageType type, | 72 void RunGetOriginsForHost(StorageType type, |
68 const std::string& host, | 73 const std::string& host, |
69 const GetOriginsCallback& callback); | 74 const GetOriginsCallback& callback); |
70 void RunDeleteOriginData(const GURL& origin_url, | 75 void RunDeleteOriginData(const GURL& origin_url, |
71 StorageType type, | 76 StorageType type, |
72 const DeletionCallback& callback); | 77 const DeletionCallback& callback); |
73 | 78 |
79 void Populate_(const MockOriginData* mock_data, size_t mock_data_size); | |
kinuko
2012/01/22 18:35:31
Why does this method name end with '_'? (It doesn
Mike West
2012/01/22 20:54:38
Probably because I've been writing too much JavaSc
| |
80 | |
74 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; | 81 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; |
75 const ID id_; | 82 const ID id_; |
76 | 83 |
77 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; | 84 typedef std::map<std::pair<GURL, StorageType>, int64> OriginDataMap; |
78 OriginDataMap origin_data_; | 85 OriginDataMap origin_data_; |
79 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; | 86 typedef std::set<std::pair<GURL, StorageType> > ErrorOriginSet; |
80 ErrorOriginSet error_origins_; | 87 ErrorOriginSet error_origins_; |
81 | 88 |
82 int mock_time_counter_; | 89 int mock_time_counter_; |
83 | 90 |
84 base::WeakPtrFactory<MockStorageClient> weak_factory_; | 91 base::WeakPtrFactory<MockStorageClient> weak_factory_; |
85 | 92 |
86 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); | 93 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); |
87 }; | 94 }; |
88 | 95 |
89 } // namespace quota | 96 } // namespace quota |
90 | 97 |
91 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ | 98 #endif // WEBKIT_QUOTA_MOCK_STORAGE_CLIENT_H_ |
OLD | NEW |