Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1273)

Side by Side Diff: content/public/test/test_file_system_backend.h

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "webkit/browser/fileapi/async_file_util_adapter.h" 11 #include "storage/browser/fileapi/async_file_util_adapter.h"
12 #include "webkit/browser/fileapi/file_system_backend.h" 12 #include "storage/browser/fileapi/file_system_backend.h"
13 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" 13 #include "storage/browser/fileapi/task_runner_bound_observer_list.h"
14 14
15 namespace base { 15 namespace base {
16 class SequencedTaskRunner; 16 class SequencedTaskRunner;
17 } 17 }
18 18
19 namespace fileapi { 19 namespace storage {
20 class AsyncFileUtilAdapter; 20 class AsyncFileUtilAdapter;
21 class FileSystemQuotaUtil; 21 class FileSystemQuotaUtil;
22 } 22 }
23 23
24 namespace content { 24 namespace content {
25 25
26 // This should be only used for testing. 26 // This should be only used for testing.
27 // This file system backend uses LocalFileUtil and stores data file 27 // This file system backend uses LocalFileUtil and stores data file
28 // under the given directory. 28 // under the given directory.
29 class TestFileSystemBackend : public fileapi::FileSystemBackend { 29 class TestFileSystemBackend : public storage::FileSystemBackend {
30 public: 30 public:
31 TestFileSystemBackend( 31 TestFileSystemBackend(
32 base::SequencedTaskRunner* task_runner, 32 base::SequencedTaskRunner* task_runner,
33 const base::FilePath& base_path); 33 const base::FilePath& base_path);
34 virtual ~TestFileSystemBackend(); 34 virtual ~TestFileSystemBackend();
35 35
36 // FileSystemBackend implementation. 36 // FileSystemBackend implementation.
37 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; 37 virtual bool CanHandleType(storage::FileSystemType type) const OVERRIDE;
38 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; 38 virtual void Initialize(storage::FileSystemContext* context) OVERRIDE;
39 virtual void ResolveURL(const fileapi::FileSystemURL& url, 39 virtual void ResolveURL(const storage::FileSystemURL& url,
40 fileapi::OpenFileSystemMode mode, 40 storage::OpenFileSystemMode mode,
41 const OpenFileSystemCallback& callback) OVERRIDE; 41 const OpenFileSystemCallback& callback) OVERRIDE;
42 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( 42 virtual storage::AsyncFileUtil* GetAsyncFileUtil(
43 fileapi::FileSystemType type) OVERRIDE; 43 storage::FileSystemType type) OVERRIDE;
44 virtual fileapi::CopyOrMoveFileValidatorFactory* 44 virtual storage::CopyOrMoveFileValidatorFactory*
45 GetCopyOrMoveFileValidatorFactory( 45 GetCopyOrMoveFileValidatorFactory(storage::FileSystemType type,
46 fileapi::FileSystemType type, 46 base::File::Error* error_code) OVERRIDE;
47 base::File::Error* error_code) OVERRIDE; 47 virtual storage::FileSystemOperation* CreateFileSystemOperation(
48 virtual fileapi::FileSystemOperation* CreateFileSystemOperation( 48 const storage::FileSystemURL& url,
49 const fileapi::FileSystemURL& url, 49 storage::FileSystemContext* context,
50 fileapi::FileSystemContext* context,
51 base::File::Error* error_code) const OVERRIDE; 50 base::File::Error* error_code) const OVERRIDE;
52 virtual bool SupportsStreaming( 51 virtual bool SupportsStreaming(
53 const fileapi::FileSystemURL& url) const OVERRIDE; 52 const storage::FileSystemURL& url) const OVERRIDE;
54 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( 53 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
55 const fileapi::FileSystemURL& url, 54 const storage::FileSystemURL& url,
56 int64 offset, 55 int64 offset,
57 const base::Time& expected_modification_time, 56 const base::Time& expected_modification_time,
58 fileapi::FileSystemContext* context) const OVERRIDE; 57 storage::FileSystemContext* context) const OVERRIDE;
59 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( 58 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
60 const fileapi::FileSystemURL& url, 59 const storage::FileSystemURL& url,
61 int64 offset, 60 int64 offset,
62 fileapi::FileSystemContext* context) const OVERRIDE; 61 storage::FileSystemContext* context) const OVERRIDE;
63 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; 62 virtual storage::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
64 63
65 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than 64 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than
66 // once. 65 // once.
67 void InitializeCopyOrMoveFileValidatorFactory( 66 void InitializeCopyOrMoveFileValidatorFactory(
68 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> factory); 67 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory);
69 68
70 const fileapi::UpdateObserverList* 69 const storage::UpdateObserverList* GetUpdateObservers(
71 GetUpdateObservers(fileapi::FileSystemType type) const; 70 storage::FileSystemType type) const;
72 void AddFileChangeObserver(fileapi::FileChangeObserver* observer); 71 void AddFileChangeObserver(storage::FileChangeObserver* observer);
73 72
74 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true 73 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true
75 // GetCopyOrMoveFileValidatorFactory will start returning security 74 // GetCopyOrMoveFileValidatorFactory will start returning security
76 // error if validator is not initialized. 75 // error if validator is not initialized.
77 void set_require_copy_or_move_validator(bool flag) { 76 void set_require_copy_or_move_validator(bool flag) {
78 require_copy_or_move_validator_ = flag; 77 require_copy_or_move_validator_ = flag;
79 } 78 }
80 79
81 private: 80 private:
82 class QuotaUtil; 81 class QuotaUtil;
83 82
84 base::FilePath base_path_; 83 base::FilePath base_path_;
85 scoped_refptr<base::SequencedTaskRunner> task_runner_; 84 scoped_refptr<base::SequencedTaskRunner> task_runner_;
86 scoped_ptr<fileapi::AsyncFileUtilAdapter> file_util_; 85 scoped_ptr<storage::AsyncFileUtilAdapter> file_util_;
87 scoped_ptr<QuotaUtil> quota_util_; 86 scoped_ptr<QuotaUtil> quota_util_;
88 87
89 bool require_copy_or_move_validator_; 88 bool require_copy_or_move_validator_;
90 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> 89 scoped_ptr<storage::CopyOrMoveFileValidatorFactory>
91 copy_or_move_file_validator_factory_; 90 copy_or_move_file_validator_factory_;
92 91
93 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend); 92 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend);
94 }; 93 };
95 94
96 } // namespace content 95 } // namespace content
97 96
98 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ 97 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_
OLDNEW
« no previous file with comments | « content/public/test/test_browser_context.cc ('k') | content/public/test/test_file_system_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698