1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
6 #define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
8 #include "base/files/file_path.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "webkit/fileapi/async_file_util_adapter.h"
12 #include "webkit/fileapi/file_system_mount_point_provider.h"
13 #include "webkit/fileapi/task_runner_bound_observer_list.h"
14 #include "webkit/storage/webkit_storage_export.h"
17 class SequencedTaskRunner
;
22 class AsyncFileUtilAdapter
;
23 class FileSystemQuotaUtil
;
25 // This should be only used for testing.
26 // This mount point provider uses LocalFileUtil and stores data file
27 // under the given directory.
28 class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider
29 : public FileSystemMountPointProvider
{
31 TestMountPointProvider(
32 base::SequencedTaskRunner
* task_runner
,
33 const base::FilePath
& base_path
);
34 virtual ~TestMountPointProvider();
36 // FileSystemMountPointProvider implementation.
37 virtual void ValidateFileSystemRoot(
38 const GURL
& origin_url
,
41 const ValidateFileSystemCallback
& callback
) OVERRIDE
;
42 virtual base::FilePath
GetFileSystemRootPathOnFileThread(
43 const FileSystemURL
& url
,
44 bool create
) OVERRIDE
;
45 virtual FileSystemFileUtil
* GetFileUtil(FileSystemType type
) OVERRIDE
;
46 virtual AsyncFileUtil
* GetAsyncFileUtil(FileSystemType type
) OVERRIDE
;
47 virtual CopyOrMoveFileValidatorFactory
* GetCopyOrMoveFileValidatorFactory(
49 base::PlatformFileError
* error_code
) OVERRIDE
;
50 virtual void InitializeCopyOrMoveFileValidatorFactory(
52 scoped_ptr
<CopyOrMoveFileValidatorFactory
> factory
) OVERRIDE
;
53 virtual FilePermissionPolicy
GetPermissionPolicy(
54 const FileSystemURL
& url
,
55 int permissions
) const OVERRIDE
;
56 virtual FileSystemOperation
* CreateFileSystemOperation(
57 const FileSystemURL
& url
,
58 FileSystemContext
* context
,
59 base::PlatformFileError
* error_code
) const OVERRIDE
;
60 virtual scoped_ptr
<webkit_blob::FileStreamReader
> CreateFileStreamReader(
61 const FileSystemURL
& url
,
63 const base::Time
& expected_modification_time
,
64 FileSystemContext
* context
) const OVERRIDE
;
65 virtual scoped_ptr
<FileStreamWriter
> CreateFileStreamWriter(
66 const FileSystemURL
& url
,
68 FileSystemContext
* context
) const OVERRIDE
;
69 virtual FileSystemQuotaUtil
* GetQuotaUtil() OVERRIDE
;
70 virtual void DeleteFileSystem(
71 const GURL
& origin_url
,
73 FileSystemContext
* context
,
74 const DeleteFileSystemCallback
& callback
) OVERRIDE
;
76 const UpdateObserverList
* GetUpdateObservers(FileSystemType type
) const;
81 base::FilePath base_path_
;
82 scoped_refptr
<base::SequencedTaskRunner
> task_runner_
;
83 scoped_ptr
<AsyncFileUtilAdapter
> local_file_util_
;
84 scoped_ptr
<QuotaUtil
> quota_util_
;
85 UpdateObserverList observers_
;
88 } // namespace fileapi
90 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_