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_LOCAL_STORAGE_HELPER_H_
6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
12 #include "base/callback.h"
13 #include "base/compiler_specific.h"
14 #include "chrome/browser/browsing_data_local_storage_helper.h"
16 // Mock for BrowsingDataLocalStorageHelper.
17 // Use AddLocalStorageSamples() or add directly to response_ list, then
19 class MockBrowsingDataLocalStorageHelper
20 : public BrowsingDataLocalStorageHelper
{
22 explicit MockBrowsingDataLocalStorageHelper(Profile
* profile
);
24 // BrowsingDataLocalStorageHelper implementation.
25 virtual void StartFetching(
26 const base::Callback
<void(const std::list
<LocalStorageInfo
>&)>& callback
)
28 virtual void CancelNotification() OVERRIDE
;
29 virtual void DeleteLocalStorageFile(const FilePath
& file_path
) OVERRIDE
;
31 // Adds some LocalStorageInfo samples.
32 void AddLocalStorageSamples();
34 // Notifies the callback.
37 // Marks all local storage files as existing.
40 // Returns true if all local storage files were deleted since the last Reset()
44 FilePath last_deleted_file_
;
47 virtual ~MockBrowsingDataLocalStorageHelper();
51 base::Callback
<void(const std::list
<LocalStorageInfo
>&)> callback_
;
53 std::map
<const FilePath::StringType
, bool> files_
;
55 std::list
<LocalStorageInfo
> response_
;
58 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_