blob: d61c1e92a23a90761129630e8fed6e38e340e346 [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"
11#include "webkit/fileapi/file_system_mount_point_provider.h"
[email protected]caf66702012-09-07 07:02:2012#include "webkit/fileapi/task_runner_bound_observer_list.h"
[email protected]bcded8d2012-10-18 09:09:0413#include "webkit/storage/webkit_storage_export.h"
[email protected]6faad822012-05-11 12:58:2914
15namespace base {
16class SequencedTaskRunner;
17}
18
19namespace fileapi {
20
[email protected]7ee2e882012-06-04 08:54:1021class LocalFileUtil;
[email protected]6faad822012-05-11 12:58:2922class FileSystemQuotaUtil;
23
24// This should be only used for testing.
25// This mount point provider uses LocalFileUtil and stores data file
26// under the given directory.
[email protected]bcded8d2012-10-18 09:09:0427class WEBKIT_STORAGE_EXPORT_PRIVATE TestMountPointProvider
[email protected]0b38b4e52012-05-30 08:14:2728 : public FileSystemMountPointProvider {
[email protected]6faad822012-05-11 12:58:2929 public:
[email protected]6faad822012-05-11 12:58:2930 TestMountPointProvider(
31 base::SequencedTaskRunner* task_runner,
32 const FilePath& base_path);
33 virtual ~TestMountPointProvider();
34
35 // FileSystemMountPointProvider implementation.
36 virtual void ValidateFileSystemRoot(
37 const GURL& origin_url,
38 FileSystemType type,
39 bool create,
40 const ValidateFileSystemCallback& callback) OVERRIDE;
41 virtual FilePath GetFileSystemRootPathOnFileThread(
[email protected]199263e2012-12-14 07:14:2042 const FileSystemURL& url,
[email protected]6faad822012-05-11 12:58:2943 bool create) OVERRIDE;
[email protected]5aeeb7c62012-08-27 11:34:1344 virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2945 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
[email protected]d6afd112012-07-25 22:55:0446 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
[email protected]b40ffe72013-01-10 04:05:3147 virtual FilePermissionPolicy GetPermissionPolicy(
48 const FileSystemURL& url,
49 int permissions) const OVERRIDE;
[email protected]8e3bc3e2012-08-24 13:12:5350 virtual FileSystemOperation* CreateFileSystemOperation(
[email protected]949f25a2012-06-27 01:53:0951 const FileSystemURL& url,
[email protected]d23a00cc2012-09-11 17:38:1352 FileSystemContext* context,
53 base::PlatformFileError* error_code) const OVERRIDE;
[email protected]c4ca3b452012-05-31 03:15:4654 virtual webkit_blob::FileStreamReader* CreateFileStreamReader(
[email protected]d5e08552012-08-02 21:43:4055 const FileSystemURL& url,
56 int64 offset,
[email protected]a1057832012-10-15 13:28:0657 const base::Time& expected_modification_time,
[email protected]d5e08552012-08-02 21:43:4058 FileSystemContext* context) const OVERRIDE;
[email protected]7e836a3d2012-05-31 05:14:5959 virtual FileStreamWriter* CreateFileStreamWriter(
[email protected]d5e08552012-08-02 21:43:4060 const FileSystemURL& url,
61 int64 offset,
62 FileSystemContext* context) const OVERRIDE;
[email protected]6faad822012-05-11 12:58:2963 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
[email protected]d5e08552012-08-02 21:43:4064 virtual void DeleteFileSystem(
65 const GURL& origin_url,
66 FileSystemType type,
67 FileSystemContext* context,
68 const DeleteFileSystemCallback& callback) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2969
[email protected]caf66702012-09-07 07:02:2070 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
71
[email protected]6faad822012-05-11 12:58:2972 private:
[email protected]caf66702012-09-07 07:02:2073 class QuotaUtil;
74
[email protected]6faad822012-05-11 12:58:2975 FilePath base_path_;
[email protected]caf66702012-09-07 07:02:2076 scoped_refptr<base::SequencedTaskRunner> task_runner_;
[email protected]7ee2e882012-06-04 08:54:1077 scoped_ptr<LocalFileUtil> local_file_util_;
[email protected]caf66702012-09-07 07:02:2078 scoped_ptr<QuotaUtil> quota_util_;
79 UpdateObserverList observers_;
[email protected]6faad822012-05-11 12:58:2980};
81
82} // namespace fileapi
83
84#endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_