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

Side by Side Diff: chrome/browser/local_discovery/local_domain_resolver_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/run_loop.h"
8 #include "base/single_thread_task_runner.h" 9 #include "base/single_thread_task_runner.h"
9 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
10 #include "chrome/browser/local_discovery/service_discovery_client_impl.h" 11 #include "chrome/browser/local_discovery/service_discovery_client_impl.h"
11 #include "net/dns/mdns_client_impl.h" 12 #include "net/dns/mdns_client_impl.h"
12 #include "net/dns/mock_mdns_socket_factory.h" 13 #include "net/dns/mock_mdns_socket_factory.h"
13 #include "testing/gmock/include/gmock/gmock.h" 14 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 using ::testing::_; 17 using ::testing::_;
17 18
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 78
78 void AddressCallback(bool resolved, 79 void AddressCallback(bool resolved,
79 const net::IPAddress& address_ipv4, 80 const net::IPAddress& address_ipv4,
80 const net::IPAddress& address_ipv6) { 81 const net::IPAddress& address_ipv6) {
81 AddressCallbackInternal(resolved, 82 AddressCallbackInternal(resolved,
82 IPAddressToStringWithInvalid(address_ipv4), 83 IPAddressToStringWithInvalid(address_ipv4),
83 IPAddressToStringWithInvalid(address_ipv6)); 84 IPAddressToStringWithInvalid(address_ipv6));
84 } 85 }
85 86
86 void RunFor(base::TimeDelta time_period) { 87 void RunFor(base::TimeDelta time_period) {
87 base::CancelableCallback<void()> callback( 88 base::RunLoop run_loop;
88 base::Bind(&base::MessageLoop::QuitWhenIdle, 89 base::CancelableCallback<void()> callback(run_loop.QuitWhenIdleClosure());
89 base::Unretained(base::MessageLoop::current())));
90 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 90 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
91 FROM_HERE, callback.callback(), time_period); 91 FROM_HERE, callback.callback(), time_period);
92 92 run_loop.Run();
93 base::MessageLoop::current()->Run();
94 callback.Cancel(); 93 callback.Cancel();
95 } 94 }
96 95
97 MOCK_METHOD3(AddressCallbackInternal, 96 MOCK_METHOD3(AddressCallbackInternal,
98 void(bool resolved, 97 void(bool resolved,
99 std::string address_ipv4, 98 std::string address_ipv4,
100 std::string address_ipv6)); 99 std::string address_ipv6));
101 100
102 net::MockMDnsSocketFactory socket_factory_; 101 net::MockMDnsSocketFactory socket_factory_;
103 net::MDnsClientImpl mdns_client_; 102 net::MDnsClientImpl mdns_client_;
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 resolver.Start(); 179 resolver.Start();
181 180
182 EXPECT_CALL(*this, AddressCallbackInternal(false, "", "")); 181 EXPECT_CALL(*this, AddressCallbackInternal(false, "", ""));
183 182
184 RunFor(base::TimeDelta::FromSeconds(4)); 183 RunFor(base::TimeDelta::FromSeconds(4));
185 } 184 }
186 185
187 } // namespace 186 } // namespace
188 187
189 } // namespace local_discovery 188 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698