OLD | NEW |
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_LOCAL_FILE_SYSTEM_TEST_HELPER_H_ | 5 #ifndef WEBKIT_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ |
6 #define WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_TEST_HELPER_H_ | 6 #define WEBKIT_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "webkit/browser/fileapi/file_system_usage_cache.h" | 13 #include "webkit/browser/fileapi/file_system_usage_cache.h" |
14 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
15 #include "webkit/fileapi/file_system_url.h" | 15 #include "webkit/fileapi/file_system_url.h" |
16 #include "webkit/fileapi/file_system_util.h" | 16 #include "webkit/fileapi/file_system_util.h" |
17 #include "webkit/quota/quota_types.h" | 17 #include "webkit/quota/quota_types.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class FilePath; | 20 class FilePath; |
21 } | 21 } |
22 | 22 |
23 namespace quota { | 23 namespace quota { |
24 class QuotaManagerProxy; | 24 class QuotaManagerProxy; |
25 } | 25 } |
26 | 26 |
27 namespace fileapi { | 27 namespace fileapi { |
28 | 28 |
29 class FileSystemContext; | 29 class FileSystemContext; |
30 class FileSystemFileUtil; | 30 class FileSystemFileUtil; |
31 class FileSystemOperationContext; | 31 class FileSystemOperationContext; |
32 class LocalFileSystemOperation; | 32 class LocalFileSystemOperation; |
33 | 33 |
34 // Filesystem test helper class that encapsulates test environment for | 34 // Filesystem test helper class that encapsulates test environment for |
35 // a given {origin, type} pair. This helper only works for sandboxed | 35 // a given {origin, type} pair. This helper only works for sandboxed |
36 // file systems (Temporary, Persistent or Test types). | 36 // file systems (Temporary or Persistent). |
37 class LocalFileSystemTestOriginHelper { | 37 class SandboxFileSystemTestHelper { |
38 public: | 38 public: |
39 LocalFileSystemTestOriginHelper(const GURL& origin, FileSystemType type); | 39 SandboxFileSystemTestHelper(const GURL& origin, FileSystemType type); |
40 LocalFileSystemTestOriginHelper(); | 40 SandboxFileSystemTestHelper(); |
41 ~LocalFileSystemTestOriginHelper(); | 41 ~SandboxFileSystemTestHelper(); |
42 | 42 |
43 void SetUp(const base::FilePath& base_dir); | 43 void SetUp(const base::FilePath& base_dir); |
44 // If you want to use more than one LocalFileSystemTestOriginHelper in | 44 // If you want to use more than one SandboxFileSystemTestHelper in |
45 // a single base directory, they have to share a context, so that they don't | 45 // a single base directory, they have to share a context, so that they don't |
46 // have multiple databases fighting over the lock to the origin directory | 46 // have multiple databases fighting over the lock to the origin directory |
47 // [deep down inside ObfuscatedFileUtil]. | 47 // [deep down inside ObfuscatedFileUtil]. |
48 void SetUp(FileSystemContext* file_system_context); | 48 void SetUp(FileSystemContext* file_system_context); |
49 void SetUp(const base::FilePath& base_dir, | 49 void SetUp(const base::FilePath& base_dir, |
50 quota::QuotaManagerProxy* quota_manager_proxy); | 50 quota::QuotaManagerProxy* quota_manager_proxy); |
51 void TearDown(); | 51 void TearDown(); |
52 | 52 |
53 base::FilePath GetOriginRootPath() const; | 53 base::FilePath GetOriginRootPath() const; |
54 base::FilePath GetLocalPath(const base::FilePath& path); | 54 base::FilePath GetLocalPath(const base::FilePath& path); |
(...skipping 24 matching lines...) Expand all Loading... |
79 | 79 |
80 const GURL& origin() const { return origin_; } | 80 const GURL& origin() const { return origin_; } |
81 FileSystemType type() const { return type_; } | 81 FileSystemType type() const { return type_; } |
82 quota::StorageType storage_type() const { | 82 quota::StorageType storage_type() const { |
83 return FileSystemTypeToQuotaStorageType(type_); | 83 return FileSystemTypeToQuotaStorageType(type_); |
84 } | 84 } |
85 FileSystemFileUtil* file_util() const { return file_util_; } | 85 FileSystemFileUtil* file_util() const { return file_util_; } |
86 FileSystemUsageCache* usage_cache(); | 86 FileSystemUsageCache* usage_cache(); |
87 | 87 |
88 private: | 88 private: |
89 void SetUpFileUtil(); | 89 void SetUpFileSystem(); |
90 | 90 |
91 scoped_refptr<FileSystemContext> file_system_context_; | 91 scoped_refptr<FileSystemContext> file_system_context_; |
92 | 92 |
93 const GURL origin_; | 93 const GURL origin_; |
94 const FileSystemType type_; | 94 const FileSystemType type_; |
95 FileSystemFileUtil* file_util_; | 95 FileSystemFileUtil* file_util_; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace fileapi | 98 } // namespace fileapi |
99 | 99 |
100 #endif // WEBKIT_FILEAPI_LOCAL_FILE_SYSTEM_TEST_HELPER_H_ | 100 #endif // WEBKIT_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ |
OLD | NEW |