OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ | 5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ |
6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ | 6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_database_helper.h" |
14 | 14 |
15 // Mock for BrowsingDataDatabaseHelper. | 15 // Mock for BrowsingDataDatabaseHelper. |
16 // Use AddDatabaseSamples() or add directly to response_ list, then call | 16 // Use AddDatabaseSamples() or add directly to response_ list, then call |
17 // Notify(). | 17 // Notify(). |
18 class MockBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { | 18 class MockBrowsingDataDatabaseHelper : public BrowsingDataDatabaseHelper { |
19 public: | 19 public: |
20 explicit MockBrowsingDataDatabaseHelper(Profile* profile); | 20 explicit MockBrowsingDataDatabaseHelper(Profile* profile); |
21 | 21 |
22 virtual void StartFetching( | 22 virtual void StartFetching( |
23 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) | 23 const base::Callback<void(const std::list<DatabaseInfo>&)>& callback) |
24 OVERRIDE; | 24 override; |
25 | 25 |
26 virtual void DeleteDatabase(const std::string& origin, | 26 virtual void DeleteDatabase(const std::string& origin, |
27 const std::string& name) OVERRIDE; | 27 const std::string& name) override; |
28 | 28 |
29 // Adds some DatabaseInfo samples. | 29 // Adds some DatabaseInfo samples. |
30 void AddDatabaseSamples(); | 30 void AddDatabaseSamples(); |
31 | 31 |
32 // Notifies the callback. | 32 // Notifies the callback. |
33 void Notify(); | 33 void Notify(); |
34 | 34 |
35 // Marks all databases as existing. | 35 // Marks all databases as existing. |
36 void Reset(); | 36 void Reset(); |
37 | 37 |
(...skipping 12 matching lines...) Expand all Loading... |
50 | 50 |
51 // Stores which databases exist. | 51 // Stores which databases exist. |
52 std::map<const std::string, bool> databases_; | 52 std::map<const std::string, bool> databases_; |
53 | 53 |
54 std::list<DatabaseInfo> response_; | 54 std::list<DatabaseInfo> response_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataDatabaseHelper); | 56 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataDatabaseHelper); |
57 }; | 57 }; |
58 | 58 |
59 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ | 59 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_DATABASE_HELPER_H_ |
OLD | NEW |