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

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

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build 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 "webkit/browser/fileapi/async_file_util_adapter.h"
12 #include "webkit/browser/fileapi/file_system_backend.h" 12 #include "webkit/browser/fileapi/file_system_backend.h"
13 #include "webkit/browser/fileapi/task_runner_bound_observer_list.h" 13 #include "webkit/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 bool HasInplaceCopyImplementation( 53 virtual bool HasInplaceCopyImplementation(
55 fileapi::FileSystemType type) const OVERRIDE; 54 storage::FileSystemType type) const OVERRIDE;
56 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( 55 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
57 const fileapi::FileSystemURL& url, 56 const storage::FileSystemURL& url,
58 int64 offset, 57 int64 offset,
59 const base::Time& expected_modification_time, 58 const base::Time& expected_modification_time,
60 fileapi::FileSystemContext* context) const OVERRIDE; 59 storage::FileSystemContext* context) const OVERRIDE;
61 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( 60 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
62 const fileapi::FileSystemURL& url, 61 const storage::FileSystemURL& url,
63 int64 offset, 62 int64 offset,
64 fileapi::FileSystemContext* context) const OVERRIDE; 63 storage::FileSystemContext* context) const OVERRIDE;
65 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; 64 virtual storage::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
66 65
67 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than 66 // Initialize the CopyOrMoveFileValidatorFactory. Invalid to call more than
68 // once. 67 // once.
69 void InitializeCopyOrMoveFileValidatorFactory( 68 void InitializeCopyOrMoveFileValidatorFactory(
70 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> factory); 69 scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory);
71 70
72 const fileapi::UpdateObserverList* 71 const storage::UpdateObserverList* GetUpdateObservers(
73 GetUpdateObservers(fileapi::FileSystemType type) const; 72 storage::FileSystemType type) const;
74 void AddFileChangeObserver(fileapi::FileChangeObserver* observer); 73 void AddFileChangeObserver(storage::FileChangeObserver* observer);
75 74
76 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true 75 // For CopyOrMoveFileValidatorFactory testing. Once it's set to true
77 // GetCopyOrMoveFileValidatorFactory will start returning security 76 // GetCopyOrMoveFileValidatorFactory will start returning security
78 // error if validator is not initialized. 77 // error if validator is not initialized.
79 void set_require_copy_or_move_validator(bool flag) { 78 void set_require_copy_or_move_validator(bool flag) {
80 require_copy_or_move_validator_ = flag; 79 require_copy_or_move_validator_ = flag;
81 } 80 }
82 81
83 private: 82 private:
84 class QuotaUtil; 83 class QuotaUtil;
85 84
86 base::FilePath base_path_; 85 base::FilePath base_path_;
87 scoped_refptr<base::SequencedTaskRunner> task_runner_; 86 scoped_refptr<base::SequencedTaskRunner> task_runner_;
88 scoped_ptr<fileapi::AsyncFileUtilAdapter> file_util_; 87 scoped_ptr<storage::AsyncFileUtilAdapter> file_util_;
89 scoped_ptr<QuotaUtil> quota_util_; 88 scoped_ptr<QuotaUtil> quota_util_;
90 89
91 bool require_copy_or_move_validator_; 90 bool require_copy_or_move_validator_;
92 scoped_ptr<fileapi::CopyOrMoveFileValidatorFactory> 91 scoped_ptr<storage::CopyOrMoveFileValidatorFactory>
93 copy_or_move_file_validator_factory_; 92 copy_or_move_file_validator_factory_;
94 93
95 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend); 94 DISALLOW_COPY_AND_ASSIGN(TestFileSystemBackend);
96 }; 95 };
97 96
98 } // namespace content 97 } // namespace content
99 98
100 #endif // CONTENT_PUBLIC_TEST_TEST_FILE_SYSTEM_BACKEND_H_ 99 #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