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

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

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

Powered by Google App Engine
This is Rietveld 408576698