Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ | |
| 6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_H_ | |
| 7 | |
| 8 #include <list> | |
| 9 #include <map> | |
| 10 | |
| 11 #include "base/callback.h" | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h" | |
| 14 | |
| 15 class Profile; | |
| 16 | |
| 17 // Mock for BrowsingDataCacheStorageHelper. | |
| 18 // Use AddCacheStorageSamples() or add directly to response_ list, then | |
| 19 // call Notify(). | |
| 20 class MockBrowsingDataCacheStorageHelper | |
|
michaeln
2015/08/18 22:25:52
+1 when in rome but... (insert munch scream image)
Bernhard Bauer
2015/08/20 11:18:53
FWIW, canned isn't actually for testing -- it's fo
| |
| 21 : public BrowsingDataCacheStorageHelper { | |
| 22 public: | |
| 23 explicit MockBrowsingDataCacheStorageHelper(Profile* profile); | |
| 24 | |
| 25 // Adds some CacheStorageUsageInfo samples. | |
| 26 void AddCacheStorageSamples(); | |
| 27 | |
| 28 // Notifies the callback. | |
| 29 void Notify(); | |
| 30 | |
| 31 // Marks all cache storage files as existing. | |
| 32 void Reset(); | |
| 33 | |
| 34 // Returns true if all cache storage files were deleted since the last | |
| 35 // Reset() invokation. | |
| 36 bool AllDeleted(); | |
| 37 | |
| 38 // BrowsingDataCacheStorageHelper. | |
| 39 void StartFetching(const base::Callback< | |
| 40 void(const std::list<content::CacheStorageUsageInfo>&)>& | |
| 41 callback) override; | |
| 42 void DeleteCacheStorage(const GURL& origin) override; | |
| 43 | |
| 44 private: | |
| 45 ~MockBrowsingDataCacheStorageHelper() override; | |
| 46 | |
| 47 base::Callback<void(const std::list<content::CacheStorageUsageInfo>&)> | |
| 48 callback_; | |
| 49 std::map<GURL, bool> origins_; | |
| 50 std::list<content::CacheStorageUsageInfo> response_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCacheStorageHelper); | |
| 53 }; | |
| 54 | |
| 55 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_ H_ | |
| OLD | NEW |