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

Unified Diff: webkit/fileapi/local_file_system_operation_unittest.cc

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
Index: webkit/fileapi/local_file_system_operation_unittest.cc
diff --git a/webkit/fileapi/local_file_system_operation_unittest.cc b/webkit/fileapi/local_file_system_operation_unittest.cc
index 8bc9972d1832eff50c2a82ed362ab0bbb669ef70..f5d0e21f56ef1015a2a87c6273d905c65e26e61a 100644
--- a/webkit/fileapi/local_file_system_operation_unittest.cc
+++ b/webkit/fileapi/local_file_system_operation_unittest.cc
@@ -14,12 +14,12 @@
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/blob/shareable_file_reference.h"
+#include "webkit/fileapi/async_file_test_helper.h"
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
#include "webkit/fileapi/file_system_quota_util.h"
#include "webkit/fileapi/file_system_util.h"
-#include "webkit/fileapi/file_util_helper.h"
#include "webkit/fileapi/local_file_system_test_helper.h"
#include "webkit/fileapi/mock_file_change_observer.h"
#include "webkit/quota/mock_quota_manager.h"
@@ -111,18 +111,15 @@ class LocalFileSystemOperationTest
bool FileExists(const base::FilePath& virtual_path) {
FileSystemURL url = test_helper_.CreateURL(virtual_path);
- base::PlatformFileInfo file_info;
- base::FilePath platform_path;
- scoped_ptr<FileSystemOperationContext> context(NewContext());
- base::PlatformFileError error = file_util()->GetFileInfo(
- context.get(), url, &file_info, &platform_path);
- return error == base::PLATFORM_FILE_OK && !file_info.is_directory;
+ return AsyncFileTestHelper::FileExists(
+ test_helper_.file_system_context(), url,
+ AsyncFileTestHelper::kDontCheckSize);
}
bool DirectoryExists(const base::FilePath& virtual_path) {
FileSystemURL url = test_helper_.CreateURL(virtual_path);
- scoped_ptr<FileSystemOperationContext> context(NewContext());
- return FileUtilHelper::DirectoryExists(context.get(), file_util(), url);
+ return AsyncFileTestHelper::DirectoryExists(
+ test_helper_.file_system_context(), url);
}
base::FilePath CreateUniqueFileInDir(const base::FilePath& virtual_dir_path) {
@@ -209,29 +206,11 @@ class LocalFileSystemOperationTest
shareable_file_ref_ = shareable_file_ref;
}
- static void DidGetUsageAndQuota(quota::QuotaStatusCode* status_out,
- int64* usage_out,
- int64* quota_out,
- quota::QuotaStatusCode status,
- int64 usage,
- int64 quota) {
- if (status_out)
- *status_out = status;
-
- if (usage_out)
- *usage_out = usage;
-
- if (quota_out)
- *quota_out = quota;
- }
-
void GetUsageAndQuota(int64* usage, int64* quota) {
- quota::QuotaStatusCode status = quota::kQuotaStatusUnknown;
- quota_manager_->GetUsageAndQuota(
- test_helper_.origin(),
- test_helper_.storage_type(),
- base::Bind(&LocalFileSystemOperationTest::DidGetUsageAndQuota,
- &status, usage, quota));
+ quota::QuotaStatusCode status =
+ AsyncFileTestHelper::GetUsageAndQuota(
+ quota_manager_, test_helper_.origin(), test_helper_.type(),
+ usage, quota);
MessageLoop::current()->RunUntilIdle();
ASSERT_EQ(quota::kQuotaStatusOk, status);
}

Powered by Google App Engine
This is Rietveld 408576698