Fix NoFocusedWindow_DoesNotSendDuplicateAnr test
This test requires that the application timeout be larger than the "no focused window" timeout. But after a recent refactor, this became false - both values were at 100ms. The test should've failed close to 50% of the time, but due to bad luck, failure rate was less, so it wasn't caught earlier. Furthermore, for some reason this failure was not reproducing on host. In this CL, refactor the test to always use half of the app timeout. This will avoid such mistakes in the future. At the same time, we bump up the timeout to have a 100 ms buffer, which was empirically found to be sufficient for most host environments. I also found that we were waiting for the incorrect amount of time. Since the "no focused window" timer starts immediately, this should have been accounted for when asserting the ANR timeout receipt. One negative consequence of this CL is that the test now takes 800 ms to run, but at least it should no longer be flaky. Test: TEST=inputflinger_tests; m $TEST && adb sync data && adb shell -t data/nativetest64/$TEST/$TEST --gtest_filter="*NoFocusedWindow_DoesNotSendDuplicateAnr*" --gtest_repeat=200 --gtest_break_on_failure Bug: 293179353 Change-Id: I00526a0172e14746e77c871182d08c4c3de2e518
Loading
Please register or sign in to comment