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

Unified Diff: webkit/fileapi/async_file_test_helper.h

Issue 12223006: Cleanup: Introduce AsyncFileTestHelper for testing with async file/quota operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/fileapi/async_file_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/async_file_test_helper.h
diff --git a/webkit/fileapi/async_file_test_helper.h b/webkit/fileapi/async_file_test_helper.h
new file mode 100644
index 0000000000000000000000000000000000000000..c6a70d7275a560fc9e7eca1b16aabc8caa0b6bd2
--- /dev/null
+++ b/webkit/fileapi/async_file_test_helper.h
@@ -0,0 +1,89 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_FILEAPI_ASYNC_FILE_TEST_HELPER_H_
+#define WEBKIT_FILEAPI_ASYNC_FILE_TEST_HELPER_H_
+
+#include "base/basictypes.h"
+#include "webkit/fileapi/file_system_operation.h"
+#include "webkit/fileapi/file_system_types.h"
+#include "webkit/quota/quota_status_code.h"
+
+namespace quota {
+class QuotaManager;
+}
+
+namespace fileapi {
+
+class FileSystemContext;
+class FileSystemURL;
+
+// A helper class to perform async file operations in a synchronous way.
+class AsyncFileTestHelper {
+ public:
+ typedef FileSystemOperation::FileEntryList FileEntryList;
+
+ static const int64 kDontCheckSize;
+
+ // 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.
+ static base::PlatformFileError Copy(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
+
+ // 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.
+ static base::PlatformFileError Move(FileSystemContext* context,
+ const FileSystemURL& src,
+ const FileSystemURL& dest);
+
+ // Removes the given |url|.
+ static base::PlatformFileError Remove(FileSystemContext* context,
+ const FileSystemURL& url,
+ bool recursive);
+
+ // Performs ReadDirectory on |url|.
+ static base::PlatformFileError ReadDirectory(FileSystemContext* context,
+ const FileSystemURL& url,
+ FileEntryList* entries);
+
+ // Creates a directory at |url|.
+ static base::PlatformFileError CreateDirectory(FileSystemContext* context,
+ const FileSystemURL& url);
+
+ // Creates a file at |url|.
+ static base::PlatformFileError CreateFile(FileSystemContext* context,
+ const FileSystemURL& url);
+
+ // Truncates the file |url| to |size|.
+ static base::PlatformFileError TruncateFile(FileSystemContext* context,
+ const FileSystemURL& url,
+ size_t size);
+
+ // Retrieves PlatformFileInfo for |url| and populates |file_info|.
+ static base::PlatformFileError GetMetadata(FileSystemContext* context,
+ const FileSystemURL& url,
+ base::PlatformFileInfo* file_info);
+
+ // 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.
+ // kDontCheckSize it doesn't check the file size (but just check its
+ // existenc).
nhiroki 2013/02/05 15:12:02 nit: s/existenc/existence/
kinuko 2013/02/06 11:39:59 Done.
+ static bool FileExists(FileSystemContext* context,
+ const FileSystemURL& url,
+ int64 size);
+
+ // Returns true if a directory exists at |url|.
+ static bool DirectoryExists(FileSystemContext* context,
+ const FileSystemURL& url);
+
+ // Returns usage and quota. It's valid to pass NULL to |usage| and/or |quota|.
+ static quota::QuotaStatusCode GetUsageAndQuota(
+ quota::QuotaManager* quota_manager,
+ const GURL& origin,
+ FileSystemType type,
+ int64* usage,
+ int64* quota);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_ASYNC_FILE_TEST_HELPER_H_
« no previous file with comments | « content/content_tests.gypi ('k') | webkit/fileapi/async_file_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698