OLD | NEW |
(Empty) | |
| 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. |
| 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/scoped_ptr.h" |
| 11 #include "base/memory/ref_counted.h" |
| 12 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 13 |
| 14 namespace base { |
| 15 class SequencedTaskRunner; |
| 16 } |
| 17 |
| 18 namespace fileapi { |
| 19 |
| 20 class FileSystemQuotaUtil; |
| 21 |
| 22 // This should be only used for testing. |
| 23 // This mount point provider uses LocalFileUtil and stores data file |
| 24 // under the given directory. |
| 25 class TestMountPointProvider : public FileSystemMountPointProvider { |
| 26 public: |
| 27 typedef FileSystemMountPointProvider::ValidateFileSystemCallback |
| 28 ValidateFileSystemCallback; |
| 29 |
| 30 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( |
| 42 const GURL& origin_url, |
| 43 FileSystemType type, |
| 44 const FilePath& virtual_path, |
| 45 bool create) OVERRIDE; |
| 46 virtual bool IsAccessAllowed(const GURL& origin_url, |
| 47 FileSystemType type, |
| 48 const FilePath& virtual_path) OVERRIDE; |
| 49 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; |
| 50 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; |
| 51 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; |
| 52 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) |
| 53 const OVERRIDE; |
| 54 virtual FileSystemOperationInterface* CreateFileSystemOperation( |
| 55 const GURL& origin_url, |
| 56 FileSystemType file_system_type, |
| 57 const FilePath& virtual_path, |
| 58 FileSystemContext* context) const OVERRIDE; |
| 59 virtual webkit_blob::FileReader* CreateFileReader( |
| 60 const GURL& url, |
| 61 int64 offset, |
| 62 FileSystemContext* context) const OVERRIDE; |
| 63 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE { |
| 64 return quota_util_.get(); |
| 65 } |
| 66 |
| 67 private: |
| 68 FilePath base_path_; |
| 69 scoped_ptr<FileSystemFileUtil> local_file_util_; |
| 70 scoped_ptr<FileSystemQuotaUtil> quota_util_; |
| 71 }; |
| 72 |
| 73 } // namespace fileapi |
| 74 |
| 75 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_ |
OLD | NEW |