[Tests] Clear MAIN_EXECUTOR in

NavHandleLongPressInputConsumerTest#tearDown

Attempt at fixing flaky tests

Bug: b/359911511,b/355232772
Flag: EXEMPT Test change
Test: NavHandleLongPressInputConsumerTest
Change-Id: I8ea91f732e91b1a7df4b2e2816dc70e35f14d504
This commit is contained in:
Kevin Lim
2024-10-15 18:32:35 +00:00
parent bb87ff95e8
commit f36375d907

View File

@@ -92,14 +92,15 @@ public class NavHandleLongPressInputConsumerTest {
when(mTopTaskTracker.getCachedTopTask(anyBoolean())).thenReturn(mTaskInfo);
when(mDeviceState.getSquaredTouchSlop()).thenReturn(SQUARED_TOUCH_SLOP);
when(mDelegate.allowInterceptByParent()).thenReturn(true);
MAIN_EXECUTOR.getHandler().removeCallbacks(mLongPressRunnable);
mLongPressTriggered.set(false);
when(mNavHandleLongPressHandler.getLongPressRunnable(any())).thenReturn(mLongPressRunnable);
initializeObjectUnderTest();
}
@After
public void tearDown() {
public void tearDown() throws Exception {
MAIN_EXECUTOR.getHandler().removeCallbacks(mLongPressRunnable);
MAIN_EXECUTOR.submit(() -> null).get();
mContext.onDestroy();
}