summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/disk_cache_test_util.cc
diff options
context:
space:
mode:
authortony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 17:38:04 +0000
committertony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-15 17:38:04 +0000
commit5306d118a2880703b2e7d24d1267f7c3e67b376b (patch)
tree984510292dc91259dad06882d659a36fb337127a /net/disk_cache/disk_cache_test_util.cc
parent42b8c0b39acc727cf56fe6e77dc9d62b6e15e25f (diff)
downloadchromium_src-5306d118a2880703b2e7d24d1267f7c3e67b376b.zip
chromium_src-5306d118a2880703b2e7d24d1267f7c3e67b376b.tar.gz
chromium_src-5306d118a2880703b2e7d24d1267f7c3e67b376b.tar.bz2
Final patch to convert disk cache to using FilePath instead of
wstring. After this patch, I'm able to start chrome in a user data dir with non-ascii characters on non-utf8 systems. BUG=24444 Review URL: http://codereview.chromium.org/267085 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29136 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/disk_cache_test_util.cc')
-rw-r--r--net/disk_cache/disk_cache_test_util.cc33
1 files changed, 10 insertions, 23 deletions
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index f16c578..2293a5e 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -17,14 +17,14 @@ using base::TimeDelta;
namespace {
-std::wstring BuildCachePath(const std::wstring& name) {
+FilePath BuildCachePath(const std::string& name) {
FilePath path;
PathService::Get(base::DIR_TEMP, &path); // Ignore return value;
- path = path.Append(FilePath::FromWStringHack(name));
+ path = path.AppendASCII(name);
if (!file_util::PathExists(path))
file_util::CreateDirectory(path);
- return path.ToWStringHack();
+ return path;
}
} // namespace.
@@ -54,12 +54,8 @@ void CacheTestFillBuffer(char* buffer, size_t len, bool no_nulls) {
buffer[0] = 'g';
}
-std::wstring GetCachePath() {
- return BuildCachePath(L"cache_test");
-}
-
FilePath GetCacheFilePath() {
- return FilePath::FromWStringHack(GetCachePath());
+ return BuildCachePath("cache_test");
}
bool CreateCacheTestFile(const FilePath& name) {
@@ -76,22 +72,13 @@ bool CreateCacheTestFile(const FilePath& name) {
return true;
}
-bool CreateCacheTestFile(const wchar_t* name) {
- return CreateCacheTestFile(FilePath::FromWStringHack(name));
-}
-
bool DeleteCache(const FilePath& path) {
disk_cache::DeleteCache(path, false);
return true;
}
-bool DeleteCache(const wchar_t* path) {
- return DeleteCache(FilePath::FromWStringHack(path));
-}
-
-bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) {
- scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
- FilePath::FromWStringHack(path)));
+bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) {
+ scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(path));
if (!cache.get())
return false;
if (new_eviction)
@@ -102,14 +89,14 @@ bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) {
return cache->SelfCheck() >= 0;
}
-ScopedTestCache::ScopedTestCache() : path_(GetCachePath()) {
- bool result = DeleteCache(path_.c_str());
+ScopedTestCache::ScopedTestCache() : path_(GetCacheFilePath()) {
+ bool result = DeleteCache(path_);
DCHECK(result);
}
-ScopedTestCache::ScopedTestCache(const std::wstring& name)
+ScopedTestCache::ScopedTestCache(const std::string& name)
: path_(BuildCachePath(name)) {
- bool result = DeleteCache(path_.c_str());
+ bool result = DeleteCache(path_);
DCHECK(result);
}