| 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 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // QuotaClient methods. | 30 // QuotaClient methods. |
| 31 virtual QuotaClient::ID id() const OVERRIDE; | 31 virtual QuotaClient::ID id() const OVERRIDE; |
| 32 virtual void OnQuotaManagerDestroyed() OVERRIDE; | 32 virtual void OnQuotaManagerDestroyed() OVERRIDE; |
| 33 virtual void GetOriginUsage(const GURL& origin_url, | 33 virtual void GetOriginUsage(const GURL& origin_url, |
| 34 StorageType type, | 34 StorageType type, |
| 35 GetUsageCallback* callback) OVERRIDE; | 35 GetUsageCallback* callback) OVERRIDE; |
| 36 virtual void GetOriginsForType(StorageType type, | 36 virtual void GetOriginsForType(StorageType type, |
| 37 GetOriginsCallback* callback) OVERRIDE; | 37 GetOriginsCallback* callback) OVERRIDE; |
| 38 virtual void GetOriginsForHost(StorageType type, const std::string& host, | 38 virtual void GetOriginsForHost(StorageType type, const std::string& host, |
| 39 GetOriginsCallback* callback) OVERRIDE; | 39 GetOriginsCallback* callback) OVERRIDE; |
| 40 virtual void DeleteOriginData(const GURL& origin, |
| 41 StorageType type, |
| 42 DeletionCallback* callback) OVERRIDE; |
| 40 | 43 |
| 41 private: | 44 private: |
| 42 void RunGetOriginUsage(const GURL& origin_url, | 45 void RunGetOriginUsage(const GURL& origin_url, |
| 43 StorageType type, | 46 StorageType type, |
| 44 GetUsageCallback* callback); | 47 GetUsageCallback* callback); |
| 45 void RunGetOriginsForType(StorageType type, | 48 void RunGetOriginsForType(StorageType type, |
| 46 GetOriginsCallback* callback); | 49 GetOriginsCallback* callback); |
| 47 void RunGetOriginsForHost(StorageType type, | 50 void RunGetOriginsForHost(StorageType type, |
| 48 const std::string& host, | 51 const std::string& host, |
| 49 GetOriginsCallback* callback); | 52 GetOriginsCallback* callback); |
| 53 void RunDeleteOriginData(DeletionCallback* callback); |
| 50 | 54 |
| 51 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; | 55 scoped_refptr<QuotaManagerProxy> quota_manager_proxy_; |
| 52 const ID id_; | 56 const ID id_; |
| 53 | 57 |
| 54 struct MockOriginData { | 58 struct MockOriginData { |
| 55 MockOriginData(StorageType type, int64 usage) : type(type), usage(usage) { } | 59 MockOriginData(StorageType type, int64 usage) : type(type), usage(usage) { } |
| 56 StorageType type; | 60 StorageType type; |
| 57 int64 usage; | 61 int64 usage; |
| 58 }; | 62 }; |
| 59 std::map<GURL, MockOriginData> origin_data_; | 63 std::map<GURL, MockOriginData> origin_data_; |
| 60 | 64 |
| 61 std::set<GetUsageCallback*> usage_callbacks_; | 65 std::set<GetUsageCallback*> usage_callbacks_; |
| 62 std::set<GetOriginsCallback*> origins_callbacks_; | 66 std::set<GetOriginsCallback*> origins_callbacks_; |
| 67 std::set<DeletionCallback*> deletion_callbacks_; |
| 63 | 68 |
| 64 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; | 69 ScopedRunnableMethodFactory<MockStorageClient> runnable_factory_; |
| 65 | 70 |
| 66 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); | 71 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); |
| 67 }; | 72 }; |
| 68 | 73 |
| 69 } // namespace quota | 74 } // namespace quota |
| 70 | 75 |
| 71 #endif // WEBKIT_QUOTA_MOCK_STORAGE_H_ | 76 #endif // WEBKIT_QUOTA_MOCK_STORAGE_H_ |
| OLD | NEW |