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

Unified Diff: chrome/browser/local_discovery/service_discovery_client_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, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/service_discovery_client_unittest.cc
diff --git a/chrome/browser/local_discovery/service_discovery_client_unittest.cc b/chrome/browser/local_discovery/service_discovery_client_unittest.cc
index b81f8d902d88fa6de1e47a14ad7b15c16c740547..1ac644f35bd00e9d7fdbfd34e288d6a957cd99c2 100644
--- a/chrome/browser/local_discovery/service_discovery_client_unittest.cc
+++ b/chrome/browser/local_discovery/service_discovery_client_unittest.cc
@@ -216,12 +216,11 @@ class ServiceDiscoveryTest : public ::testing::Test {
protected:
void RunFor(base::TimeDelta time_period) {
- base::CancelableCallback<void()> callback(base::Bind(
- &ServiceDiscoveryTest::Stop, base::Unretained(this)));
+ base::RunLoop run_loop;
+ base::CancelableCallback<void()> callback(run_loop.QuitWhenIdleClosure());
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, callback.callback(), time_period);
-
- base::MessageLoop::current()->Run();
+ run_loop.Run();
callback.Cancel();
}
@@ -288,7 +287,7 @@ TEST_F(ServiceDiscoveryTest, ReadCachedServices) {
"hello._privet._tcp.local"))
.Times(Exactly(1));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
@@ -310,7 +309,7 @@ TEST_F(ServiceDiscoveryTest, ReadCachedServicesMultiple) {
"gdbye._privet._tcp.local"))
.Times(Exactly(1));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
@@ -328,7 +327,7 @@ TEST_F(ServiceDiscoveryTest, OnServiceChanged) {
socket_factory_.SimulateReceive(kSamplePacketPTR, sizeof(kSamplePacketPTR));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_CALL(delegate, OnServiceUpdated(ServiceWatcher::UPDATE_CHANGED,
"hello._privet._tcp.local"))
@@ -338,7 +337,7 @@ TEST_F(ServiceDiscoveryTest, OnServiceChanged) {
socket_factory_.SimulateReceive(kSamplePacketTXT, sizeof(kSamplePacketTXT));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
TEST_F(ServiceDiscoveryTest, SinglePacket) {
@@ -356,7 +355,7 @@ TEST_F(ServiceDiscoveryTest, SinglePacket) {
socket_factory_.SimulateReceive(kSamplePacketPTR, sizeof(kSamplePacketPTR));
// Reset the "already updated" flag.
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_CALL(delegate, OnServiceUpdated(ServiceWatcher::UPDATE_CHANGED,
"hello._privet._tcp.local"))
@@ -366,7 +365,7 @@ TEST_F(ServiceDiscoveryTest, SinglePacket) {
socket_factory_.SimulateReceive(kSamplePacketTXT, sizeof(kSamplePacketTXT));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
TEST_F(ServiceDiscoveryTest, ActivelyRefreshServices) {
@@ -390,7 +389,7 @@ TEST_F(ServiceDiscoveryTest, ActivelyRefreshServices) {
socket_factory_.SimulateReceive(kSamplePacketPTR, sizeof(kSamplePacketPTR));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
socket_factory_.SimulateReceive(kSamplePacketSRV, sizeof(kSamplePacketSRV));
@@ -403,7 +402,7 @@ TEST_F(ServiceDiscoveryTest, ActivelyRefreshServices) {
RunFor(base::TimeDelta::FromSeconds(2));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
}
@@ -454,7 +453,7 @@ TEST_F(ServiceResolverTest, TxtAndSrvButNoA) {
socket_factory_.SimulateReceive(kSamplePacketSRV, sizeof(kSamplePacketSRV));
- base::MessageLoop::current()->RunUntilIdle();
+ base::RunLoop().RunUntilIdle();
EXPECT_CALL(
*this, OnFinishedResolvingInternal(ServiceResolver::STATUS_SUCCESS,
« no previous file with comments | « chrome/browser/local_discovery/local_domain_resolver_unittest.cc ('k') | chrome/browser/metrics/thread_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698