Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_indexed_db_helper.h
blob52e495cb6a6e755294e5b81ecb27b73d5d0b8ffe
1 // Copyright (c) 2012 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.
5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_
8 #include <list>
9 #include <map>
11 #include "base/callback.h"
12 #include "chrome/browser/browsing_data/browsing_data_indexed_db_helper.h"
14 class Profile;
16 // Mock for BrowsingDataIndexedDBHelper.
17 // Use AddIndexedDBSamples() or add directly to response_ list, then
18 // call Notify().
19 class MockBrowsingDataIndexedDBHelper
20 : public BrowsingDataIndexedDBHelper {
21 public:
22 explicit MockBrowsingDataIndexedDBHelper(Profile* profile);
24 // Adds some IndexedDBInfo samples.
25 void AddIndexedDBSamples();
27 // Notifies the callback.
28 void Notify();
30 // Marks all indexed db files as existing.
31 void Reset();
33 // Returns true if all indexed db files were deleted since the last
34 // Reset() invokation.
35 bool AllDeleted();
37 // BrowsingDataIndexedDBHelper.
38 void StartFetching(const FetchCallback& callback) override;
39 void DeleteIndexedDB(const GURL& origin) override;
41 private:
42 ~MockBrowsingDataIndexedDBHelper() override;
44 FetchCallback callback_;
45 std::map<GURL, bool> origins_;
46 std::list<content::IndexedDBInfo> response_;
48 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataIndexedDBHelper);
51 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_