Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_database_helper.h
blob2dc0d8382be4adf8e3a45909de757b1a3a885e4c
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 FetchCallback& callback) override;
24 void DeleteDatabase(const std::string& origin,
25 const std::string& name) override;
27 // Adds some DatabaseInfo samples.
28 void AddDatabaseSamples();
30 // Notifies the callback.
31 void Notify();
33 // Marks all databases as existing.
34 void Reset();
36 // Returns true if all databases since the last Reset() invokation were
37 // deleted.
38 bool AllDeleted();
40 std::string last_deleted_origin_;
42 std::string last_deleted_db_;
44 private:
45 ~MockBrowsingDataDatabaseHelper() override;
47 FetchCallback callback_;
49 // Stores which databases exist.
50 std::map<const std::string, bool> databases_;
52 std::list<DatabaseInfo> response_;
54 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataDatabaseHelper);
57 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_