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

Side by Side Diff: net/disk_cache/disk_cache_test_util.cc

Issue 261045: Start migrating the disk cache to using FilePath. (Closed)
Patch Set: rebase Created 11 years, 2 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 unified diff | Download patch
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/entry_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/disk_cache/disk_cache_test_util.h" 5 #include "net/disk_cache/disk_cache_test_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 file->SetLength(4 * 1024 * 1024); 71 file->SetLength(4 * 1024 * 1024);
72 return true; 72 return true;
73 } 73 }
74 74
75 bool DeleteCache(const wchar_t* path) { 75 bool DeleteCache(const wchar_t* path) {
76 disk_cache::DeleteCache(path, false); 76 disk_cache::DeleteCache(path, false);
77 return true; 77 return true;
78 } 78 }
79 79
80 bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) { 80 bool CheckCacheIntegrity(const std::wstring& path, bool new_eviction) {
81 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(path)); 81 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
82 FilePath::FromWStringHack(path)));
82 if (!cache.get()) 83 if (!cache.get())
83 return false; 84 return false;
84 if (new_eviction) 85 if (new_eviction)
85 cache->SetNewEviction(); 86 cache->SetNewEviction();
86 cache->SetFlags(disk_cache::kNoRandom); 87 cache->SetFlags(disk_cache::kNoRandom);
87 if (!cache->Init()) 88 if (!cache->Init())
88 return false; 89 return false;
89 return cache->SelfCheck() >= 0; 90 return cache->SelfCheck() >= 0;
90 } 91 }
91 92
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 } else { 164 } else {
164 // Not finished yet. See if we have to abort. 165 // Not finished yet. See if we have to abort.
165 if (last_ == g_cache_tests_received) 166 if (last_ == g_cache_tests_received)
166 num_iterations_++; 167 num_iterations_++;
167 else 168 else
168 last_ = g_cache_tests_received; 169 last_ = g_cache_tests_received;
169 if (40 == num_iterations_) 170 if (40 == num_iterations_)
170 MessageLoop::current()->Quit(); 171 MessageLoop::current()->Quit();
171 } 172 }
172 } 173 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/entry_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698