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

Side by Side Diff: net/dns/serial_worker_unittest.cc

Issue 2082773002: Remove calls to MessageLoop::current() in net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: forward declaration Created 4 years, 5 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 | « no previous file | net/proxy/mock_proxy_resolver.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) 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/dns/serial_worker.h" 5 #include "net/dns/serial_worker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 output_value_ = input_value_; 51 output_value_ = input_value_;
52 52
53 { // This lock might be destroyed after work_called_ is signalled. 53 { // This lock might be destroyed after work_called_ is signalled.
54 base::AutoLock lock(work_lock_); 54 base::AutoLock lock(work_lock_);
55 work_running_ = false; 55 work_running_ = false;
56 } 56 }
57 work_called_.Signal(); 57 work_called_.Signal();
58 } 58 }
59 59
60 void OnWorkFinished() { 60 void OnWorkFinished() {
61 EXPECT_TRUE(message_loop_ == base::MessageLoop::current()); 61 EXPECT_TRUE(message_loop_->task_runner()->BelongsToCurrentThread());
62 EXPECT_EQ(output_value_, input_value_); 62 EXPECT_EQ(output_value_, input_value_);
63 BreakNow("OnWorkFinished"); 63 BreakNow("OnWorkFinished");
64 } 64 }
65 65
66 protected: 66 protected:
67 void BreakCallback(const std::string& breakpoint) { 67 void BreakCallback(const std::string& breakpoint) {
68 breakpoint_ = breakpoint; 68 breakpoint_ = breakpoint;
69 base::MessageLoop::current()->QuitNow(); 69 base::MessageLoop::current()->QuitNow();
70 } 70 }
71 71
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 RunUntilBreak("OnWorkFinished"); 158 RunUntilBreak("OnWorkFinished");
159 159
160 // No more tasks should remain. 160 // No more tasks should remain.
161 EXPECT_TRUE(message_loop_->IsIdleForTesting()); 161 EXPECT_TRUE(message_loop_->IsIdleForTesting());
162 } 162 }
163 163
164 } // namespace 164 } // namespace
165 165
166 } // namespace net 166 } // namespace net
167 167
OLDNEW
« no previous file with comments | « no previous file | net/proxy/mock_proxy_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698