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_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ | 6 #define WEBKIT_BROWSER_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" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SandboxFileSystemTestHelper 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(); |
54 base::FilePath GetLocalPath(const base::FilePath& path); | 54 base::FilePath GetLocalPath(const base::FilePath& path); |
55 base::FilePath GetLocalPathFromASCII(const std::string& path); | 55 base::FilePath GetLocalPathFromASCII(const std::string& path); |
56 | 56 |
57 // Returns empty path if filesystem type is neither temporary nor persistent. | 57 // Returns empty path if filesystem type is neither temporary nor persistent. |
58 base::FilePath GetUsageCachePath() const; | 58 base::FilePath GetUsageCachePath() const; |
59 | 59 |
60 FileSystemURL CreateURL(const base::FilePath& path) const; | 60 FileSystemURL CreateURL(const base::FilePath& path) const; |
61 FileSystemURL CreateURLFromUTF8(const std::string& utf8) const { | 61 FileSystemURL CreateURLFromUTF8(const std::string& utf8) const { |
62 return CreateURL(base::FilePath::FromUTF8Unsafe(utf8)); | 62 return CreateURL(base::FilePath::FromUTF8Unsafe(utf8)); |
63 } | 63 } |
64 | 64 |
65 // This returns cached usage size returned by QuotaUtil. | 65 // This returns cached usage size returned by QuotaUtil. |
66 int64 GetCachedOriginUsage() const; | 66 int64 GetCachedOriginUsage() const; |
67 | 67 |
68 // This doesn't work with OFSFU. | 68 // This doesn't work with OFSFU. |
69 int64 ComputeCurrentOriginUsage(); | 69 int64 ComputeCurrentOriginUsage(); |
70 | 70 |
71 int64 ComputeCurrentDirectoryDatabaseUsage() const; | 71 int64 ComputeCurrentDirectoryDatabaseUsage(); |
72 | 72 |
73 LocalFileSystemOperation* NewOperation(); | 73 LocalFileSystemOperation* NewOperation(); |
74 FileSystemOperationContext* NewOperationContext(); | 74 FileSystemOperationContext* NewOperationContext(); |
75 | 75 |
76 FileSystemContext* file_system_context() const { | 76 FileSystemContext* file_system_context() const { |
77 return file_system_context_.get(); | 77 return file_system_context_.get(); |
78 } | 78 } |
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 SetUpFileSystem(); | 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_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ | 100 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_TEST_HELPER_H_ |
OLD | NEW |