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/file_path.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "webkit/fileapi/file_system_mount_point_provider.h"
12 #include "webkit/fileapi/fileapi_export.h"
13 #include "webkit/fileapi/task_runner_bound_observer_list.h"
16 class SequencedTaskRunner
;
22 class FileSystemQuotaUtil
;
24 // This should be only used for testing.
25 // This mount point provider uses LocalFileUtil and stores data file
26 // under the given directory.
27 class FILEAPI_EXPORT_PRIVATE TestMountPointProvider
28 : public FileSystemMountPointProvider
{
30 using FileSystemMountPointProvider::ValidateFileSystemCallback
;
31 using FileSystemMountPointProvider::DeleteFileSystemCallback
;
33 TestMountPointProvider(
34 base::SequencedTaskRunner
* task_runner
,
35 const FilePath
& base_path
);
36 virtual ~TestMountPointProvider();
38 // FileSystemMountPointProvider implementation.
39 virtual void ValidateFileSystemRoot(
40 const GURL
& origin_url
,
43 const ValidateFileSystemCallback
& callback
) OVERRIDE
;
44 virtual FilePath
GetFileSystemRootPathOnFileThread(
45 const GURL
& origin_url
,
47 const FilePath
& virtual_path
,
48 bool create
) OVERRIDE
;
49 virtual bool IsAccessAllowed(const FileSystemURL
& url
) OVERRIDE
;
50 virtual bool IsRestrictedFileName(const FilePath
& filename
) const OVERRIDE
;
51 virtual FileSystemFileUtil
* GetFileUtil(FileSystemType type
) OVERRIDE
;
52 virtual FilePath
GetPathForPermissionsCheck(const FilePath
& virtual_path
)
54 virtual FileSystemOperation
* CreateFileSystemOperation(
55 const FileSystemURL
& url
,
56 FileSystemContext
* context
,
57 base::PlatformFileError
* error_code
) const OVERRIDE
;
58 virtual webkit_blob::FileStreamReader
* CreateFileStreamReader(
59 const FileSystemURL
& url
,
61 FileSystemContext
* context
) const OVERRIDE
;
62 virtual FileStreamWriter
* CreateFileStreamWriter(
63 const FileSystemURL
& url
,
65 FileSystemContext
* context
) const OVERRIDE
;
66 virtual FileSystemQuotaUtil
* GetQuotaUtil() OVERRIDE
;
67 virtual void DeleteFileSystem(
68 const GURL
& origin_url
,
70 FileSystemContext
* context
,
71 const DeleteFileSystemCallback
& callback
) OVERRIDE
;
73 const UpdateObserverList
* GetUpdateObservers(FileSystemType type
) const;
79 scoped_refptr
<base::SequencedTaskRunner
> task_runner_
;
80 scoped_ptr
<LocalFileUtil
> local_file_util_
;
81 scoped_ptr
<QuotaUtil
> quota_util_
;
82 UpdateObserverList observers_
;
85 } // namespace fileapi
87 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_