Return backed up TemplateURL on default search change
[chromium-blink-merge.git] / chrome / browser / mock_browsing_data_database_helper.h
blob72f33e04c3eeb30c78a2842e8e660cae18583ad3
1 // Copyright (c) 2011 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_MOCK_BROWSING_DATA_DATABASE_HELPER_H_
6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_DATABASE_HELPER_H_
7 #pragma once
9 #include <list>
10 #include <map>
12 #include "base/callback.h"
13 #include "chrome/browser/browsing_data_database_helper.h"
15 // Mock for BrowsingDataDatabaseHelper.
16 // Use AddDatabaseSamples() or add directly to response_ list, then call
17 // Notify().
18 class MockBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper {
19 public:
20 explicit MockBrowsingDataDatabaseHelper(Profile* profile);
22 virtual void StartFetching(
23 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback)
24 OVERRIDE;
26 virtual void CancelNotification() OVERRIDE;
28 virtual void DeleteDatabase(const std::string& origin,
29 const std::string& name) OVERRIDE;
31 // Adds some DatabaseInfo samples.
32 void AddDatabaseSamples();
34 // Notifies the callback.
35 void Notify();
37 // Marks all databases as existing.
38 void Reset();
40 // Returns true if all databases since the last Reset() invokation were
41 // deleted.
42 bool AllDeleted();
44 std::string last_deleted_origin_;
46 std::string last_deleted_db_;
48 private:
49 virtual ~MockBrowsingDataDatabaseHelper();
51 Profile* profile_;
53 base::Callback<void(const std::list<DatabaseInfo>&)> callback_;
55 // Stores which databases exist.
56 std::map<const std::string, bool> databases_;
58 std::list<DatabaseInfo> response_;
61 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_DATABASE_HELPER_H_