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

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

Issue 2739007: Disk cache: Update the disk cache tools and tests to use... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/mem_backend_impl.h » ('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-2010 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/message_loop_proxy.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "net/disk_cache/backend_impl.h" 11 #include "net/disk_cache/backend_impl.h"
11 #include "net/disk_cache/cache_util.h" 12 #include "net/disk_cache/cache_util.h"
12 #include "net/disk_cache/file.h" 13 #include "net/disk_cache/file.h"
13 14
14 using base::Time; 15 using base::Time;
15 using base::TimeDelta; 16 using base::TimeDelta;
16 17
17 namespace { 18 namespace {
18 19
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 file->SetLength(4 * 1024 * 1024); 71 file->SetLength(4 * 1024 * 1024);
71 return true; 72 return true;
72 } 73 }
73 74
74 bool DeleteCache(const FilePath& path) { 75 bool DeleteCache(const FilePath& path) {
75 disk_cache::DeleteCache(path, false); 76 disk_cache::DeleteCache(path, false);
76 return true; 77 return true;
77 } 78 }
78 79
79 bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) { 80 bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) {
80 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(path)); 81 scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
82 path, base::MessageLoopProxy::CreateForCurrentThread()));
81 if (!cache.get()) 83 if (!cache.get())
82 return false; 84 return false;
83 if (new_eviction) 85 if (new_eviction)
84 cache->SetNewEviction(); 86 cache->SetNewEviction();
85 cache->SetFlags(disk_cache::kNoRandom); 87 cache->SetFlags(disk_cache::kNoRandom);
86 if (!cache->Init()) 88 if (!cache->Init())
87 return false; 89 return false;
88 return cache->SelfCheck() >= 0; 90 return cache->SelfCheck() >= 0;
89 } 91 }
90 92
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } else { 156 } else {
155 // Not finished yet. See if we have to abort. 157 // Not finished yet. See if we have to abort.
156 if (last_ == g_cache_tests_received) 158 if (last_ == g_cache_tests_received)
157 num_iterations_++; 159 num_iterations_++;
158 else 160 else
159 last_ = g_cache_tests_received; 161 last_ = g_cache_tests_received;
160 if (40 == num_iterations_) 162 if (40 == num_iterations_)
161 MessageLoop::current()->Quit(); 163 MessageLoop::current()->Quit();
162 } 164 }
163 } 165 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_base.cc ('k') | net/disk_cache/mem_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698