Index: webkit/fileapi/quota_file_util_unittest.cc |
diff --git a/webkit/fileapi/quota_file_util_unittest.cc b/webkit/fileapi/quota_file_util_unittest.cc |
index bb76f65a4214a1b3252c9ca47a6470ec1384cb29..385266824f9bab784d64ab30179b8c5146ce6093 100644 |
--- a/webkit/fileapi/quota_file_util_unittest.cc |
+++ b/webkit/fileapi/quota_file_util_unittest.cc |
@@ -16,32 +16,10 @@ |
#include "webkit/fileapi/file_system_path_manager.h" |
#include "webkit/fileapi/file_system_types.h" |
#include "webkit/fileapi/file_system_usage_cache.h" |
+#include "webkit/fileapi/sandbox_mount_point_provider.h" |
using namespace fileapi; |
-namespace { |
- |
-class MockFileSystemPathManager : public FileSystemPathManager { |
- public: |
- MockFileSystemPathManager(const FilePath& filesystem_path) |
- : FileSystemPathManager(base::MessageLoopProxy::CreateForCurrentThread(), |
- filesystem_path, NULL, false, true), |
- test_filesystem_path_(filesystem_path) {} |
- |
- virtual FilePath ValidateFileSystemRootAndGetPathOnFileThread( |
- const GURL& origin_url, |
- fileapi::FileSystemType type, |
- const FilePath& virtual_path, |
- bool create) { |
- return test_filesystem_path_; |
- } |
- |
- private: |
- FilePath test_filesystem_path_; |
-}; |
- |
-} // namespace (anonymous) |
- |
class QuotaFileUtilTest : public testing::Test { |
public: |
QuotaFileUtilTest() |
@@ -53,19 +31,34 @@ class QuotaFileUtilTest : public testing::Test { |
filesystem_dir_ = data_dir_.path().AppendASCII("filesystem"); |
file_util::CreateDirectory(filesystem_dir_); |
+ path_manager_ = new FileSystemPathManager( |
+ base::MessageLoopProxy::CreateForCurrentThread(), |
+ filesystem_dir_, NULL, false, true); |
+ |
+ file_system_context_ = new FileSystemContext( |
+ base::MessageLoopProxy::CreateForCurrentThread(), |
+ base::MessageLoopProxy::CreateForCurrentThread(), |
+ NULL, NULL, FilePath(), false, |
+ true, true, path_manager_); |
+ |
+ // Creates the filesystem directory. |
+ path_manager_->sandbox_provider()-> |
+ ValidateFileSystemRootAndGetPathOnFileThread( |
+ GURL("http://www.example.com"), kFileSystemTypeTemporary, |
+ FilePath(), true); |
+ |
usage_file_path_ = Path(FileSystemUsageCache::kUsageFileName); |
FileSystemUsageCache::UpdateUsage(usage_file_path_, 0); |
} |
protected: |
+ scoped_refptr<FileSystemContext> file_system_context_; |
+ FileSystemPathManager* path_manager_; |
+ |
FileSystemOperationContext* NewContext() { |
FileSystemOperationContext *context = new FileSystemOperationContext( |
- new FileSystemContext(base::MessageLoopProxy::CreateForCurrentThread(), |
- base::MessageLoopProxy::CreateForCurrentThread(), |
- NULL, NULL, FilePath(), false, |
- true, true, |
- new MockFileSystemPathManager(filesystem_dir_)), |
- QuotaFileUtil::GetInstance()); |
+ file_system_context_, QuotaFileUtil::GetInstance()); |
+ context->set_src_origin_url(GURL("http://www.example.com")); |
context->set_src_type(fileapi::kFileSystemTypeTemporary); |
return context; |
} |
@@ -75,7 +68,9 @@ class QuotaFileUtilTest : public testing::Test { |
} |
FilePath Path(const char *file_name) { |
- return filesystem_dir_.AppendASCII(file_name); |
+ return path_manager_->sandbox_provider()->GetBaseDirectoryForOriginAndType( |
+ GURL("http://www.example.com"), kFileSystemTypeTemporary). |
+ AppendASCII(file_name); |
} |
base::PlatformFileError CreateFile(const char* file_name, |