Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(812)

Unified Diff: chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h

Issue 1297093002: Cache Storage API: Hook up to chrome://settings/cookies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto https://codereview.chromium.org/1297023004 Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h
diff --git a/chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h b/chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..3943089bc73b7e36a6930c42ea200604d9b4514b
--- /dev/null
+++ b/chrome/browser/browsing_data/mock_browsing_data_cache_storage_helper.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_H_
+#define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_H_
+
+#include <list>
+#include <map>
+
+#include "base/callback.h"
+#include "base/compiler_specific.h"
+#include "chrome/browser/browsing_data/browsing_data_cache_storage_helper.h"
+
+class Profile;
+
+// Mock for BrowsingDataCacheStorageHelper.
+// Use AddCacheStorageSamples() or add directly to response_ list, then
+// call Notify().
+class MockBrowsingDataCacheStorageHelper
+ : public BrowsingDataCacheStorageHelper {
+ public:
+ explicit MockBrowsingDataCacheStorageHelper(Profile* profile);
+
+ // Adds some CacheStorageUsageInfo samples.
+ void AddCacheStorageSamples();
+
+ // Notifies the callback.
+ void Notify();
+
+ // Marks all cache storage files as existing.
+ void Reset();
+
+ // Returns true if all cache storage files were deleted since the last
+ // Reset() invokation.
+ bool AllDeleted();
+
+ // BrowsingDataCacheStorageHelper.
+ void StartFetching(const base::Callback<
+ void(const std::list<content::CacheStorageUsageInfo>&)>&
+ callback) override;
+ void DeleteCacheStorage(const GURL& origin) override;
+
+ private:
+ ~MockBrowsingDataCacheStorageHelper() override;
+
+ base::Callback<void(const std::list<content::CacheStorageUsageInfo>&)>
+ callback_;
+ std::map<GURL, bool> origins_;
+ std::list<content::CacheStorageUsageInfo> response_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataCacheStorageHelper);
+};
+
+#endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_CACHE_STORAGE_HELPER_H_

Powered by Google App Engine
This is Rietveld 408576698