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

Commit 364cd8f4 authored by Nataniel Borges's avatar Nataniel Borges Committed by Android (Google) Code Review
Browse files

Merge "Fix close IME auto open tests"

parents b445e8e1 9c3bb878
Loading
Loading
Loading
Loading
+41 −7
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
package com.android.server.wm.flicker.ime

import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
import androidx.test.filters.FlakyTest
import androidx.test.filters.RequiresDevice
@@ -37,7 +39,6 @@ import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.statusBarLayerRotatesScales
import com.android.server.wm.flicker.statusBarWindowIsAlwaysVisible
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.FixMethodOrder
import org.junit.Test
import org.junit.runner.RunWith
@@ -46,6 +47,14 @@ import org.junit.runners.Parameterized

/**
 * Test IME window closing back to app window transitions.
 *
 * This test doesn't work on 90 degrees. According to the InputMethodService documentation:
 *
 *     Don't show if this is not explicitly requested by the user and the input method
 *     is fullscreen. That would be too disruptive.
 *
 * More details on b/190352379
 *
 * To run this test: `atest FlickerTests:CloseImeAutoOpenWindowToAppTest`
 */
@RequiresDevice
@@ -89,15 +98,17 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
    @Test
    fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
        testSpec.assertWm {
            this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE,
                WindowManagerStateHelper.SPLASH_SCREEN_NAME,
                WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME))
            this.visibleWindowsShownMoreThanOneConsecutiveEntry()
        }
    }

    @Presubmit
    @Test
    fun imeAppWindowIsAlwaysVisible() = testSpec.imeAppWindowIsAlwaysVisible(testApp)
    fun imeAppWindowIsAlwaysVisible() {
        testSpec.assertWm {
            this.showsAppWindowOnTop(testApp.getPackage())
        }
    }

    @Presubmit
    @Test
@@ -111,13 +122,33 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
    @Test
    fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation)

    @Postsubmit
    @Test
    fun imeLayerVisibleStart() {
        testSpec.assertLayersStart {
            this.isVisible(IME_LAYER_TITLE)
        }
    }

    @Postsubmit
    @Test
    fun imeLayerInvisibleEnd() {
        testSpec.assertLayersEnd {
            this.isInvisible(IME_LAYER_TITLE)
        }
    }

    @Presubmit
    @Test
    fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()

    @Presubmit
    @Test
    fun imeAppLayerIsAlwaysVisible() = testSpec.imeAppLayerIsAlwaysVisible(testApp)
    fun imeAppLayerIsAlwaysVisible() {
        testSpec.assertLayers {
            this.isVisible(testApp.getPackage())
        }
    }

    @FlakyTest
    @Test
@@ -145,8 +176,11 @@ class CloseImeAutoOpenWindowToAppTest(private val testSpec: FlickerTestParameter
        fun getParams(): Collection<FlickerTestParameter> {
            return FlickerTestParameterFactory.getInstance()
                .getConfigNonRotationTests(repetitions = 5,
                    // b/190352379 (IME doesn't show on app launch in 90 degrees)
                    supportedRotations = listOf(Surface.ROTATION_0),
                    supportedNavigationModes = listOf(
                        WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY)
                        WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
                        WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
                )
        }
    }
+46 −12
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.server.wm.flicker.ime

import android.app.Instrumentation
import android.platform.test.annotations.Postsubmit
import android.platform.test.annotations.Presubmit
import android.view.Surface
import android.view.WindowManagerPolicyConstants
@@ -47,6 +48,14 @@ import org.junit.runners.Parameterized

/**
 * Test IME window closing back to app window transitions.
 *
 * This test doesn't work on 90 degrees. According to the InputMethodService documentation:
 *
 *     Don't show if this is not explicitly requested by the user and the input method
 *     is fullscreen. That would be too disruptive.
 *
 * More details on b/190352379
 *
 * To run this test: `atest FlickerTests:CloseImeAutoOpenWindowToHomeTest`
 */
