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

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: 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 | « no previous file | net/proxy/mock_proxy_resolver.h » ('j') | net/quic/quic_connection_logger.h » ('J')
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/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 output_value_ = input_value_; 50 output_value_ = input_value_;
51 51
52 { // This lock might be destroyed after work_called_ is signalled. 52 { // This lock might be destroyed after work_called_ is signalled.
53 base::AutoLock lock(work_lock_); 53 base::AutoLock lock(work_lock_);
54 work_running_ = false; 54 work_running_ = false;
55 } 55 }
56 work_called_.Signal(); 56 work_called_.Signal();
57 } 57 }
58 58
59 void OnWorkFinished() { 59 void OnWorkFinished() {
60 EXPECT_TRUE(message_loop_ == base::MessageLoop::current()); 60 EXPECT_TRUE(message_loop_->task_runner()->BelongsToCurrentThread());
61 EXPECT_EQ(output_value_, input_value_); 61 EXPECT_EQ(output_value_, input_value_);
62 BreakNow("OnWorkFinished"); 62 BreakNow("OnWorkFinished");
63 } 63 }
64 64
65 protected: 65 protected:
66 void BreakCallback(const std::string& breakpoint) { 66 void BreakCallback(const std::string& breakpoint) {
67 breakpoint_ = breakpoint; 67 breakpoint_ = breakpoint;
68 base::MessageLoop::current()->QuitNow(); 68 base::MessageLoop::current()->QuitNow();
69 } 69 }
70 70
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 RunUntilBreak("OnWorkFinished"); 157 RunUntilBreak("OnWorkFinished");
158 158
159 // No more tasks should remain. 159 // No more tasks should remain.
160 EXPECT_TRUE(message_loop_->IsIdleForTesting()); 160 EXPECT_TRUE(message_loop_->IsIdleForTesting());
161 } 161 }
162 162
163 } // namespace 163 } // namespace
164 164
165 } // namespace net 165 } // namespace net
166 166
OLDNEW
« no previous file with comments | « no previous file | net/proxy/mock_proxy_resolver.h » ('j') | net/quic/quic_connection_logger.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698