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

Unified Diff: webkit/fileapi/file_system_test_helper.cc

Issue 7608011: Simplify directory path accounting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rolled in CR feedback. Created 9 years, 4 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/file_system_test_helper.h ('k') | webkit/fileapi/file_system_usage_cache.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 535ad769e3257625941509477f3259cd8f9a7c59..05de4a408c94e787cd83ca3a29719fafbca5aa6c 100644
--- a/webkit/fileapi/file_system_test_helper.cc
+++ b/webkit/fileapi/file_system_test_helper.cc
@@ -112,19 +112,11 @@ void FileSystemTestOriginHelper::SetUp(
ValidateFileSystemRootAndGetPathOnFileThread(
origin_, type_, FilePath(), true /* create */);
- // Initialize the usage cache file.
+ // 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_);
FileSystemUsageCache::UpdateUsage(usage_cache_path, 0);
-
- // We expect the origin directory to be always empty, except for possibly
- // the usage cache file. We record the initial usage file size here
- // (it will be either 0 or kUsageFileSize) so that later we can compute
- // how much the size of the origin directory has grown.
- initial_usage_size_ = file_util::ComputeDirectorySize(
- GetOriginRootPath());
-
- FileSystemUsageCache::UpdateUsage(usage_cache_path, initial_usage_size_);
}
void FileSystemTestOriginHelper::TearDown() {
@@ -170,11 +162,10 @@ bool FileSystemTestOriginHelper::RevokeUsageCache() const {
}
int64 FileSystemTestOriginHelper::ComputeCurrentOriginUsage() const {
- // Depending on the file_util GetOriginRootPath() may include usage
- // cache file size or may not. Here we subtract the initial size to
- // make it work for multiple file_utils.
- return file_util::ComputeDirectorySize(GetOriginRootPath()) -
- initial_usage_size_;
+ int64 size = file_util::ComputeDirectorySize(GetOriginRootPath());
+ if (file_util::PathExists(GetUsageCachePath()))
+ size -= FileSystemUsageCache::kUsageFileSize;
+ return size;
}
FileSystemOperation* FileSystemTestOriginHelper::NewOperation(
« no previous file with comments | « webkit/fileapi/file_system_test_helper.h ('k') | webkit/fileapi/file_system_usage_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698