@RequiresDevice
@@ -92,32 +101,54 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
    @Test
    fun visibleWindowsShownMoreThanOneConsecutiveEntry() {
        testSpec.assertWm {
            this.visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE,
                WindowManagerStateHelper.SPLASH_SCREEN_NAME,
                WindowManagerStateHelper.SNAPSHOT_WINDOW_NAME))
            this.visibleWindowsShownMoreThanOneConsecutiveEntry()
        }
    }

    @FlakyTest
    @Test
    fun imeWindowBecomesInvisible() = testSpec.imeWindowBecomesInvisible()

    @FlakyTest
    @FlakyTest(bugId = 190189685)
    @Test
    fun imeAppWindowBecomesInvisible() = testSpec.imeAppWindowBecomesInvisible(testApp)
    fun imeAppWindowBecomesInvisible() {
        testSpec.assertWm {
            this.showsAppWindowOnTop(testApp.getPackage())
                .then()
                .appWindowNotOnTop(testApp.getPackage())
        }
    }

    @Presubmit
    @Test
    fun noUncoveredRegions() = testSpec.noUncoveredRegions(testSpec.config.startRotation,
        Surface.ROTATION_0)

    @FlakyTest
    @Postsubmit
    @Test
    fun imeLayerVisibleStart() {
        testSpec.assertLayersStart {
            this.isVisible(IME_LAYER_TITLE)
        }
    }

    @Postsubmit
    @Test
    fun imeLayerInvisibleEnd() {
        testSpec.assertLayersEnd {
            this.isInvisible(IME_LAYER_TITLE)
        }
    }

    @Postsubmit
    @Test
    fun imeLayerBecomesInvisible() = testSpec.imeLayerBecomesInvisible()

    @Presubmit
    @Test
    fun imeAppLayerBecomesInvisible() = testSpec.imeAppLayerBecomesInvisible(testApp)
    fun imeAppLayerBecomesInvisible() {
        testSpec.assertLayers {
            this.isVisible(testApp.getPackage())
                .then()
                .isInvisible(testApp.getPackage())
        }
    }

    @FlakyTest
    @Test
@@ -154,8 +185,11 @@ class CloseImeAutoOpenWindowToHomeTest(private val testSpec: FlickerTestParamete
        fun getParams(): Collection<FlickerTestParameter> {
            return FlickerTestParameterFactory.getInstance()
                .getConfigNonRotationTests(repetitions = 1,
                    // b/190352379 (IME doesn't show on app launch in 90 degrees)
                    supportedRotations = listOf(Surface.ROTATION_0),
                    supportedNavigationModes = listOf(
                        WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY)
                        WindowManagerPolicyConstants.NAV_BAR_MODE_3BUTTON_OVERLAY,
                        WindowManagerPolicyConstants.NAV_BAR_MODE_GESTURAL_OVERLAY)
                )
        }
    }
+5 −4
Original line number Diff line number Diff line
@@ -20,20 +20,21 @@ import android.platform.helpers.IAppHelper
import com.android.server.wm.flicker.FlickerTestParameter

const val IME_WINDOW_TITLE = "InputMethod"
const val IME_LAYER_TITLE = "$IME_WINDOW_TITLE#0"

fun FlickerTestParameter.imeLayerBecomesVisible() {
    assertLayers {
        this.isInvisible(IME_WINDOW_TITLE)
        this.isInvisible(IME_LAYER_TITLE)
            .then()
            .isVisible(IME_WINDOW_TITLE)
            .isVisible(IME_LAYER_TITLE)
    }
}

fun FlickerTestParameter.imeLayerBecomesInvisible() {
    assertLayers {
        this.isVisible(IME_WINDOW_TITLE)
        this.isVisible(IME_LAYER_TITLE)
            .then()
            .isInvisible(IME_WINDOW_TITLE)
            .isInvisible(IME_LAYER_TITLE)
    }
}