Have recreateTaskbar perform recreate on UiThread.

Test: Taskbar{AllApps,Overlay}ControllerTest
Bug: 230027385
Flag: TEST_ONLY
Change-Id: I663e5ad7bb37e73381e2ef9d787c80177cfdf7a7
This commit is contained in:
Brian Isganitis
2024-06-26 14:50:54 -04:00
parent e7e98985f7
commit c2bb120a87
3 changed files with 5 additions and 5 deletions

View File

@@ -65,9 +65,8 @@ class TaskbarAllAppsControllerTest {
}
@Test
@UiThreadTest
fun testToggle_taskbarRecreated_allAppsReopened() {
allAppsController.toggle()
getInstrumentation().runOnMainSync { allAppsController.toggle() }
taskbarUnitTestRule.recreateTaskbar()
assertThat(allAppsController.isOpen).isTrue()
}

View File

@@ -150,9 +150,10 @@ class TaskbarOverlayControllerTest {
}
@Test
@UiThreadTest
fun testRecreateTaskbar_closesWindow() {
TestOverlayView.show(overlayController.requestWindow())
getInstrumentation().runOnMainSync {
TestOverlayView.show(overlayController.requestWindow())
}
taskbarUnitTestRule.recreateTaskbar()
assertThat(hasOpenView(taskbarContext, TYPE_TASKBAR_OVERLAY_PROXY)).isFalse()
}

View File

@@ -135,7 +135,7 @@ class TaskbarUnitTestRule(private val testInstance: Any, private val context: Co
/** Simulates Taskbar recreation lifecycle. */
fun recreateTaskbar() {
taskbarManager.recreateTaskbar()
instrumentation.runOnMainSync { taskbarManager.recreateTaskbar() }
injectControllers()
}