InputDispatcher_test: Fix death tests
1. All death tests should be in a test suite with a name ending in
"DeathTest".
2. Silence signal reporting to supress debuggerd stack traces on a
per-test basis and prevent expected deaths from showing up in system
stability metrics.
Bug: 212662036
Test: atest inputflinger_tests
Change-Id: Idc070b4c13eea270f76294a3c21f4553363017dc
diff --git a/services/inputflinger/tests/InputDispatcher_test.cpp b/services/inputflinger/tests/InputDispatcher_test.cpp
index aa2f832..ccdde6e 100644
--- a/services/inputflinger/tests/InputDispatcher_test.cpp
+++ b/services/inputflinger/tests/InputDispatcher_test.cpp
@@ -17,6 +17,7 @@
#include "../dispatcher/InputDispatcher.h"
#include <android-base/properties.h>
+#include <android-base/silent_death_test.h>
#include <android-base/stringprintf.h>
#include <android-base/thread_annotations.h>
#include <binder/Binder.h>
@@ -6345,10 +6346,13 @@
int mSpyCount{0};
};
+using InputDispatcherSpyWindowDeathTest = InputDispatcherSpyWindowTest;
/**
* Adding a spy window that is not a trusted overlay causes Dispatcher to abort.
*/
-TEST_F(InputDispatcherSpyWindowTest, UntrustedSpy_AbortsDispatcher) {
+TEST_F(InputDispatcherSpyWindowDeathTest, UntrustedSpy_AbortsDispatcher) {
+ ScopedSilentDeath _silentDeath;
+
auto spy = createSpy(WindowInfo::Flag::NOT_TOUCH_MODAL);
spy->setTrustedOverlay(false);
ASSERT_DEATH(mDispatcher->setInputWindows({{ADISPLAY_ID_DEFAULT, {spy}}}),
@@ -6665,7 +6669,11 @@
}
};
-TEST_F(InputDispatcherStylusInterceptorTest, UntrustedOverlay_AbortsDispatcher) {
+using InputDispatcherStylusInterceptorDeathTest = InputDispatcherStylusInterceptorTest;
+
+TEST_F(InputDispatcherStylusInterceptorDeathTest, UntrustedOverlay_AbortsDispatcher) {
+ ScopedSilentDeath _silentDeath;
+
auto [overlay, window] = setupStylusOverlayScenario();
overlay->setTrustedOverlay(false);
// Configuring an untrusted overlay as a stylus interceptor should cause Dispatcher to abort.