| 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_FILE_SYSTEM_HELPER_H_ | 5 #ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
| 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 6 #define CHROME_BROWSER_MOCK_BROWSING_DATA_FILE_SYSTEM_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_file_system_helper.h" | 14 #include "chrome/browser/browsing_data_file_system_helper.h" |
| 14 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
| 15 | 16 |
| 16 // Mock for BrowsingDataFileSystemHelper. | 17 // Mock for BrowsingDataFileSystemHelper. |
| 17 // Use AddFileSystemSamples() or add directly to response_ list, then call | 18 // Use AddFileSystemSamples() or add directly to response_ list, then call |
| 18 // Notify(). | 19 // Notify(). |
| 19 class MockBrowsingDataFileSystemHelper : public BrowsingDataFileSystemHelper { | 20 class MockBrowsingDataFileSystemHelper : public BrowsingDataFileSystemHelper { |
| 20 public: | 21 public: |
| 21 explicit MockBrowsingDataFileSystemHelper(Profile* profile); | 22 explicit MockBrowsingDataFileSystemHelper(Profile* profile); |
| 22 | 23 |
| 23 virtual void StartFetching( | 24 // BrowsingDataFileSystemHelper implementation. |
| 24 Callback1<const std::list<FileSystemInfo>& >::Type* callback); | 25 virtual void StartFetching(const base::Callback< |
| 25 | 26 void(const std::list<FileSystemInfo>&)>& callback) OVERRIDE; |
| 26 virtual void CancelNotification(); | 27 virtual void CancelNotification() OVERRIDE; |
| 27 | 28 virtual void DeleteFileSystemOrigin(const GURL& origin) OVERRIDE; |
| 28 virtual void DeleteFileSystemOrigin(const GURL& origin); | |
| 29 | 29 |
| 30 // Adds a specific filesystem. | 30 // Adds a specific filesystem. |
| 31 void AddFileSystem(const GURL& origin, | 31 void AddFileSystem(const GURL& origin, |
| 32 bool has_persistent, | 32 bool has_persistent, |
| 33 bool has_temporary); | 33 bool has_temporary); |
| 34 | 34 |
| 35 // Adds some FilesystemInfo samples. | 35 // Adds some FilesystemInfo samples. |
| 36 void AddFileSystemSamples(); | 36 void AddFileSystemSamples(); |
| 37 | 37 |
| 38 // Notifies the callback. | 38 // Notifies the callback. |
| 39 void Notify(); | 39 void Notify(); |
| 40 | 40 |
| 41 // Marks all filesystems as existing. | 41 // Marks all filesystems as existing. |
| 42 void Reset(); | 42 void Reset(); |
| 43 | 43 |
| 44 // Returns true if all filesystemss since the last Reset() invokation were | 44 // Returns true if all filesystemss since the last Reset() invocation were |
| 45 // deleted. | 45 // deleted. |
| 46 bool AllDeleted(); | 46 bool AllDeleted(); |
| 47 | 47 |
| 48 GURL last_deleted_origin_; | 48 GURL last_deleted_origin_; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 virtual ~MockBrowsingDataFileSystemHelper(); | 51 virtual ~MockBrowsingDataFileSystemHelper(); |
| 52 | 52 |
| 53 Profile* profile_; | 53 Profile* profile_; |
| 54 | 54 |
| 55 scoped_ptr<Callback1<const std::list<FileSystemInfo>& >::Type > | 55 base::Callback<void(const std::list<FileSystemInfo>&)> callback_; |
| 56 callback_; | |
| 57 | 56 |
| 58 // Stores which filesystems exist. | 57 // Stores which filesystems exist. |
| 59 std::map<const std::string, bool> file_systems_; | 58 std::map<const std::string, bool> file_systems_; |
| 60 | 59 |
| 61 std::list<FileSystemInfo> response_; | 60 std::list<FileSystemInfo> response_; |
| 62 }; | 61 }; |
| 63 | 62 |
| 64 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ | 63 #endif // CHROME_BROWSER_MOCK_BROWSING_DATA_FILE_SYSTEM_HELPER_H_ |
| OLD | NEW |