| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_ |
| 6 #define CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_ | 6 #define CONTENT_PUBLIC_TEST_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 21 matching lines...) Expand all Loading... |
| 32 int64 usage; | 32 int64 usage; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 // Mock storage class for testing. | 35 // Mock storage class for testing. |
| 36 class MockStorageClient : public QuotaClient { | 36 class MockStorageClient : public QuotaClient { |
| 37 public: | 37 public: |
| 38 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, | 38 MockStorageClient(QuotaManagerProxy* quota_manager_proxy, |
| 39 const MockOriginData* mock_data, | 39 const MockOriginData* mock_data, |
| 40 QuotaClient::ID id, | 40 QuotaClient::ID id, |
| 41 size_t mock_data_size); | 41 size_t mock_data_size); |
| 42 virtual ~MockStorageClient(); | 42 ~MockStorageClient() override; |
| 43 | 43 |
| 44 // To add or modify mock data in this client. | 44 // To add or modify mock data in this client. |
| 45 void AddOriginAndNotify( | 45 void AddOriginAndNotify( |
| 46 const GURL& origin_url, StorageType type, int64 size); | 46 const GURL& origin_url, StorageType type, int64 size); |
| 47 void ModifyOriginAndNotify( | 47 void ModifyOriginAndNotify( |
| 48 const GURL& origin_url, StorageType type, int64 delta); | 48 const GURL& origin_url, StorageType type, int64 delta); |
| 49 void TouchAllOriginsAndNotify(); | 49 void TouchAllOriginsAndNotify(); |
| 50 | 50 |
| 51 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); | 51 void AddOriginToErrorSet(const GURL& origin_url, StorageType type); |
| 52 | 52 |
| 53 base::Time IncrementMockTime(); | 53 base::Time IncrementMockTime(); |
| 54 | 54 |
| 55 // QuotaClient methods. | 55 // QuotaClient methods. |
| 56 virtual QuotaClient::ID id() const override; | 56 QuotaClient::ID id() const override; |
| 57 virtual void OnQuotaManagerDestroyed() override; | 57 void OnQuotaManagerDestroyed() override; |
| 58 virtual void GetOriginUsage(const GURL& origin_url, | 58 void GetOriginUsage(const GURL& origin_url, |
| 59 StorageType type, | 59 StorageType type, |
| 60 const GetUsageCallback& callback) override; | 60 const GetUsageCallback& callback) override; |
| 61 virtual void GetOriginsForType(StorageType type, | 61 void GetOriginsForType(StorageType type, |
| 62 const GetOriginsCallback& callback) override; | 62 const GetOriginsCallback& callback) override; |
| 63 virtual void GetOriginsForHost(StorageType type, const std::string& host, | 63 void GetOriginsForHost(StorageType type, |
| 64 const GetOriginsCallback& callback) override; | 64 const std::string& host, |
| 65 virtual void DeleteOriginData(const GURL& origin, | 65 const GetOriginsCallback& callback) override; |
| 66 StorageType type, | 66 void DeleteOriginData(const GURL& origin, |
| 67 const DeletionCallback& callback) override; | 67 StorageType type, |
| 68 virtual bool DoesSupport(storage::StorageType type) const override; | 68 const DeletionCallback& callback) override; |
| 69 bool DoesSupport(storage::StorageType type) const override; |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 void RunGetOriginUsage(const GURL& origin_url, | 72 void RunGetOriginUsage(const GURL& origin_url, |
| 72 StorageType type, | 73 StorageType type, |
| 73 const GetUsageCallback& callback); | 74 const GetUsageCallback& callback); |
| 74 void RunGetOriginsForType(StorageType type, | 75 void RunGetOriginsForType(StorageType type, |
| 75 const GetOriginsCallback& callback); | 76 const GetOriginsCallback& callback); |
| 76 void RunGetOriginsForHost(StorageType type, | 77 void RunGetOriginsForHost(StorageType type, |
| 77 const std::string& host, | 78 const std::string& host, |
| 78 const GetOriginsCallback& callback); | 79 const GetOriginsCallback& callback); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 93 int mock_time_counter_; | 94 int mock_time_counter_; |
| 94 | 95 |
| 95 base::WeakPtrFactory<MockStorageClient> weak_factory_; | 96 base::WeakPtrFactory<MockStorageClient> weak_factory_; |
| 96 | 97 |
| 97 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); | 98 DISALLOW_COPY_AND_ASSIGN(MockStorageClient); |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace content | 101 } // namespace content |
| 101 | 102 |
| 102 #endif // CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_ | 103 #endif // CONTENT_PUBLIC_TEST_MOCK_STORAGE_CLIENT_H_ |
| OLD | NEW |