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

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

Issue 7825026: Revert "Currently, base/timer.cc calls PostTask with FROM_HERE as the Location, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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/backend_impl.cc ('k') | net/dns/dns_transaction.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/message_loop_proxy.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 MessageLoopHelper::~MessageLoopHelper() { 134 MessageLoopHelper::~MessageLoopHelper() {
135 } 135 }
136 136
137 bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) { 137 bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) {
138 if (num_callbacks == callbacks_called_) 138 if (num_callbacks == callbacks_called_)
139 return true; 139 return true;
140 140
141 ExpectCallbacks(num_callbacks); 141 ExpectCallbacks(num_callbacks);
142 // Create a recurrent timer of 50 mS. 142 // Create a recurrent timer of 50 mS.
143 if (!timer_.IsRunning()) 143 if (!timer_.IsRunning())
144 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(50), this, 144 timer_.Start(TimeDelta::FromMilliseconds(50), this,
145 &MessageLoopHelper::TimerExpired); 145 &MessageLoopHelper::TimerExpired);
146 MessageLoop::current()->Run(); 146 MessageLoop::current()->Run();
147 return completed_; 147 return completed_;
148 } 148 }
149 149
150 // Quits the message loop when all callbacks are called or we've been waiting 150 // Quits the message loop when all callbacks are called or we've been waiting
151 // too long for them (2 secs without a callback). 151 // too long for them (2 secs without a callback).
152 void MessageLoopHelper::TimerExpired() { 152 void MessageLoopHelper::TimerExpired() {
153 CHECK_LE(callbacks_called_, num_callbacks_); 153 CHECK_LE(callbacks_called_, num_callbacks_);
154 if (callbacks_called_ == num_callbacks_) { 154 if (callbacks_called_ == num_callbacks_) {
(...skipping 26 matching lines...) Expand all
181 void CallbackTest::RunWithParams(const Tuple1<int>& params) { 181 void CallbackTest::RunWithParams(const Tuple1<int>& params) {
182 if (reuse_) { 182 if (reuse_) {
183 DCHECK_EQ(1, reuse_); 183 DCHECK_EQ(1, reuse_);
184 if (2 == reuse_) 184 if (2 == reuse_)
185 helper_->set_callback_reused_error(true); 185 helper_->set_callback_reused_error(true);
186 reuse_++; 186 reuse_++;
187 } 187 }
188 188
189 helper_->CallbackWasCalled(); 189 helper_->CallbackWasCalled();
190 } 190 }
OLDNEW
« no previous file with comments | « net/disk_cache/backend_impl.cc ('k') | net/dns/dns_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698