blob: 8a6d76d1c6a3b1db43c913f80819dd9b8c20aa16 [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_
7#pragma once
8
9#include "base/file_path.h"
10#include "base/memory/ref_counted.h"
11#include "base/memory/scoped_ptr.h"
[email protected]0b38b4e52012-05-30 08:14:2712#include "webkit/fileapi/fileapi_export.h"
[email protected]6faad822012-05-11 12:58:2913#include "webkit/fileapi/file_system_mount_point_provider.h"
14
15namespace base {
16class SequencedTaskRunner;
17}
18
19namespace fileapi {
20
21class FileSystemQuotaUtil;
22
23// This should be only used for testing.
24// This mount point provider uses LocalFileUtil and stores data file
25// under the given directory.
[email protected]0b38b4e52012-05-30 08:14:2726class FILEAPI_EXPORT_PRIVATE TestMountPointProvider
27 : public FileSystemMountPointProvider {
[email protected]6faad822012-05-11 12:58:2928 public:
29 typedef FileSystemMountPointProvider::ValidateFileSystemCallback
30 ValidateFileSystemCallback;
31
32 TestMountPointProvider(
33 base::SequencedTaskRunner* task_runner,
34 const FilePath& base_path);
35 virtual ~TestMountPointProvider();
36
37 // FileSystemMountPointProvider implementation.
38 virtual void ValidateFileSystemRoot(
39 const GURL& origin_url,
40 FileSystemType type,
41 bool create,
42 const ValidateFileSystemCallback& callback) OVERRIDE;
43 virtual FilePath GetFileSystemRootPathOnFileThread(
44 const GURL& origin_url,
45 FileSystemType type,
46 const FilePath& virtual_path,
47 bool create) OVERRIDE;
48 virtual bool IsAccessAllowed(const GURL& origin_url,
49 FileSystemType type,
50 const FilePath& virtual_path) OVERRIDE;
51 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
52 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE;
53 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE;
54 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
55 const OVERRIDE;
56 virtual FileSystemOperationInterface* CreateFileSystemOperation(
57 const GURL& origin_url,
58 FileSystemType file_system_type,
59 const FilePath& virtual_path,
60 FileSystemContext* context) const OVERRIDE;
[email protected]c4ca3b452012-05-31 03:15:4661 virtual webkit_blob::FileStreamReader* CreateFileStreamReader(
[email protected]6faad822012-05-11 12:58:2962 const GURL& url,
63 int64 offset,
64 FileSystemContext* context) const OVERRIDE;
[email protected]7e836a3d2012-05-31 05:14:5965 virtual FileStreamWriter* CreateFileStreamWriter(
[email protected]7e84b912012-05-16 04:42:0166 const GURL& url,
67 int64 offset,
68 FileSystemContext* context) const OVERRIDE;
[email protected]6faad822012-05-11 12:58:2969 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
70
71 private:
72 FilePath base_path_;
73 scoped_ptr<FileSystemFileUtil> local_file_util_;
74 scoped_ptr<FileSystemQuotaUtil> quota_util_;
75};
76
77} // namespace fileapi
78
79#endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_