OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "storage/browser/fileapi/async_file_util_adapter.h" | 15 #include "storage/browser/fileapi/async_file_util_adapter.h" |
15 #include "storage/browser/fileapi/file_system_backend.h" | 16 #include "storage/browser/fileapi/file_system_backend.h" |
16 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" | 17 #include "storage/browser/fileapi/task_runner_bound_observer_list.h" |
17 | 18 |
18 namespace base { | 19 namespace base { |
19 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
20 } | 21 } |
21 | 22 |
22 namespace storage { | 23 namespace storage { |
23 class AsyncFileUtilAdapter; | 24 class AsyncFileUtilAdapter; |
(...skipping 25 matching lines...) Expand all Loading... |
49 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( | 50 storage::CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( |
50 storage::FileSystemType type, | 51 storage::FileSystemType type, |
51 base::File::Error* error_code) override; | 52 base::File::Error* error_code) override; |
52 storage::FileSystemOperation* CreateFileSystemOperation( | 53 storage::FileSystemOperation* CreateFileSystemOperation( |
53 const storage::FileSystemURL& url, | 54 const storage::FileSystemURL& url, |
54 storage::FileSystemContext* context, | 55 storage::FileSystemContext* context, |
55 base::File::Error* error_code) const override; | 56 base::File::Error* error_code) const override; |
56 bool SupportsStreaming(const storage::FileSystemURL& url) const override; | 57 bool SupportsStreaming(const storage::FileSystemURL& url) const override; |
57 bool HasInplaceCopyImplementation( | 58 bool HasInplaceCopyImplementation( |
58 storage::FileSystemType type) const override; | 59 storage::FileSystemType type) const override; |
59 scoped_ptr<storage::FileStreamReader> CreateFileStreamReader( | 60 std::unique_ptr<storage::FileStreamReader> CreateFileStreamReader( |
60 const storage::FileSystemURL& url, | 61 const storage::FileSystemURL& url, |
61 int64_t offset, | 62 int64_t offset, |
62 int64_t max_bytes_to_read, | 63 int64_t max_bytes_to_read, |
63 const base::Time& expected_modification_time, | 64 const base::Time& expected_modification_time, |
64 storage::FileSystemContext* context) const override; | 65 storage::FileSystemContext* context) const override; |
65 scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter( | 66 std::unique_ptr<storage::FileStreamWriter> CreateFileStreamWriter( |
66 const storage::FileSystemURL& url, | 67 const storage::FileSystemURL& url, |
67 int64_t offset, | 68 int64_t offset, |
68 storage::FileSystemContext* context) const override; | 69 storage::FileSystemContext* context) const override; |
69 storage::FileSystemQuotaUtil* GetQuotaUtil() override; | 70 storage::FileSystemQuotaUtil* GetQuotaUtil() override; |
70 const storage::UpdateObserverList* GetUpdateObservers( | 71 const storage::UpdateObserverList* GetUpdateObservers( |
71 storage::FileSystemType type) const override; | 72 storage::FileSystemType type) const override; |
72 const storage::ChangeObserverList* GetChangeObservers( | 73 const storage::ChangeObserverList* GetChangeObservers( |
73 storage::FileSystemType type) const override; | 74 storage::FileSystemType type) const override; |
74 const storage::AccessObserverList* GetAccessObservers( | 75 const storage::AccessObserverList* GetAccessObservers( |
75 storage::FileSystemType type) const override; | 76 storage::FileSystemType type) const override; |
76 | 77 |
77 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than | 78 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than |
78 // once. | 79 // once. |
79 void InitializeCopyOrMoveFileValidatorFactory( | 80 void InitializeCopyOrMoveFileValidatorFactory( |
80 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory); | 81 std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> factory); |
81 | 82 |
82 void AddFileChangeObserver(storage::FileChangeObserver* observer); | 83 void AddFileChangeObserver(storage::FileChangeObserver* observer); |
83 | 84 |
84 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true | 85 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true |
85 // GetCopyOrMoveFileValidatorFactory will start returning security | 86 // GetCopyOrMoveFileValidatorFactory will start returning security |
86 // error if validator is not initialized. | 87 // error if validator is not initialized. |
87 void set_require_copy_or_move_validator(bool flag) { | 88 void set_require_copy_or_move_validator(bool flag) { |
88 require_copy_or_move_validator_ = flag; | 89 require_copy_or_move_validator_ = flag; |
89 } | 90 } |
90 | 91 |
91 private: | 92 private: |
92 class QuotaUtil; | 93 class QuotaUtil; |
93 | 94 |
94 base::FilePath base_path_; | 95 base::FilePath base_path_; |
95 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 96 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
96 scoped_ptr<storage::AsyncFileUtilAdapter> file_util_; | 97 std::unique_ptr<storage::AsyncFileUtilAdapter> file_util_; |
97 scoped_ptr<QuotaUtil> quota_util_; | 98 std::unique_ptr<QuotaUtil> quota_util_; |
98 storage::UpdateObserverList update_observers_; | 99 storage::UpdateObserverList update_observers_; |
99 storage::ChangeObserverList change_observers_; | 100 storage::ChangeObserverList change_observers_; |
100 | 101 |
101 bool require_copy_or_move_validator_; | 102 bool require_copy_or_move_validator_; |
102 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> | 103 std::unique_ptr<storage::CopyOrMoveFileValidatorFactory> |
103 copy_or_move_file_validator_factory_; | 104 copy_or_move_file_validator_factory_; |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend); | 106 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend); |
106 }; | 107 }; |
107 | 108 |
108 } // namespace content | 109 } // namespace content |
109 | 110 |
110 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ | 111 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ |
OLD | NEW |