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

Unified Diff: webkit/fileapi/file_system_quota_client_unittest.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_operation_context.cc ('k') | webkit/fileapi/file_system_quota_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/file_system_quota_client_unittest.cc
diff --git a/webkit/fileapi/file_system_quota_client_unittest.cc b/webkit/fileapi/file_system_quota_client_unittest.cc
index b78d18724383be86cb50ca0e71d505d414f12f6d..73479808a21d1c02546d786c1ae883d85a6e0107 100644
--- a/webkit/fileapi/file_system_quota_client_unittest.cc
+++ b/webkit/fileapi/file_system_quota_client_unittest.cc
@@ -17,6 +17,7 @@
#include "webkit/fileapi/file_system_types.h"
#include "webkit/fileapi/file_system_usage_cache.h"
#include "webkit/fileapi/file_system_util.h"
+#include "webkit/fileapi/obfuscated_file_system_file_util.h"
#include "webkit/fileapi/sandbox_mount_point_provider.h"
#include "webkit/fileapi/quota_file_util.h"
#include "webkit/quota/quota_types.h"
@@ -195,6 +196,10 @@ class FileSystemQuotaClientTest : public testing::Test {
path, files[i].origin_url, files[i].type));
if (path.empty()) {
// Create the usage cache.
+ // HACK--we always create the root [an empty path] first. If we
+ // create it later, this will fail due to a quota mismatch. If we
+ // call this before we create the root, it succeeds, but hasn't
+ // actually created the cache.
ASSERT_EQ(0, GetOriginUsage(
quota_client, files[i].origin_url, files[i].type));
}
@@ -205,6 +210,10 @@ class FileSystemQuotaClientTest : public testing::Test {
}
}
+ // This is a bit fragile--it depends on the test data always creating a
+ // directory before adding a file or directory to it, so that we can just
+ // count the basename of each addition. A recursive creation of a path, which
+ // created more than one directory in a single shot, would break this.
int64 ComputeFilePathsCostForOriginAndType(const TestFile* files,
int num_files,
const std::string& origin_url,
@@ -215,9 +224,8 @@ class FileSystemQuotaClientTest : public testing::Test {
GURL(files[i].origin_url) == GURL(origin_url)) {
FilePath path = FilePath().AppendASCII(files[i].name);
if (!path.empty()) {
- // TODO(dmikurube): Use QuotaFileUtil in the actual -FileUtil stack.
- scoped_ptr<QuotaFileUtil> file_util(QuotaFileUtil::CreateDefault());
- file_paths_cost += file_util->ComputeFilePathCost(path);
+ file_paths_cost +=
+ ObfuscatedFileSystemFileUtil::ComputeFilePathCost(path);
}
}
}
@@ -286,8 +294,7 @@ TEST_F(FileSystemQuotaClientTest, NoFileTest) {
InitializeOriginFiles(quota_client.get(), kFiles, ARRAYSIZE_UNSAFE(kFiles));
for (int i = 0; i < 2; i++) {
- EXPECT_EQ(0,
- GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
+ EXPECT_EQ(0, GetOriginUsage(quota_client.get(), kDummyURL1, kTemporary));
}
}
« no previous file with comments | « webkit/fileapi/file_system_operation_context.cc ('k') | webkit/fileapi/file_system_quota_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698