dbus: Fix `ExportedObjectTest.NotSendingResponseCrash`
CHECK() does not do logging on official build. Use convenience
wrapper `EXPECT_CHECK_DEATH_WITH` instead.
Cq-Include-Trybots: luci.chrome.try:linux-chromeos-chrome
Fixed: 401584852, 400758194
Change-Id: Iad170c16c80f212df1439d34f19c4d061cdfd5f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6336902
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Commit-Queue: Xiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1430274}
NOKEYCHECK=True
GitOrigin-RevId: d19505594985b40194600a5061c8b09b566fc29c
diff --git a/exported_object_unittest.cc b/exported_object_unittest.cc
index 46d0ba0..b4cb732 100644
--- a/exported_object_unittest.cc
+++ b/exported_object_unittest.cc
@@ -7,6 +7,7 @@
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/test/bind.h"
+#include "base/test/gtest_util.h"
#include "base/test/task_environment.h"
#include "dbus/bus.h"
#include "dbus/message.h"
@@ -37,8 +38,7 @@
};
// Tests that calling a method that doesn't send a response crashes.
-// TODO(crbug.com/401584852): Reenable this test.
-TEST_F(ExportedObjectTest, DISABLED_NotSendingResponseCrash) {
+TEST_F(ExportedObjectTest, NotSendingResponseCrash) {
TestService::Options options;
TestService test_service(options);
ObjectProxy* object_proxy = bus_->GetObjectProxy(
@@ -62,11 +62,10 @@
MethodCall method_call("org.chromium.TestInterface",
"NotSendingResponseCrash");
base::expected<std::unique_ptr<Response>, Error> result;
- EXPECT_DEATH_IF_SUPPORTED(
- result = object_proxy->CallMethodAndBlock(
- &method_call, ObjectProxy::TIMEOUT_USE_DEFAULT),
- "ResponseSender did not run for "
- "org.chromium.TestInterface.NotSendingResponseCrash");
+ EXPECT_CHECK_DEATH_WITH(result = object_proxy->CallMethodAndBlock(
+ &method_call, ObjectProxy::TIMEOUT_USE_DEFAULT),
+ "ResponseSender did not run for "
+ "org.chromium.TestInterface.NotSendingResponseCrash");
}
} // namespace