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

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

Issue 132031: Disk cache: First pass to add support for sparse entries.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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_util.h ('k') | net/disk_cache/disk_format.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-2008 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/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
19 std::wstring BuildCachePath(const std::wstring& name) { 20 std::wstring BuildCachePath(const std::wstring& name) {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // On the actual callback, increase the number of tests received and check for 112 // On the actual callback, increase the number of tests received and check for
112 // errors (an unexpected test received) 113 // errors (an unexpected test received)
113 void CallbackTest::RunWithParams(const Tuple1<int>& params) { 114 void CallbackTest::RunWithParams(const Tuple1<int>& params) {
114 if (reuse_) { 115 if (reuse_) {
115 DCHECK(1 == reuse_); 116 DCHECK(1 == reuse_);
116 if (2 == reuse_) 117 if (2 == reuse_)
117 g_cache_tests_error = true; 118 g_cache_tests_error = true;
118 reuse_++; 119 reuse_++;
119 } 120 }
120 121
122 result_ = params.a;
121 g_cache_tests_received++; 123 g_cache_tests_received++;
122 } 124 }
123 125
124 // ----------------------------------------------------------------------- 126 // -----------------------------------------------------------------------
125 127
128 int SimpleCallbackTest::GetResult(int result) {
129 if (net::ERR_IO_PENDING != result)
130 return result;
131 return WaitForResult();
132 }
133
134 // -----------------------------------------------------------------------
135
126 MessageLoopHelper::MessageLoopHelper() 136 MessageLoopHelper::MessageLoopHelper()
127 : num_callbacks_(0), 137 : num_callbacks_(0),
128 num_iterations_(0), 138 num_iterations_(0),
129 last_(0), 139 last_(0),
130 completed_(false) { 140 completed_(false) {
131 // Create a recurrent timer of 50 mS. 141 // Create a recurrent timer of 50 mS.
132 timer_.Start( 142 timer_.Start(
133 TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired); 143 TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired);
134 } 144 }
135 145
(...skipping 17 matching lines...) Expand all
153 } else { 163 } else {
154 // Not finished yet. See if we have to abort. 164 // Not finished yet. See if we have to abort.
155 if (last_ == g_cache_tests_received) 165 if (last_ == g_cache_tests_received)
156 num_iterations_++; 166 num_iterations_++;
157 else 167 else
158 last_ = g_cache_tests_received; 168 last_ = g_cache_tests_received;
159 if (40 == num_iterations_) 169 if (40 == num_iterations_)
160 MessageLoop::current()->Quit(); 170 MessageLoop::current()->Quit();
161 } 171 }
162 } 172 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_util.h ('k') | net/disk_cache/disk_format.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698