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

Side by Side Diff: content/public/test/async_file_test_helper.h

Issue 157053010: Move async_file_test_helper.* to content/public/test/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: re-up with similarity=25 Created 6 years, 10 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
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/test/async_file_test_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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_ASYNC_FILE_TEST_HELPER_H_ 5 #ifndef CONTENT_PUBLIC_TEST_ASYNC_FILE_TEST_HELPER_H_
6 #define WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_TEST_HELPER_H_ 6 #define CONTENT_PUBLIC_TEST_ASYNC_FILE_TEST_HELPER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "webkit/browser/fileapi/file_system_operation.h" 9 #include "webkit/browser/fileapi/file_system_operation.h"
10 #include "webkit/common/fileapi/file_system_types.h" 10 #include "webkit/common/fileapi/file_system_types.h"
11 #include "webkit/common/quota/quota_status_code.h" 11 #include "webkit/common/quota/quota_status_code.h"
12 12
13 namespace quota { 13 namespace quota {
14 class QuotaManager; 14 class QuotaManager;
15 } 15 }
16 16
17 namespace fileapi { 17 namespace fileapi {
18
19 class FileSystemContext; 18 class FileSystemContext;
20 class FileSystemURL; 19 class FileSystemURL;
20 }
21
22 namespace content {
21 23
22 // A helper class to perform async file operations in a synchronous way. 24 // A helper class to perform async file operations in a synchronous way.
23 class AsyncFileTestHelper { 25 class AsyncFileTestHelper {
24 public: 26 public:
25 typedef FileSystemOperation::FileEntryList FileEntryList; 27 typedef fileapi::FileSystemOperation::FileEntryList FileEntryList;
26 typedef FileSystemOperation::CopyProgressCallback CopyProgressCallback; 28 typedef fileapi::FileSystemOperation::CopyProgressCallback
29 CopyProgressCallback;
27 30
28 static const int64 kDontCheckSize; 31 static const int64 kDontCheckSize;
29 32
30 // Performs Copy from |src| to |dest| and returns the status code. 33 // Performs Copy from |src| to |dest| and returns the status code.
31 static base::File::Error Copy(FileSystemContext* context, 34 static base::File::Error Copy(fileapi::FileSystemContext* context,
32 const FileSystemURL& src, 35 const fileapi::FileSystemURL& src,
33 const FileSystemURL& dest); 36 const fileapi::FileSystemURL& dest);
34 37
35 // Same as Copy, but this supports |progress_callback|. 38 // Same as Copy, but this supports |progress_callback|.
36 static base::File::Error CopyWithProgress( 39 static base::File::Error CopyWithProgress(
37 FileSystemContext* context, 40 fileapi::FileSystemContext* context,
38 const FileSystemURL& src, 41 const fileapi::FileSystemURL& src,
39 const FileSystemURL& dest, 42 const fileapi::FileSystemURL& dest,
40 const CopyProgressCallback& progress_callback); 43 const CopyProgressCallback& progress_callback);
41 44
42 // Performs Move from |src| to |dest| and returns the status code. 45 // Performs Move from |src| to |dest| and returns the status code.
43 static base::File::Error Move(FileSystemContext* context, 46 static base::File::Error Move(fileapi::FileSystemContext* context,
44 const FileSystemURL& src, 47 const fileapi::FileSystemURL& src,
45 const FileSystemURL& dest); 48 const fileapi::FileSystemURL& dest);
46 49
47 // Removes the given |url|. 50 // Removes the given |url|.
48 static base::File::Error Remove(FileSystemContext* context, 51 static base::File::Error Remove(fileapi::FileSystemContext* context,
49 const FileSystemURL& url, 52 const fileapi::FileSystemURL& url,
50 bool recursive); 53 bool recursive);
51 54
52 // Performs ReadDirectory on |url|. 55 // Performs ReadDirectory on |url|.
53 static base::File::Error ReadDirectory(FileSystemContext* context, 56 static base::File::Error ReadDirectory(fileapi::FileSystemContext* context,
54 const FileSystemURL& url, 57 const fileapi::FileSystemURL& url,
55 FileEntryList* entries); 58 FileEntryList* entries);
56 59
57 // Creates a directory at |url|. 60 // Creates a directory at |url|.
58 static base::File::Error CreateDirectory(FileSystemContext* context, 61 static base::File::Error CreateDirectory(fileapi::FileSystemContext* context,
59 const FileSystemURL& url); 62 const fileapi::FileSystemURL& url);
60 63
61 // Creates a file at |url|. 64 // Creates a file at |url|.
62 static base::File::Error CreateFile(FileSystemContext* context, 65 static base::File::Error CreateFile(fileapi::FileSystemContext* context,
63 const FileSystemURL& url); 66 const fileapi::FileSystemURL& url);
64 67
65 // Creates a file at |url| and fills with |buf|. 68 // Creates a file at |url| and fills with |buf|.
66 static base::File::Error CreateFileWithData( 69 static base::File::Error CreateFileWithData(
67 FileSystemContext* context, 70 fileapi::FileSystemContext* context,
68 const FileSystemURL& url, 71 const fileapi::FileSystemURL& url,
69 const char* buf, 72 const char* buf,
70 int buf_size); 73 int buf_size);
71 74
72 // Truncates the file |url| to |size|. 75 // Truncates the file |url| to |size|.
73 static base::File::Error TruncateFile(FileSystemContext* context, 76 static base::File::Error TruncateFile(fileapi::FileSystemContext* context,
74 const FileSystemURL& url, 77 const fileapi::FileSystemURL& url,
75 size_t size); 78 size_t size);
76 79
77 // Retrieves File::Info for |url| and populates |file_info|. 80 // Retrieves File::Info for |url| and populates |file_info|.
78 static base::File::Error GetMetadata(FileSystemContext* context, 81 static base::File::Error GetMetadata(fileapi::FileSystemContext* context,
79 const FileSystemURL& url, 82 const fileapi::FileSystemURL& url,
80 base::File::Info* file_info); 83 base::File::Info* file_info);
81 84
82 // Retrieves FilePath for |url| and populates |platform_path|. 85 // Retrieves FilePath for |url| and populates |platform_path|.
83 static base::File::Error GetPlatformPath(FileSystemContext* context, 86 static base::File::Error GetPlatformPath(fileapi::FileSystemContext* context,
84 const FileSystemURL& url, 87 const fileapi::FileSystemURL& url,
85 base::FilePath* platform_path); 88 base::FilePath* platform_path);
86 89
87 // Returns true if a file exists at |url| with |size|. If |size| is 90 // Returns true if a file exists at |url| with |size|. If |size| is
88 // kDontCheckSize it doesn't check the file size (but just check its 91 // kDontCheckSize it doesn't check the file size (but just check its
89 // existence). 92 // existence).
90 static bool FileExists(FileSystemContext* context, 93 static bool FileExists(fileapi::FileSystemContext* context,
91 const FileSystemURL& url, 94 const fileapi::FileSystemURL& url,
92 int64 size); 95 int64 size);
93 96
94 // Returns true if a directory exists at |url|. 97 // Returns true if a directory exists at |url|.
95 static bool DirectoryExists(FileSystemContext* context, 98 static bool DirectoryExists(fileapi::FileSystemContext* context,
96 const FileSystemURL& url); 99 const fileapi::FileSystemURL& url);
97 100
98 // Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|. 101 // Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|.
99 static quota::QuotaStatusCode GetUsageAndQuota( 102 static quota::QuotaStatusCode GetUsageAndQuota(
100 quota::QuotaManager* quota_manager, 103 quota::QuotaManager* quota_manager,
101 const GURL& origin, 104 const GURL& origin,
102 FileSystemType type, 105 fileapi::FileSystemType type,
103 int64* usage, 106 int64* usage,
104 int64* quota); 107 int64* quota);
105 }; 108 };
106 109
107 } // namespace fileapi 110 } // namespace content
108 111
109 #endif // WEBKIT_BROWSER_FILEAPI_ASYNC_FILE_TEST_HELPER_H_ 112 #endif // CONTENT_PUBLIC_TEST_ASYNC_FILE_TEST_HELPER_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | content/public/test/async_file_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698