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

Unified Diff: webkit/fileapi/quota_file_util_unittest.cc

Issue 6997008: Fix QuotaFileUtil to write .usage into the same directory as "chrome-", not under "chrome-*". (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Mofified tests. Created 9 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
« no previous file with comments | « webkit/fileapi/quota_file_util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « webkit/fileapi/quota_file_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698