| 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_INDEXED_DB_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> |
| 9 #include <map> | 10 #include <map> |
| 10 #include <vector> | |
| 11 | 11 |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "chrome/browser/browsing_data_indexed_db_helper.h" | 14 #include "chrome/browser/browsing_data_indexed_db_helper.h" |
| 15 | 15 |
| 16 // Mock for BrowsingDataIndexedDBHelper. | 16 // Mock for BrowsingDataIndexedDBHelper. |
| 17 // Use AddIndexedDBSamples() or add directly to response_ vector, then | 17 // Use AddIndexedDBSamples() or add directly to response_ list, then |
| 18 // call Notify(). | 18 // call Notify(). |
| 19 class MockBrowsingDataIndexedDBHelper | 19 class MockBrowsingDataIndexedDBHelper |
| 20 : public BrowsingDataIndexedDBHelper { | 20 : public BrowsingDataIndexedDBHelper { |
| 21 public: | 21 public: |
| 22 explicit MockBrowsingDataIndexedDBHelper(Profile* profile); | 22 explicit MockBrowsingDataIndexedDBHelper(Profile* profile); |
| 23 | 23 |
| 24 // Adds some IndexedDBInfo samples. | 24 // Adds some IndexedDBInfo samples. |
| 25 void AddIndexedDBSamples(); | 25 void AddIndexedDBSamples(); |
| 26 | 26 |
| 27 // Notifies the callback. | 27 // Notifies the callback. |
| 28 void Notify(); | 28 void Notify(); |
| 29 | 29 |
| 30 // Marks all indexed db files as existing. | 30 // Marks all indexed db files as existing. |
| 31 void Reset(); | 31 void Reset(); |
| 32 | 32 |
| 33 // Returns true if all indexed db files were deleted since the last | 33 // Returns true if all indexed db files were deleted since the last |
| 34 // Reset() invokation. | 34 // Reset() invokation. |
| 35 bool AllDeleted(); | 35 bool AllDeleted(); |
| 36 | 36 |
| 37 // BrowsingDataIndexedDBHelper. | 37 // BrowsingDataIndexedDBHelper. |
| 38 virtual void StartFetching( | 38 virtual void StartFetching( |
| 39 Callback1<const std::vector<IndexedDBInfo>& >::Type* callback); | 39 Callback1<const std::list<IndexedDBInfo>& >::Type* callback); |
| 40 virtual void CancelNotification(); | 40 virtual void CancelNotification(); |
| 41 virtual void DeleteIndexedDBFile(const FilePath& file_path); | 41 virtual void DeleteIndexedDBFile(const FilePath& file_path); |
| 42 | 42 |
| 43 FilePath last_deleted_file_; | 43 FilePath last_deleted_file_; |
| 44 | 44 |
| 45 private: | 45 private: |
| 46 virtual ~MockBrowsingDataIndexedDBHelper(); | 46 virtual ~MockBrowsingDataIndexedDBHelper(); |
| 47 | 47 |
| 48 Profile* profile_; | 48 Profile* profile_; |
| 49 | 49 |
| 50 scoped_ptr<Callback1<const std::vector<IndexedDBInfo>& >::Type > | 50 scoped_ptr<Callback1<const std::list<IndexedDBInfo>& >::Type > |
| 51 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::vector<IndexedDBInfo> response_; | 55 std::list<IndexedDBInfo> response_; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_ | 58 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_INDEXED_DB_HELPER_H_ |
| OLD | NEW |