shill: DHCPProviderTest.BindAndUnbind: Work around ASAN issue
Asan seems not to be able to use SaveArg with closures. Work
around this by calling the task directly.
BUG=chromium:502319,chromium:502320
TEST=Run shill unittests with USE="asan clang"
Change-Id: Ib97e99ed6a6331ed43fbd04a359095b01de80f47
Reviewed-on: https://chromium-review.googlesource.com/280587
Reviewed-by: Samuel Tan <samueltan@chromium.org>
Tested-by: Samuel Tan <samueltan@chromium.org>
Commit-Queue: Paul Stewart <pstew@chromium.org>
diff --git a/shill/dhcp/dhcp_provider_unittest.cc b/shill/dhcp/dhcp_provider_unittest.cc
index 0a77ffd..de4a4ca 100644
--- a/shill/dhcp/dhcp_provider_unittest.cc
+++ b/shill/dhcp/dhcp_provider_unittest.cc
@@ -46,6 +46,8 @@
}
protected:
+ void RetireUnboundPID(int pid) { provider_->RetireUnboundPID(pid); }
+
MockControl control_;
MockGLib glib_;
DHCPProvider* provider_;
@@ -92,12 +94,12 @@
EXPECT_FALSE(provider_->IsRecentlyUnbound(kPid));
base::Closure task;
- EXPECT_CALL(dispatcher_, PostDelayedTask(_, _)).WillOnce(SaveArg<0>(&task));
+ EXPECT_CALL(dispatcher_, PostDelayedTask(_, _)); // TODO(pstew): crbug/502320
provider_->UnbindPID(kPid);
EXPECT_EQ(nullptr, provider_->GetConfig(kPid));
EXPECT_TRUE(provider_->IsRecentlyUnbound(kPid));
- task.Run(); // Execute as if the PostDelayedTask() timer expired.
+ RetireUnboundPID(kPid); // Execute as if the PostDelayedTask() timer expired.
EXPECT_EQ(nullptr, provider_->GetConfig(kPid));
EXPECT_FALSE(provider_->IsRecentlyUnbound(kPid));
}