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

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

Issue 501099: Http cache: Add a test to make sure that the cache... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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/entry_unittest.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"
11 #include "net/disk_cache/backend_impl.h" 10 #include "net/disk_cache/backend_impl.h"
12 #include "net/disk_cache/cache_util.h" 11 #include "net/disk_cache/cache_util.h"
13 #include "net/disk_cache/file.h" 12 #include "net/disk_cache/file.h"
14 13
15 using base::Time; 14 using base::Time;
16 using base::TimeDelta; 15 using base::TimeDelta;
17 16
18 namespace { 17 namespace {
19 18
20 FilePath BuildCachePath(const std::string& name) { 19 FilePath BuildCachePath(const std::string& name) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 g_cache_tests_error = true; 117 g_cache_tests_error = true;
119 reuse_++; 118 reuse_++;
120 } 119 }
121 120
122 result_ = params.a; 121 result_ = params.a;
123 g_cache_tests_received++; 122 g_cache_tests_received++;
124 } 123 }
125 124
126 // ----------------------------------------------------------------------- 125 // -----------------------------------------------------------------------
127 126
128 int SimpleCallbackTest::GetResult(int result) {
129 if (net::ERR_IO_PENDING != result)
130 return result;
131 return WaitForResult();
132 }
133
134 // -----------------------------------------------------------------------
135
136 MessageLoopHelper::MessageLoopHelper() 127 MessageLoopHelper::MessageLoopHelper()
137 : num_callbacks_(0), 128 : num_callbacks_(0),
138 num_iterations_(0), 129 num_iterations_(0),
139 last_(0), 130 last_(0),
140 completed_(false) { 131 completed_(false) {
141 // Create a recurrent timer of 50 mS. 132 // Create a recurrent timer of 50 mS.
142 timer_.Start( 133 timer_.Start(
143 TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired); 134 TimeDelta::FromMilliseconds(50), this, &MessageLoopHelper::TimerExpired);
144 } 135 }
145 136
(...skipping 17 matching lines...) Expand all
163 } else { 154 } else {
164 // Not finished yet. See if we have to abort. 155 // Not finished yet. See if we have to abort.
165 if (last_ == g_cache_tests_received) 156 if (last_ == g_cache_tests_received)
166 num_iterations_++; 157 num_iterations_++;
167 else 158 else
168 last_ = g_cache_tests_received; 159 last_ = g_cache_tests_received;
169 if (40 == num_iterations_) 160 if (40 == num_iterations_)
170 MessageLoop::current()->Quit(); 161 MessageLoop::current()->Quit();
171 } 162 }
172 } 163 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_test_util.h ('k') | net/disk_cache/entry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698