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

Commit 60145b3b authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Extract FreeformTaskTransitionStarter into a member variable" into main

parents 1d2177bf 92589b13
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -166,6 +166,7 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() {
    private val bgExecutor = TestShellExecutor()
    @Mock private lateinit var mockMultiInstanceHelper: MultiInstanceHelper
    @Mock private lateinit var mockTasksLimiter: DesktopTasksLimiter
    @Mock private lateinit var mockFreeformTaskTransitionStarter: FreeformTaskTransitionStarter
    private lateinit var spyContext: TestableContext

    private val transactionFactory = Supplier<SurfaceControl.Transaction> {
@@ -350,9 +351,8 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() {
        val inputManager = mock(InputManager::class.java)
        spyContext.addMockSystemService(InputManager::class.java, inputManager)

        val freeformTaskTransitionStarter = mock(FreeformTaskTransitionStarter::class.java)
        desktopModeWindowDecorViewModel
                .setFreeformTaskTransitionStarter(freeformTaskTransitionStarter)
                .setFreeformTaskTransitionStarter(mockFreeformTaskTransitionStarter)

        onClickListener.onClick(view)

@@ -375,14 +375,13 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() {
        val view = mock(View::class.java)
        whenever(view.id).thenReturn(R.id.close_window)

        val freeformTaskTransitionStarter = mock(FreeformTaskTransitionStarter::class.java)
        desktopModeWindowDecorViewModel
            .setFreeformTaskTransitionStarter(freeformTaskTransitionStarter)
            .setFreeformTaskTransitionStarter(mockFreeformTaskTransitionStarter)

        onClickListenerCaptor.value.onClick(view)

        val transactionCaptor = argumentCaptor<WindowContainerTransaction>()
        verify(freeformTaskTransitionStarter).startRemoveTransition(transactionCaptor.capture())
        verify(mockFreeformTaskTransitionStarter).startRemoveTransition(transactionCaptor.capture())
        val wct = transactionCaptor.firstValue

        assertEquals(1, wct.getHierarchyOps().size)
@@ -404,14 +403,13 @@ class DesktopModeWindowDecorViewModelTests : ShellTestCase() {
        val view = mock(View::class.java)
        whenever(view.id).thenReturn(R.id.minimize_window)

        val freeformTaskTransitionStarter = mock(FreeformTaskTransitionStarter::class.java)
        desktopModeWindowDecorViewModel
            .setFreeformTaskTransitionStarter(freeformTaskTransitionStarter)
            .setFreeformTaskTransitionStarter(mockFreeformTaskTransitionStarter)

        onClickListenerCaptor.value.onClick(view)

        val transactionCaptor = argumentCaptor<WindowContainerTransaction>()
        verify(freeformTaskTransitionStarter)
        verify(mockFreeformTaskTransitionStarter)
            .startMinimizedModeTransition(transactionCaptor.capture())
        val wct = transactionCaptor.firstValue