Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_database_helper.h
blob9e6ea9fe11a64424c5b70c1d967d5ced296aafd0
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_DATABASE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_
8 #include <list>
9 #include <map>
11 #include "base/callback.h"
12 #include "chrome/browser/browsing_data/browsing_data_database_helper.h"
14 // Mock for BrowsingDataDatabaseHelper.
15 // Use AddDatabaseSamples() or add directly to response_ list, then call
16 // Notify().
17 class MockBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper {
18 public:
19 explicit MockBrowsingDataDatabaseHelper(Profile* profile);
21 virtual void StartFetching(
22 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback)
23 OVERRIDE;
25 virtual void DeleteDatabase(const std::string& origin,
26 const std::string& name) OVERRIDE;
28 // Adds some DatabaseInfo samples.
29 void AddDatabaseSamples();
31 // Notifies the callback.
32 void Notify();
34 // Marks all databases as existing.
35 void Reset();
37 // Returns true if all databases since the last Reset() invokation were
38 // deleted.
39 bool AllDeleted();
41 std::string last_deleted_origin_;
43 std::string last_deleted_db_;
45 private:
46 virtual ~MockBrowsingDataDatabaseHelper();
48 base::Callback<void(const std::list<DatabaseInfo>&)> callback_;
50 // Stores which databases exist.
51 std::map<const std::string, bool> databases_;
53 std::list<DatabaseInfo> response_;
56 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_