Run some inputflinger_tests on host
Sometimes, it's convenient to execute the input tests without having a
connected device. This is especially useful when doing cherry-picks of
patch on a cloud device.
Allow input code to build for host, and enable the tests for running on
host.
Bug: 249591924
Test: atest --host --no-bazel-mode -c -m inputflinger_tests
Change-Id: Ib9be6a5fb6c35ffc450e41cb2a5688bfb2c8d01a
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index 8ac8dfc..3cc8e94 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -2300,6 +2300,9 @@
std::shared_ptr<FakePointerController> mFakePointerController;
void SetUp() override {
+#if !defined(__ANDROID__)
+ GTEST_SKIP();
+#endif
mFakePolicy = sp<FakeInputReaderPolicy>::make();
mFakePointerController = std::make_shared<FakePointerController>();
mFakePolicy->setPointerController(mFakePointerController);
@@ -2318,6 +2321,9 @@
}
void TearDown() override {
+#if !defined(__ANDROID__)
+ return;
+#endif
ASSERT_EQ(mReader->stop(), OK);
mReader.reset();
mTestListener.reset();
@@ -2432,6 +2438,9 @@
const std::string UNIQUE_ID = "local:0";
void SetUp() override {
+#if !defined(__ANDROID__)
+ GTEST_SKIP();
+#endif
InputReaderIntegrationTest::SetUp();
// At least add an internal display.
setDisplayInfoAndReconfigure(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT,