Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: webkit/fileapi/test_mount_point_provider.h

Issue 10386069: Add RegisterMountPointProvider and TestMountPointProvider for testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef WEBKIT_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ 5 #ifndef WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
6 #define WEBKIT_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ 6 #define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
7 #pragma once
7 8
8 #include <vector> 9 #include "base/file_path.h"
9 10 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "webkit/fileapi/file_system_mount_point_provider.h" 12 #include "webkit/fileapi/file_system_mount_point_provider.h"
12 13
14 namespace base {
15 class SequencedTaskRunner;
16 }
17
13 namespace fileapi { 18 namespace fileapi {
14 19
15 class IsolatedContext; 20 class FileSystemQuotaUtil;
16 21
17 class IsolatedMountPointProvider : public FileSystemMountPointProvider { 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 {
18 public: 26 public:
19 typedef FileSystemMountPointProvider::ValidateFileSystemCallback 27 typedef FileSystemMountPointProvider::ValidateFileSystemCallback
20 ValidateFileSystemCallback; 28 ValidateFileSystemCallback;
21 29
22 IsolatedMountPointProvider(); 30 TestMountPointProvider(
23 virtual ~IsolatedMountPointProvider(); 31 base::SequencedTaskRunner* task_runner,
32 const FilePath& base_path);
33 virtual ~TestMountPointProvider();
24 34
25 // FileSystemMountPointProvider implementation. 35 // FileSystemMountPointProvider implementation.
26 virtual void ValidateFileSystemRoot( 36 virtual void ValidateFileSystemRoot(
27 const GURL& origin_url, 37 const GURL& origin_url,
28 FileSystemType type, 38 FileSystemType type,
29 bool create, 39 bool create,
30 const ValidateFileSystemCallback& callback) OVERRIDE; 40 const ValidateFileSystemCallback& callback) OVERRIDE;
31 virtual FilePath GetFileSystemRootPathOnFileThread( 41 virtual FilePath GetFileSystemRootPathOnFileThread(
32 const GURL& origin_url, 42 const GURL& origin_url,
33 FileSystemType type, 43 FileSystemType type,
34 const FilePath& virtual_path, 44 const FilePath& virtual_path,
35 bool create) OVERRIDE; 45 bool create) OVERRIDE;
36 virtual bool IsAccessAllowed(const GURL& origin_url, 46 virtual bool IsAccessAllowed(const GURL& origin_url,
37 FileSystemType type, 47 FileSystemType type,
38 const FilePath& virtual_path) OVERRIDE; 48 const FilePath& virtual_path) OVERRIDE;
39 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE; 49 virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
40 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE; 50 virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE;
41 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE; 51 virtual FileSystemFileUtil* GetFileUtil() OVERRIDE;
42 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path) 52 virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
43 const OVERRIDE; 53 const OVERRIDE;
44 virtual FileSystemOperationInterface* CreateFileSystemOperation( 54 virtual FileSystemOperationInterface* CreateFileSystemOperation(
45 const GURL& origin_url, 55 const GURL& origin_url,
46 FileSystemType file_system_type, 56 FileSystemType file_system_type,
47 const FilePath& virtual_path, 57 const FilePath& virtual_path,
48 FileSystemContext* context) const OVERRIDE; 58 FileSystemContext* context) const OVERRIDE;
49 virtual webkit_blob::FileReader* CreateFileReader( 59 virtual webkit_blob::FileReader* CreateFileReader(
50 const GURL& url, 60 const GURL& url,
51 int64 offset, 61 int64 offset,
52 FileSystemContext* context) const OVERRIDE; 62 FileSystemContext* context) const OVERRIDE;
63 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
53 64
54 private: 65 private:
55 IsolatedContext* isolated_context() const; 66 FilePath base_path_;
56 67 scoped_ptr<FileSystemFileUtil> local_file_util_;
57 scoped_ptr<FileSystemFileUtil> isolated_file_util_; 68 scoped_ptr<FileSystemQuotaUtil> quota_util_;
58 }; 69 };
59 70
60 } // namespace fileapi 71 } // namespace fileapi
61 72
62 #endif // WEBKIT_FILEAPI_ISOLATED_MOUNT_POINT_PROVIDER_H_ 73 #endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/sandbox_mount_point_provider.cc ('k') | webkit/fileapi/test_mount_point_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698