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

Unified Diff: webkit/fileapi/test_mount_point_provider.h

Issue 10386069: Add RegisterMountPointProvider and TestMountPointProvider for testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adding sandbox_mpp change Created 8 years, 7 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/test_mount_point_provider.h
diff --git a/webkit/fileapi/test_mount_point_provider.h b/webkit/fileapi/test_mount_point_provider.h
new file mode 100644
index 0000000000000000000000000000000000000000..b9ac9c3c4819adaa9b9c9b94327abb5c79ec2b3d
--- /dev/null
+++ b/webkit/fileapi/test_mount_point_provider.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2012 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_TEST_MOUNT_POINT_PROVIDER_H_
+#define WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_
+#pragma once
+
+#include "base/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/ref_counted.h"
+#include "webkit/fileapi/file_system_mount_point_provider.h"
+
+namespace base {
+class SequencedTaskRunner;
+}
+
+namespace fileapi {
+
+class FileSystemQuotaUtil;
+
+// This should be only used for testing.
+// This mount point provider uses LocalFileUtil and stores data file
+// under the given directory.
+class TestMountPointProvider : public FileSystemMountPointProvider {
+ public:
+ typedef FileSystemMountPointProvider::ValidateFileSystemCallback
+ ValidateFileSystemCallback;
+
+ TestMountPointProvider(
+ base::SequencedTaskRunner* task_runner,
+ const FilePath& base_path);
+ virtual ~TestMountPointProvider();
+
+ // FileSystemMountPointProvider implementation.
+ virtual void ValidateFileSystemRoot(
+ const GURL& origin_url,
+ FileSystemType type,
+ bool create,
+ const ValidateFileSystemCallback& callback) OVERRIDE;
+ virtual FilePath GetFileSystemRootPathOnFileThread(
+ const GURL& origin_url,
+ FileSystemType type,
+ const FilePath& virtual_path,
+ bool create) OVERRIDE;
+ virtual bool IsAccessAllowed(const GURL& origin_url,
+ FileSystemType type,
+ const FilePath& virtual_path) OVERRIDE;
+ virtual bool IsRestrictedFileName(const FilePath& filename) const OVERRIDE;
+ virtual std::vector<FilePath> GetRootDirectories() const OVERRIDE;
+ virtual FileSystemFileUtil* GetFileUtil() OVERRIDE;
+ virtual FilePath GetPathForPermissionsCheck(const FilePath& virtual_path)
+ const OVERRIDE;
+ virtual FileSystemOperationInterface* CreateFileSystemOperation(
+ const GURL& origin_url,
+ FileSystemType file_system_type,
+ const FilePath& virtual_path,
+ FileSystemContext* context) const OVERRIDE;
+ virtual webkit_blob::FileReader* CreateFileReader(
+ const GURL& url,
+ int64 offset,
+ FileSystemContext* context) const OVERRIDE;
+ virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE {
+ return quota_util_.get();
+ }
+
+ private:
+ FilePath base_path_;
+ scoped_ptr<FileSystemFileUtil> local_file_util_;
+ scoped_ptr<FileSystemQuotaUtil> quota_util_;
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_TEST_MOUNT_POINT_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698