Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_database_helper.h
blobbd16cb065aee63f2c4b4d19a05486deafbbcad44
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>
10 #include <string>
12 #include "base/callback.h"
13 #include "chrome/browser/browsing_data/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 void StartFetching(const base::Callback<void(const std::list<DatabaseInfo>&)>&
23 callback) override;
25 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 ~MockBrowsingDataDatabaseHelper() override;
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_;
55 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataDatabaseHelper);
58 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_