blob: a883a999ae27160c034da9e9303e428a027b2485 [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]d5e08552012-08-02 21:43:4030 using FileSystemMountPointProvider::ValidateFileSystemCallback;
31 using FileSystemMountPointProvider::DeleteFileSystemCallback;
[email protected]6faad822012-05-11 12:58:2932
33 TestMountPointProvider(
34 base::SequencedTaskRunner* task_runner,
35 const FilePath& base_path);
36 virtual ~TestMountPointProvider();
37
38 // FileSystemMountPointProvider implementation.
39 virtual void ValidateFileSystemRoot(
40 const GURL& origin_url,
41 FileSystemType type,
42 bool create,
43 const ValidateFileSystemCallback& callback) OVERRIDE;
44 virtual FilePath GetFileSystemRootPathOnFileThread(
45 const GURL& origin_url,
46 FileSystemType type,
47 const FilePath& virtual_path,
48 bool create) OVERRIDE;
[email protected]5aeeb7c62012-08-27 11:34:1349 virtual bool IsAccessAllowed(const FileSystemURL& url) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2950 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
[email protected]d6afd112012-07-25 22:55:0451 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2952 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
53 const OVERRIDE;
[email protected]8e3bc3e2012-08-24 13:12:5354 virtual FileSystemOperation* CreateFileSystemOperation(
[email protected]949f25a2012-06-27 01:53:0955 const FileSystemURL& url,
[email protected]d23a00cc2012-09-11 17:38:1356 FileSystemContext* context,
57 base::PlatformFileError* error_code) const OVERRIDE;
[email protected]c4ca3b452012-05-31 03:15:4658 virtual webkit_blob::FileStreamReader* CreateFileStreamReader(
[email protected]d5e08552012-08-02 21:43:4059 const FileSystemURL& url,
60 int64 offset,
[email protected]a1057832012-10-15 13:28:0661 const base::Time& expected_modification_time,
[email protected]d5e08552012-08-02 21:43:4062 FileSystemContext* context) const OVERRIDE;
[email protected]7e836a3d2012-05-31 05:14:5963 virtual FileStreamWriter* CreateFileStreamWriter(
[email protected]d5e08552012-08-02 21:43:4064 const FileSystemURL& url,
65 int64 offset,
66 FileSystemContext* context) const OVERRIDE;
[email protected]6faad822012-05-11 12:58:2967 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
[email protected]d5e08552012-08-02 21:43:4068 virtual void DeleteFileSystem(
69 const GURL& origin_url,
70 FileSystemType type,
71 FileSystemContext* context,
72 const DeleteFileSystemCallback& callback) OVERRIDE;
[email protected]6faad822012-05-11 12:58:2973
[email protected]caf66702012-09-07 07:02:2074 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
75
[email protected]6faad822012-05-11 12:58:2976 private:
[email protected]caf66702012-09-07 07:02:2077 class QuotaUtil;
78
[email protected]6faad822012-05-11 12:58:2979 FilePath base_path_;
[email protected]caf66702012-09-07 07:02:2080 scoped_refptr<base::SequencedTaskRunner> task_runner_;
[email protected]7ee2e882012-06-04 08:54:1081 scoped_ptr<LocalFileUtil> local_file_util_;
[email protected]caf66702012-09-07 07:02:2082 scoped_ptr<QuotaUtil> quota_util_;
83 UpdateObserverList observers_;
[email protected]6faad822012-05-11 12:58:2984};
85
86} // namespace fileapi
87
88#endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_