blob: 4bee1025af8b98792e9a89dc6ce7da80c7be7246 [file] [log] [blame]
[email protected]6faad822012-05-11 12:58:291// 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.
4
5#ifndef WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
6#define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
[email protected]6faad822012-05-11 12:58:297
8#include "base/file_path.h"
9#include "base/memory/ref_counted.h"
10#include "base/memory/scoped_ptr.h"
[email protected]25b697992013-01-29 07:10:0511#include "webkit/fileapi/async_file_util_adapter.h"
[email protected]6faad822012-05-11 12:58:2912#include "webkit/fileapi/file_system_mount_point_provider.h"
[email protected]caf66702012-09-07 07:02:2013#include "webkit/fileapi/task_runner_bound_observer_list.h"
[email protected]bcded8d2012-10-18 09:09:0414#include "webkit/storage/webkit_storage_export.h"
[email protected]6faad822012-05-11 12:58:2915
16namespace base {
17class SequencedTaskRunner;
18}
19
20namespace fileapi {
21
[email protected]25b697992013-01-29 07:10:0522class AsyncFileUtilAdapter;
[email protected]6faad822012-05-11 12:58:2923class FileSystemQuotaUtil;
24
25// This should be only used for testing.
26// This mount point provider uses LocalFileUtil and stores data file
27// under the given directory.
[email protected]bcded8d2012-10-18 09:09:0428class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider
[email protected]0b38b4e52012-05-30 08:14:2729 : public FileSystemMountPointProvider {
[email protected]6faad822012-05-11 12:58:2930 public:
[email protected]6faad822012-05-11 12:58:2931 TestMountPointProvider(
32 base::SequencedTaskRunner* task_runner,
33 const FilePath& base_path);
34 virtual ~TestMountPointProvider();
35
36 // FileSystemMountPointProvider implementation.
37 virtual void ValidateFileSystemRoot(
38 const GURL& origin_url,
39 FileSystemType type,
40 bool create,
41 const ValidateFileSystemCallback& callback) OVERRIDE;
42 virtual FilePath GetFileSystemRootPathOnFileThread(
[email protected]199263e2012-12-14 07:14:2043 const FileSystemURL& url,
[email protected]6faad822012-05-11 12:58:2944 bool create) OVERRIDE;
[email protected]5aeeb7c62012-08-27 11:34:1345 virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2946 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
[email protected]d6afd112012-07-25 22:55:0447 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
[email protected]25b697992013-01-29 07:10:0548 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
[email protected]b40ffe72013-01-10 04:05:3149 virtual FilePermissionPolicy GetPermissionPolicy(
50 const FileSystemURL& url,
51 int permissions) const OVERRIDE;
[email protected]8e3bc3e2012-08-24 13:12:5352 virtual FileSystemOperation* CreateFileSystemOperation(
[email protected]949f25a2012-06-27 01:53:0953 const FileSystemURL& url,
[email protected]d23a00cc2012-09-11 17:38:1354 FileSystemContext* context,
55 base::PlatformFileError* error_code) const OVERRIDE;
[email protected]c4ca3b452012-05-31 03:15:4656 virtual webkit_blob::FileStreamReader* CreateFileStreamReader(
[email protected]d5e08552012-08-02 21:43:4057 const FileSystemURL& url,
58 int64 offset,
[email protected]a1057832012-10-15 13:28:0659 const base::Time& expected_modification_time,
[email protected]d5e08552012-08-02 21:43:4060 FileSystemContext* context) const OVERRIDE;
[email protected]7e836a3d2012-05-31 05:14:5961 virtual FileStreamWriter* CreateFileStreamWriter(
[email protected]d5e08552012-08-02 21:43:4062 const FileSystemURL& url,
63 int64 offset,
64 FileSystemContext* context) const OVERRIDE;
[email protected]6faad822012-05-11 12:58:2965 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
[email protected]d5e08552012-08-02 21:43:4066 virtual void DeleteFileSystem(
67 const GURL& origin_url,
68 FileSystemType type,
69 FileSystemContext* context,
70 const DeleteFileSystemCallback& callback) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2971
[email protected]caf66702012-09-07 07:02:2072 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
73
[email protected]6faad822012-05-11 12:58:2974 private:
[email protected]caf66702012-09-07 07:02:2075 class QuotaUtil;
76
[email protected]6faad822012-05-11 12:58:2977 FilePath base_path_;
[email protected]caf66702012-09-07 07:02:2078 scoped_refptr<base::SequencedTaskRunner> task_runner_;
[email protected]25b697992013-01-29 07:10:0579 scoped_ptr<AsyncFileUtilAdapter> local_file_util_;
[email protected]caf66702012-09-07 07:02:2080 scoped_ptr<QuotaUtil> quota_util_;
81 UpdateObserverList observers_;
[email protected]6faad822012-05-11 12:58:2982};
83
84} // namespace fileapi
85
86#endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_