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

Side by Side Diff: chrome/common/local_discovery/local_domain_resolver_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/single_thread_task_runner.h" 6 #include "base/single_thread_task_runner.h"
7 #include "base/thread_task_runner_handle.h" 7 #include "base/thread_task_runner_handle.h"
8 #include "chrome/common/local_discovery/service_discovery_client_impl.h" 8 #include "chrome/common/local_discovery/service_discovery_client_impl.h"
9 #include "net/dns/mdns_client_impl.h" 9 #include "net/dns/mdns_client_impl.h"
10 #include "net/dns/mock_mdns_socket_factory.h" 10 #include "net/dns/mock_mdns_socket_factory.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 74
75 void AddressCallback(bool resolved, 75 void AddressCallback(bool resolved,
76 const net::IPAddressNumber& address_ipv4, 76 const net::IPAddressNumber& address_ipv4,
77 const net::IPAddressNumber& address_ipv6) { 77 const net::IPAddressNumber& address_ipv6) {
78 AddressCallbackInternal(resolved, 78 AddressCallbackInternal(resolved,
79 IPAddressToStringWithEmpty(address_ipv4), 79 IPAddressToStringWithEmpty(address_ipv4),
80 IPAddressToStringWithEmpty(address_ipv6)); 80 IPAddressToStringWithEmpty(address_ipv6));
81 } 81 }
82 82
83 void RunFor(base::TimeDelta time_period) { 83 void RunFor(base::TimeDelta time_period) {
84 base::CancelableCallback<void()> callback(base::Bind( 84 base::CancelableCallback<void()> callback(
85 &base::MessageLoop::Quit, 85 base::Bind(&base::MessageLoop::QuitWhenIdle,
86 base::Unretained(base::MessageLoop::current()))); 86 base::Unretained(base::MessageLoop::current())));
87 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 87 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
88 FROM_HERE, callback.callback(), time_period); 88 FROM_HERE, callback.callback(), time_period);
89 89
90 base::MessageLoop::current()->Run(); 90 base::MessageLoop::current()->Run();
91 callback.Cancel(); 91 callback.Cancel();
92 } 92 }
93 93
94 MOCK_METHOD3(AddressCallbackInternal, 94 MOCK_METHOD3(AddressCallbackInternal,
95 void(bool resolved, 95 void(bool resolved,
96 std::string address_ipv4, 96 std::string address_ipv4,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 resolver.Start(); 177 resolver.Start();
178 178
179 EXPECT_CALL(*this, AddressCallbackInternal(false, "", "")); 179 EXPECT_CALL(*this, AddressCallbackInternal(false, "", ""));
180 180
181 RunFor(base::TimeDelta::FromSeconds(4)); 181 RunFor(base::TimeDelta::FromSeconds(4));
182 } 182 }
183 183
184 } // namespace 184 } // namespace
185 185
186 } // namespace local_discovery 186 } // namespace local_discovery
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/web_ui_test_handler.cc ('k') | chrome/common/local_discovery/service_discovery_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698