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_
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
17 class MockBrowsingDataDatabaseHelper
: public BrowsingDataDatabaseHelper
{
19 explicit MockBrowsingDataDatabaseHelper(Profile
* profile
);
21 virtual void StartFetching(
22 const base::Callback
<void(const std::list
<DatabaseInfo
>&)>& callback
)
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.
34 // Marks all databases as existing.
37 // Returns true if all databases since the last Reset() invokation were
41 std::string last_deleted_origin_
;
43 std::string last_deleted_db_
;
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_