Return backed up TemplateURL on default search change
[chromium-blink-merge.git] / chrome / browser / mock_browsing_data_local_storage_helper.h
blobdbc6a4a929c010318b67dd91b86e4a832ed72799
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_
7 #pragma once
9 #include <list>
10 #include <map>
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
18 // call Notify().
19 class MockBrowsingDataLocalStorageHelper
20 : public BrowsingDataLocalStorageHelper {
21 public:
22 explicit MockBrowsingDataLocalStorageHelper(Profile* profile);
24 // BrowsingDataLocalStorageHelper implementation.
25 virtual void StartFetching(
26 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback)
27 OVERRIDE;
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.
35 void Notify();
37 // Marks all local storage files as existing.
38 void Reset();
40 // Returns true if all local storage files were deleted since the last Reset()
41 // invocation.
42 bool AllDeleted();
44 FilePath last_deleted_file_;
46 private:
47 virtual ~MockBrowsingDataLocalStorageHelper();
49 Profile* profile_;
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_