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

Side by Side Diff: chrome/common/local_discovery/service_discovery_client_unittest.cc

Issue 1395103003: Don't use base::MessageLoop::{Quit,QuitClosure} in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/location.h" 5 #include "base/location.h"
6 #include "base/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h" 9 #include "base/thread_task_runner_handle.h"
10 #include "chrome/common/local_discovery/service_discovery_client_impl.h" 10 #include "chrome/common/local_discovery/service_discovery_client_impl.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 void RunFor(base::TimeDelta time_period) { 216 void RunFor(base::TimeDelta time_period) {
217 base::CancelableCallback<void()> callback(base::Bind( 217 base::CancelableCallback<void()> callback(base::Bind(
218 &ServiceDiscoveryTest::Stop, base::Unretained(this))); 218 &ServiceDiscoveryTest::Stop, base::Unretained(this)));
219 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 219 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
220 FROM_HERE, callback.callback(), time_period); 220 FROM_HERE, callback.callback(), time_period);
221 221
222 base::MessageLoop::current()->Run(); 222 base::MessageLoop::current()->Run();
223 callback.Cancel(); 223 callback.Cancel();
224 } 224 }
225 225
226 void Stop() { 226 void Stop() { base::MessageLoop::current()->QuitWhenIdle(); }
227 base::MessageLoop::current()->Quit();
228 }
229 227
230 net::MockMDnsSocketFactory socket_factory_; 228 net::MockMDnsSocketFactory socket_factory_;
231 net::MDnsClientImpl mdns_client_; 229 net::MDnsClientImpl mdns_client_;
232 ServiceDiscoveryClientImpl service_discovery_client_; 230 ServiceDiscoveryClientImpl service_discovery_client_;
233 base::MessageLoop loop_; 231 base::MessageLoop loop_;
234 }; 232 };
235 233
236 TEST_F(ServiceDiscoveryTest, AddRemoveService) { 234 TEST_F(ServiceDiscoveryTest, AddRemoveService) {
237 StrictMock<MockServiceWatcherClient> delegate; 235 StrictMock<MockServiceWatcherClient> delegate;
238 236
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _)); 509 ServiceResolver::STATUS_REQUEST_TIMEOUT, _, _, _));
512 510
513 // TODO(noamsml): When NSEC record support is added, change this to use an 511 // TODO(noamsml): When NSEC record support is added, change this to use an
514 // NSEC record. 512 // NSEC record.
515 RunFor(base::TimeDelta::FromSeconds(4)); 513 RunFor(base::TimeDelta::FromSeconds(4));
516 }; 514 };
517 515
518 } // namespace 516 } // namespace
519 517
520 } // namespace local_discovery 518 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/common/local_discovery/local_domain_resolver_unittest.cc ('k') | chrome/common/mac/mock_launchd.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698