OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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_ASYNC_FILE_TEST_HELPER_H_ | |
6 #define WEBKIT_FILEAPI_ASYNC_FILE_TEST_HELPER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "webkit/fileapi/file_system_operation.h" | |
10 #include "webkit/fileapi/file_system_types.h" | |
11 #include "webkit/quota/quota_status_code.h" | |
12 | |
13 namespace quota { | |
14 class QuotaManager; | |
15 } | |
16 | |
17 namespace fileapi { | |
18 | |
19 class FileSystemContext; | |
20 class FileSystemURL; | |
21 | |
22 // A helper class to perform async file operations in a synchronous way. | |
23 class AsyncFileTestHelper { | |
24 public: | |
25 typedef FileSystemOperation::FileEntryList FileEntryList; | |
26 | |
27 static const int64 kDontCheckSize; | |
28 | |
29 // Performs Copy from |src| and |dest| and returns the status code. | |
nhiroki
2013/02/05 15:12:02
nit: "... from |src| to |dest| and ..." ?
kinuko
2013/02/06 11:39:59
Done.
| |
30 static base::PlatformFileError Copy(FileSystemContext* context, | |
31 const FileSystemURL& src, | |
32 const FileSystemURL& dest); | |
33 | |
34 // Performs Move from |src| and |dest| and returns the status code. | |
nhiroki
2013/02/05 15:12:02
ditto.
kinuko
2013/02/06 11:39:59
Done.
| |
35 static base::PlatformFileError Move(FileSystemContext* context, | |
36 const FileSystemURL& src, | |
37 const FileSystemURL& dest); | |
38 | |
39 // Removes the given |url|. | |
40 static base::PlatformFileError Remove(FileSystemContext* context, | |
41 const FileSystemURL& url, | |
42 bool recursive); | |
43 | |
44 // Performs ReadDirectory on |url|. | |
45 static base::PlatformFileError ReadDirectory(FileSystemContext* context, | |
46 const FileSystemURL& url, | |
47 FileEntryList* entries); | |
48 | |
49 // Creates a directory at |url|. | |
50 static base::PlatformFileError CreateDirectory(FileSystemContext* context, | |
51 const FileSystemURL& url); | |
52 | |
53 // Creates a file at |url|. | |
54 static base::PlatformFileError CreateFile(FileSystemContext* context, | |
55 const FileSystemURL& url); | |
56 | |
57 // Truncates the file |url| to |size|. | |
58 static base::PlatformFileError TruncateFile(FileSystemContext* context, | |
59 const FileSystemURL& url, | |
60 size_t size); | |
61 | |
62 // Retrieves PlatformFileInfo for |url| and populates |file_info|. | |
63 static base::PlatformFileError GetMetadata(FileSystemContext* context, | |
64 const FileSystemURL& url, | |
65 base::PlatformFileInfo* file_info); | |
66 | |
67 // Returns true if a file exists at |url| with size |size|. If |size| is | |
nhiroki
2013/02/05 15:12:02
nit: "with size |size|" -> "with |size|"
kinuko
2013/02/06 11:39:59
Done.
| |
68 // kDontCheckSize it doesn't check the file size (but just check its | |
69 // existenc). | |
nhiroki
2013/02/05 15:12:02
nit: s/existenc/existence/
kinuko
2013/02/06 11:39:59
Done.
| |
70 static bool FileExists(FileSystemContext* context, | |
71 const FileSystemURL& url, | |
72 int64 size); | |
73 | |
74 // Returns true if a directory exists at |url|. | |
75 static bool DirectoryExists(FileSystemContext* context, | |
76 const FileSystemURL& url); | |
77 | |
78 // Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|. | |
79 static quota::QuotaStatusCode GetUsageAndQuota( | |
80 quota::QuotaManager* quota_manager, | |
81 const GURL& origin, | |
82 FileSystemType type, | |
83 int64* usage, | |
84 int64* quota); | |
85 }; | |
86 | |
87 } // namespace fileapi | |
88 | |
89 #endif // WEBKIT_FILEAPI_ASYNC_FILE_TEST_HELPER_H_ | |
OLD | NEW |