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

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

Issue 2090613002: Remove calls to deprecated MessageLoop methods in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « net/base/network_config_watcher_mac.cc ('k') | net/dns/dns_config_service_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) 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/files/file.h" 7 #include "base/files/file.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/run_loop.h"
10 #include "base/threading/thread_task_runner_handle.h" 11 #include "base/threading/thread_task_runner_handle.h"
11 #include "net/base/net_errors.h" 12 #include "net/base/net_errors.h"
12 #include "net/disk_cache/blockfile/backend_impl.h" 13 #include "net/disk_cache/blockfile/backend_impl.h"
13 #include "net/disk_cache/blockfile/file.h" 14 #include "net/disk_cache/blockfile/file.h"
14 #include "net/disk_cache/cache_util.h" 15 #include "net/disk_cache/cache_util.h"
15 16
16 using base::Time; 17 using base::Time;
17 using base::TimeDelta; 18 using base::TimeDelta;
18 19
19 std::string GenerateKey(bool same_length) { 20 std::string GenerateKey(bool same_length) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 90
90 bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) { 91 bool MessageLoopHelper::WaitUntilCacheIoFinished(int num_callbacks) {
91 if (num_callbacks == callbacks_called_) 92 if (num_callbacks == callbacks_called_)
92 return true; 93 return true;
93 94
94 ExpectCallbacks(num_callbacks); 95 ExpectCallbacks(num_callbacks);
95 // Create a recurrent timer of 50 mS. 96 // Create a recurrent timer of 50 mS.
96 if (!timer_.IsRunning()) 97 if (!timer_.IsRunning())
97 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(50), this, 98 timer_.Start(FROM_HERE, TimeDelta::FromMilliseconds(50), this,
98 &MessageLoopHelper::TimerExpired); 99 &MessageLoopHelper::TimerExpired);
99 base::MessageLoop::current()->Run(); 100 base::RunLoop().Run();
100 return completed_; 101 return completed_;
101 } 102 }
102 103
103 // Quits the message loop when all callbacks are called or we've been waiting 104 // Quits the message loop when all callbacks are called or we've been waiting
104 // too long for them (2 secs without a callback). 105 // too long for them (2 secs without a callback).
105 void MessageLoopHelper::TimerExpired() { 106 void MessageLoopHelper::TimerExpired() {
106 CHECK_LE(callbacks_called_, num_callbacks_); 107 CHECK_LE(callbacks_called_, num_callbacks_);
107 if (callbacks_called_ == num_callbacks_) { 108 if (callbacks_called_ == num_callbacks_) {
108 completed_ = true; 109 completed_ = true;
109 base::MessageLoop::current()->QuitWhenIdle(); 110 base::MessageLoop::current()->QuitWhenIdle();
(...skipping 26 matching lines...) Expand all
136 137
137 if (reuse_) { 138 if (reuse_) {
138 DCHECK_EQ(1, reuse_); 139 DCHECK_EQ(1, reuse_);
139 if (2 == reuse_) 140 if (2 == reuse_)
140 helper_->set_callback_reused_error(true); 141 helper_->set_callback_reused_error(true);
141 reuse_++; 142 reuse_++;
142 } 143 }
143 144
144 helper_->CallbackWasCalled(); 145 helper_->CallbackWasCalled();
145 } 146 }
OLDNEW
« no previous file with comments | « net/base/network_config_watcher_mac.cc ('k') | net/dns/dns_config_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698