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

Side by Side Diff: net/dns/serial_worker_unittest.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/dns/host_resolver_impl_unittest.cc ('k') | net/http/http_cache_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/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/single_thread_task_runner.h" 11 #include "base/single_thread_task_runner.h"
11 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
12 #include "base/synchronization/waitable_event.h" 13 #include "base/synchronization/waitable_event.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace net { 16 namespace net {
16 17
17 namespace { 18 namespace {
18 19
19 class SerialWorkerTest : public testing::Test { 20 class SerialWorkerTest : public testing::Test {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 base::MessageLoop::current()->QuitNow(); 69 base::MessageLoop::current()->QuitNow();
69 } 70 }
70 71
71 void BreakNow(const std::string& b) { 72 void BreakNow(const std::string& b) {
72 message_loop_->task_runner()->PostTask( 73 message_loop_->task_runner()->PostTask(
73 FROM_HERE, base::Bind(&SerialWorkerTest::BreakCallback, 74 FROM_HERE, base::Bind(&SerialWorkerTest::BreakCallback,
74 base::Unretained(this), b)); 75 base::Unretained(this), b));
75 } 76 }
76 77
77 void RunUntilBreak(const std::string& b) { 78 void RunUntilBreak(const std::string& b) {
78 message_loop_->Run(); 79 base::RunLoop().Run();
79 ASSERT_EQ(breakpoint_, b); 80 ASSERT_EQ(breakpoint_, b);
80 } 81 }
81 82
82 SerialWorkerTest() 83 SerialWorkerTest()
83 : input_value_(0), 84 : input_value_(0),
84 output_value_(-1), 85 output_value_(-1),
85 work_allowed_(base::WaitableEvent::ResetPolicy::AUTOMATIC, 86 work_allowed_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
86 base::WaitableEvent::InitialState::NOT_SIGNALED), 87 base::WaitableEvent::InitialState::NOT_SIGNALED),
87 work_called_(base::WaitableEvent::ResetPolicy::AUTOMATIC, 88 work_called_(base::WaitableEvent::ResetPolicy::AUTOMATIC,
88 base::WaitableEvent::InitialState::NOT_SIGNALED), 89 base::WaitableEvent::InitialState::NOT_SIGNALED),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 RunUntilBreak("OnWorkFinished"); 158 RunUntilBreak("OnWorkFinished");
158 159
159 // No more tasks should remain. 160 // No more tasks should remain.
160 EXPECT_TRUE(message_loop_->IsIdleForTesting()); 161 EXPECT_TRUE(message_loop_->IsIdleForTesting());
161 } 162 }
162 163
163 } // namespace 164 } // namespace
164 165
165 } // namespace net 166 } // namespace net
166 167
OLDNEW
« no previous file with comments | « net/dns/host_resolver_impl_unittest.cc ('k') | net/http/http_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698