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

Commit 536eec33 authored by mpodolian's avatar mpodolian
Browse files

Added DisableFlags annotation for failing test

Also created test that checks the behavior when flag is enabled.

Bug: 435098356
Test: BubbleStackViewTest
Flag: com.android.wm.shell.fix_bubbles_expanded_sysui_flag
Change-Id: I1e08da5e77c5743448f64d3eb340807d478bd198
parent 07d74c4c
Loading
Loading
Loading
Loading
+47 −0
Original line number Diff line number Diff line
@@ -269,6 +269,7 @@ class BubbleStackViewTest {
        }
    }

    @DisableFlags(Flags.FLAG_FIX_BUBBLES_EXPANDED_SYSUI_FLAG)
    @Test
    fun collapseStack_waitsForIme() {
        val bubble = createAndInflateBubble()
@@ -316,6 +317,52 @@ class BubbleStackViewTest {
        }
    }

    @EnableFlags(Flags.FLAG_FIX_BUBBLES_EXPANDED_SYSUI_FLAG)
    @Test
    fun collapseStack_sysUiProxyNotifiedImmediately() {
        val bubble = createAndInflateBubble()

        InstrumentationRegistry.getInstrumentation().runOnMainSync {
            bubbleStackView.addBubble(bubble)
        }

        InstrumentationRegistry.getInstrumentation().waitForIdleSync()
        assertThat(bubbleStackView.bubbleCount).isEqualTo(1)

        positioner.setImeVisible(true, 100)

        InstrumentationRegistry.getInstrumentation().runOnMainSync {
            // simulate a request from the bubble data listener to expand the stack
            bubbleStackView.isExpanded = true
        }

        var onImeHidden = bubbleStackViewManager.onImeHidden
        assertThat(onImeHidden).isNotNull()
        verify(sysuiProxy).onStackExpandChanged(true)
        positioner.setImeVisible(false, 0)
        InstrumentationRegistry.getInstrumentation().runOnMainSync {
            onImeHidden!!.run()
            shellExecutor.flushAll()
        }

        bubbleStackViewManager.onImeHidden = null
        positioner.setImeVisible(true, 100)

        InstrumentationRegistry.getInstrumentation().runOnMainSync {
            // simulate a request from the bubble data listener to collapse the stack
            bubbleStackView.isExpanded = false
        }

        onImeHidden = bubbleStackViewManager.onImeHidden
        assertThat(onImeHidden).isNotNull()
        verify(sysuiProxy).onStackExpandChanged(false)
        positioner.setImeVisible(false, 0)
        InstrumentationRegistry.getInstrumentation().runOnMainSync {
            onImeHidden!!.run()
            shellExecutor.flushAll()
        }
    }

    @Test
    fun expandStack_clearsImeRunnable() {
        val bubble = createAndInflateBubble()