0

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}
This commit is contained in:
Xiyuan Xia
2025-03-10 09:01:26 -07:00
committed by Chromium LUCI CQ
parent 382a6fcc1b
commit d195055949

@ -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 @@ class ExportedObjectTest : public testing::Test {
};
// 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 @@ TEST_F(ExportedObjectTest, DISABLED_NotSendingResponseCrash) {
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