OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" |
13 #include "chrome/browser/browsing_data_local_storage_helper.h" | 14 #include "chrome/browser/browsing_data_local_storage_helper.h" |
14 | 15 |
15 // Mock for BrowsingDataLocalStorageHelper. | 16 // Mock for BrowsingDataLocalStorageHelper. |
16 // Use AddLocalStorageSamples() or add directly to response_ list, then | 17 // Use AddLocalStorageSamples() or add directly to response_ list, then |
17 // call Notify(). | 18 // call Notify(). |
18 class MockBrowsingDataLocalStorageHelper | 19 class MockBrowsingDataLocalStorageHelper |
19 : public BrowsingDataLocalStorageHelper { | 20 : public BrowsingDataLocalStorageHelper { |
20 public: | 21 public: |
21 explicit MockBrowsingDataLocalStorageHelper(Profile* profile); | 22 explicit MockBrowsingDataLocalStorageHelper(Profile* profile); |
22 | 23 |
| 24 // BrowsingDataLocalStorageHelper implementation. |
23 virtual void StartFetching( | 25 virtual void StartFetching( |
24 Callback1<const std::list<LocalStorageInfo>& >::Type* callback); | 26 const base::Callback<void(const std::list<LocalStorageInfo>&)>& callback) |
25 | 27 OVERRIDE; |
26 virtual void CancelNotification(); | 28 virtual void CancelNotification() OVERRIDE; |
27 | 29 virtual void DeleteLocalStorageFile(const FilePath& file_path) OVERRIDE; |
28 virtual void DeleteLocalStorageFile(const FilePath& file_path); | |
29 | 30 |
30 // Adds some LocalStorageInfo samples. | 31 // Adds some LocalStorageInfo samples. |
31 void AddLocalStorageSamples(); | 32 void AddLocalStorageSamples(); |
32 | 33 |
33 // Notifies the callback. | 34 // Notifies the callback. |
34 void Notify(); | 35 void Notify(); |
35 | 36 |
36 // Marks all local storage files as existing. | 37 // Marks all local storage files as existing. |
37 void Reset(); | 38 void Reset(); |
38 | 39 |
39 // Returns true if all local storage files were deleted since the last | 40 // Returns true if all local storage files were deleted since the last Reset() |
40 // Reset() invokation. | 41 // invocation. |
41 bool AllDeleted(); | 42 bool AllDeleted(); |
42 | 43 |
43 FilePath last_deleted_file_; | 44 FilePath last_deleted_file_; |
44 | 45 |
45 private: | 46 private: |
46 virtual ~MockBrowsingDataLocalStorageHelper(); | 47 virtual ~MockBrowsingDataLocalStorageHelper(); |
47 | 48 |
48 Profile* profile_; | 49 Profile* profile_; |
49 | 50 |
50 scoped_ptr<Callback1<const std::list<LocalStorageInfo>& >::Type > | 51 base::Callback<void(const std::list<LocalStorageInfo>&)> callback_; |
51 callback_; | |
52 | 52 |
53 std::map<const FilePath::StringType, bool> files_; | 53 std::map<const FilePath::StringType, bool> files_; |
54 | 54 |
55 std::list<LocalStorageInfo> response_; | 55 std::list<LocalStorageInfo> response_; |
56 }; | 56 }; |
57 | 57 |
58 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ | 58 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_ |
OLD | NEW |