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

Unified Diff: webkit/fileapi/file_system_test_helper.cc

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 years 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/file_system_test_helper.cc
diff --git a/webkit/fileapi/file_system_test_helper.cc b/webkit/fileapi/file_system_test_helper.cc
index 9f680435f5e9e7325715b864fbfc3a70815175b0..c58cd1737f7141ffc7cb9f2754bf7eeadfa95d88 100644
--- a/webkit/fileapi/file_system_test_helper.cc
+++ b/webkit/fileapi/file_system_test_helper.cc
@@ -11,6 +11,7 @@
#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_operation.h"
#include "webkit/fileapi/file_system_operation_context.h"
+#include "webkit/fileapi/file_system_options.h"
#include "webkit/fileapi/file_system_usage_cache.h"
#include "webkit/fileapi/file_system_util.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
@@ -18,6 +19,19 @@
namespace fileapi {
+namespace {
+
+class TestHelperOptions : public FileSystemOptions {
+ public:
+ explicit TestHelperOptions(bool is_incognito) : is_incognito_(is_incognito) {}
+ virtual bool is_incognito() const OVERRIDE { return is_incognito_; }
+ virtual bool allow_file_access_from_files() const OVERRIDE { return true; }
+ private:
+ bool is_incognito_;
+};
+
+} // namespace
+
FileSystemTestOriginHelper::FileSystemTestOriginHelper(
const GURL& origin, FileSystemType type)
: origin_(origin), type_(type), file_util_(NULL) {
@@ -39,24 +53,22 @@ void FileSystemTestOriginHelper::SetUp(
void FileSystemTestOriginHelper::SetUp(
FileSystemContext* file_system_context, FileSystemFileUtil* file_util) {
- DCHECK(file_system_context->path_manager());
- DCHECK(file_system_context->path_manager()->sandbox_provider());
+ DCHECK(file_system_context->sandbox_provider());
file_util_ = file_util;
file_system_context_ = file_system_context;
if (!file_util_)
- file_util_ = file_system_context->path_manager()->sandbox_provider()->
- GetFileUtil();
+ file_util_ = file_system_context->sandbox_provider()->GetFileUtil();
DCHECK(file_util_);
// Prepare the origin's root directory.
- file_system_context_->path_manager()->
+ file_system_context_->GetMountPointProvider(type_)->
ValidateFileSystemRootAndGetPathOnFileThread(
origin_, type_, FilePath(), true /* create */);
// Initialize the usage cache file.
- FilePath usage_cache_path = file_system_context_->path_manager()
- ->sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
+ FilePath usage_cache_path = file_system_context_->
+ sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
FileSystemUsageCache::UpdateUsage(usage_cache_path, 0);
}
@@ -77,22 +89,19 @@ void FileSystemTestOriginHelper::SetUp(
special_storage_policy,
quota_manager_proxy,
base_dir,
- incognito_mode,
- true /* allow_file_access_from_files */,
- NULL);
+ new TestHelperOptions(incognito_mode));
- DCHECK(file_system_context_->path_manager());
- DCHECK(file_system_context_->path_manager()->sandbox_provider());
+ DCHECK(file_system_context_->sandbox_provider());
// Prepare the origin's root directory.
- file_system_context_->path_manager()->
+ file_system_context_->GetMountPointProvider(type_)->
ValidateFileSystemRootAndGetPathOnFileThread(
origin_, type_, FilePath(), true /* create */);
// Initialize the usage cache file. This code assumes that we're either using
// OFSFU or we've mocked it out in the sandbox provider.
- FilePath usage_cache_path = file_system_context_->path_manager()
- ->sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
+ FilePath usage_cache_path = file_system_context_->
+ sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
FileSystemUsageCache::UpdateUsage(usage_cache_path, 0);
}
@@ -102,7 +111,7 @@ void FileSystemTestOriginHelper::TearDown() {
}
FilePath FileSystemTestOriginHelper::GetOriginRootPath() const {
- return file_system_context_->path_manager()->
+ return file_system_context_->GetMountPointProvider(type_)->
ValidateFileSystemRootAndGetPathOnFileThread(
origin_, type_, FilePath(), false);
}
@@ -126,8 +135,8 @@ GURL FileSystemTestOriginHelper::GetURLForPath(const FilePath& path) const {
}
FilePath FileSystemTestOriginHelper::GetUsageCachePath() const {
- return file_system_context_->path_manager()
- ->sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
+ return file_system_context_->
+ sandbox_provider()->GetUsageCachePathForOriginAndType(origin_, type_);
}
int64 FileSystemTestOriginHelper::GetCachedOriginUsage() const {

Powered by Google App Engine
This is Rietveld 408576698