Loading services/inputflinger/tests/FakeInputReaderPolicy.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "FakeInputReaderPolicy.h" #include <android-base/properties.h> #include <android-base/thread_annotations.h> #include <gtest/gtest.h> Loading @@ -24,6 +25,12 @@ namespace android { namespace { static const int HW_TIMEOUT_MULTIPLIER = base::GetIntProperty("ro.hw_timeout_multiplier", 1); } // namespace void FakeInputReaderPolicy::assertInputDevicesChanged() { waitForInputDevices([](bool devicesChanged) { if (!devicesChanged) { Loading Loading @@ -241,7 +248,9 @@ void FakeInputReaderPolicy::waitForInputDevices(std::function<void(bool)> proces base::ScopedLockAssertion assumeLocked(mLock); const bool devicesChanged = mDevicesChangedCondition.wait_for(lock, WAIT_TIMEOUT, [this]() REQUIRES(mLock) { mDevicesChangedCondition.wait_for(lock, ADD_INPUT_DEVICE_TIMEOUT * HW_TIMEOUT_MULTIPLIER, [this]() REQUIRES(mLock) { return mInputDevicesChanged; }); ASSERT_NO_FATAL_FAILURE(processDevicesChanged(devicesChanged)); Loading services/inputflinger/tests/TestConstants.h +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ namespace android { using std::chrono_literals::operator""ms; // Timeout for waiting for an input device to be added and processed static constexpr std::chrono::duration ADD_INPUT_DEVICE_TIMEOUT = 500ms; // Timeout for waiting for an expected event static constexpr std::chrono::duration WAIT_TIMEOUT = 100ms; Loading Loading
services/inputflinger/tests/FakeInputReaderPolicy.cpp +12 −3 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ #include "FakeInputReaderPolicy.h" #include <android-base/properties.h> #include <android-base/thread_annotations.h> #include <gtest/gtest.h> Loading @@ -24,6 +25,12 @@ namespace android { namespace { static const int HW_TIMEOUT_MULTIPLIER = base::GetIntProperty("ro.hw_timeout_multiplier", 1); } // namespace void FakeInputReaderPolicy::assertInputDevicesChanged() { waitForInputDevices([](bool devicesChanged) { if (!devicesChanged) { Loading Loading @@ -241,7 +248,9 @@ void FakeInputReaderPolicy::waitForInputDevices(std::function<void(bool)> proces base::ScopedLockAssertion assumeLocked(mLock); const bool devicesChanged = mDevicesChangedCondition.wait_for(lock, WAIT_TIMEOUT, [this]() REQUIRES(mLock) { mDevicesChangedCondition.wait_for(lock, ADD_INPUT_DEVICE_TIMEOUT * HW_TIMEOUT_MULTIPLIER, [this]() REQUIRES(mLock) { return mInputDevicesChanged; }); ASSERT_NO_FATAL_FAILURE(processDevicesChanged(devicesChanged)); Loading
services/inputflinger/tests/TestConstants.h +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ namespace android { using std::chrono_literals::operator""ms; // Timeout for waiting for an input device to be added and processed static constexpr std::chrono::duration ADD_INPUT_DEVICE_TIMEOUT = 500ms; // Timeout for waiting for an expected event static constexpr std::chrono::duration WAIT_TIMEOUT = 100ms; Loading