Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1c494c5d authored by Siarhei Vishniakou's avatar Siarhei Vishniakou
Browse files

Use multiplied timeout for tests

Currently, the timeout value is hardcoded. But this poses a problem for
setups where the timeout is different from the default value.

One such example is hwasan. It turns out that, likely recently, the hw
multiplier was set to 2 for hwasan builds. This causes the
inputflinger_tests to fail on hwasan platforms.

To fix this, use the same timeout that InputDispatcher uses.

Bug: none
Test: atest inputflinger_tests
Change-Id: Ibf752d90d03765bbf6ed2b6d9c10e8783c9f3564
parent d6a8b266
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include "../dispatcher/InputDispatcher.h"

#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/thread_annotations.h>
#include <binder/Binder.h>
@@ -678,7 +679,11 @@ TEST_F(InputDispatcherTest, NotifySwitch_CallsPolicy) {

// --- InputDispatcherTest SetInputWindowTest ---
static constexpr std::chrono::duration INJECT_EVENT_TIMEOUT = 500ms;
static constexpr std::chrono::nanoseconds DISPATCHING_TIMEOUT = 5s;
// Default input dispatching timeout if there is no focused application or paused window
// from which to determine an appropriate dispatching timeout.
static const std::chrono::duration DISPATCHING_TIMEOUT = std::chrono::milliseconds(
        android::os::IInputConstants::UNMULTIPLIED_DEFAULT_DISPATCHING_TIMEOUT_MILLIS *
        android::base::HwTimeoutMultiplier());

class FakeApplicationHandle : public InputApplicationHandle {
public: