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

Commit f17e9aeb authored by Antonella Dellanzo's avatar Antonella Dellanzo Committed by Android (Google) Code Review
Browse files

Merge "Updating IME tests"

parents c70f1a8a b1e55c28
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -48,11 +48,12 @@ fun WmAssertion.navBarWindowIsAlwaysVisible(
}

fun WmAssertion.visibleWindowsShownMoreThanOneConsecutiveEntry(
    ignoreWindows: List<String> = emptyList(),
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
    all("visibleWindowShownMoreThanOneConsecutiveEntry", bugId, enabled) {
        this.visibleWindowsShownMoreThanOneConsecutiveEntry()
    all("visibleWindowsShownMoreThanOneConsecutiveEntry", bugId, enabled) {
        this.visibleWindowsShownMoreThanOneConsecutiveEntry(ignoreWindows)
    }
}

@@ -204,11 +205,12 @@ fun LayersAssertion.statusBarLayerRotatesScales(
}

fun LayersAssertion.visibleLayersShownMoreThanOneConsecutiveEntry(
    ignoreLayers: List<String> = emptyList(),
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
    all("visibleLayersShownMoreThanOneConsecutiveEntry", bugId, enabled) {
        this.visibleLayersShownMoreThanOneConsecutiveEntry()
        this.visibleLayersShownMoreThanOneConsecutiveEntry(ignoreLayers)
    }
}

+5 −2
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.support.test.launcherhelper.LauncherStrategyFactory
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import com.android.server.wm.traces.parser.windowmanager.WindowManagerStateHelper
import org.junit.Assert

open class ImeAppHelper(
@@ -38,7 +39,7 @@ open class ImeAppHelper(
        Assert.assertNotNull("Text field not found, this usually happens when the device " +
                "was left in an unknown state (e.g. in split screen)", editText)
        editText.click()
        if (!device.waitForIME()) {
        if (!WindowManagerStateHelper().waitImeWindowShown()) {
            Assert.fail("IME did not appear")
        }
    }
@@ -46,6 +47,8 @@ open class ImeAppHelper(
    open fun closeIME(device: UiDevice) {
        device.pressBack()
        // Using only the AccessibilityInfo it is not possible to identify if the IME is active
        device.waitForIdle(1000)
        if (!WindowManagerStateHelper().waitImeWindowGone()) {
            Assert.fail("IME did not close")
        }
    }
}
 No newline at end of file
+12 −5
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
@@ -66,8 +68,10 @@ class CloseImeAutoOpenWindowToAppTest(
                    withTag { buildTestTag("imeToAppAutoOpen", testApp, configuration) }
                    repeat { configuration.repetitions }
                    setup {
                        eachRun {
                        test {
                            device.wakeUpAndGoToHomeScreen()
                        }
                        eachRun {
                            this.setRotation(configuration.startRotation)
                            testApp.open()
                            testApp.openIME(device)
@@ -80,14 +84,15 @@ class CloseImeAutoOpenWindowToAppTest(
                        }
                    }
                    transitions {
                        device.pressBack()
                        device.waitForIdle()
                        testApp.closeIME(device)
                    }
                    assertions {
                        windowManagerTrace {
                            navBarWindowIsAlwaysVisible()
                            statusBarWindowIsAlwaysVisible()
                            imeAppWindowIsAlwaysVisible(testApp, bugId = 141458352)
                            visibleWindowsShownMoreThanOneConsecutiveEntry(listOf("InputMethod"))

                            imeAppWindowIsAlwaysVisible(testApp)
                        }

                        layersTrace {
@@ -96,8 +101,10 @@ class CloseImeAutoOpenWindowToAppTest(
                            noUncoveredRegions(configuration.startRotation)
                            navBarLayerRotatesAndScales(configuration.startRotation)
                            statusBarLayerRotatesScales(configuration.startRotation)
                            visibleLayersShownMoreThanOneConsecutiveEntry()

                            imeLayerBecomesInvisible(bugId = 141458352)
                            imeAppLayerIsAlwaysVisible(testApp, bugId = 141458352)
                            imeAppLayerIsAlwaysVisible(testApp)
                        }
                    }
                }
+14 −4
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ import com.android.server.wm.flicker.helpers.ImeAppAutoFocusHelper
import com.android.server.wm.flicker.helpers.buildTestTag
import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
@@ -68,8 +70,10 @@ class CloseImeAutoOpenWindowToHomeTest(
                    }
                    repeat { configuration.repetitions }
                    setup {
                        eachRun {
                        test {
                            device.wakeUpAndGoToHomeScreen()
                        }
                        eachRun {
                            this.setRotation(configuration.startRotation)
                            testApp.open()
                            testApp.openIME(device)
@@ -89,6 +93,8 @@ class CloseImeAutoOpenWindowToHomeTest(
                        windowManagerTrace {
                            navBarWindowIsAlwaysVisible()
                            statusBarWindowIsAlwaysVisible()
                            visibleWindowsShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))

                            imeWindowBecomesInvisible(bugId = 141458352)
                            imeAppWindowBecomesInvisible(testApp, bugId = 157449248)
                        }
@@ -100,10 +106,14 @@ class CloseImeAutoOpenWindowToHomeTest(
                                Surface.ROTATION_0, bugId = 140855415)
                            statusBarLayerRotatesScales(configuration.startRotation,
                                Surface.ROTATION_0)
                            navBarLayerIsAlwaysVisible(enabled = false)
                            statusBarLayerIsAlwaysVisible(enabled = false)
                            navBarLayerIsAlwaysVisible(
                                    enabled = Surface.ROTATION_0 == configuration.startRotation)
                            statusBarLayerIsAlwaysVisible(
                                    enabled = Surface.ROTATION_0 == configuration.startRotation)
                            visibleLayersShownMoreThanOneConsecutiveEntry(listOf(IME_WINDOW_TITLE))

                            imeLayerBecomesInvisible(bugId = 141458352)
                            imeAppLayerBecomesInvisible(testApp, bugId = 153739621)
                            imeAppLayerBecomesInvisible(testApp)
                        }
                    }
                }
+10 −3
Original line number Diff line number Diff line
@@ -31,6 +31,8 @@ import com.android.server.wm.flicker.navBarLayerIsAlwaysVisible
import com.android.server.wm.flicker.navBarLayerRotatesAndScales
import com.android.server.wm.flicker.navBarWindowIsAlwaysVisible
import com.android.server.wm.flicker.noUncoveredRegions
import com.android.server.wm.flicker.visibleWindowsShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.visibleLayersShownMoreThanOneConsecutiveEntry
import com.android.server.wm.flicker.repetitions
import com.android.server.wm.flicker.startRotation
import com.android.server.wm.flicker.statusBarLayerIsAlwaysVisible
@@ -65,8 +67,10 @@ class CloseImeWindowToAppTest(
                    withTestName { buildTestTag("imeToApp", testApp, configuration) }
                    repeat { configuration.repetitions }
                    setup {
                        eachRun {
                        test {
                            device.wakeUpAndGoToHomeScreen()
                        }
                        eachRun {
                            this.setRotation(configuration.startRotation)
                            testApp.open()
                            testApp.openIME(device)
@@ -79,13 +83,14 @@ class CloseImeWindowToAppTest(
                        }
                    }
                    transitions {
                        device.pressBack()
                        device.waitForIdle()
                        testApp.closeIME(device)
                    }
                    assertions {
                        windowManagerTrace {
                            navBarWindowIsAlwaysVisible()
                            statusBarWindowIsAlwaysVisible()
                            visibleWindowsShownMoreThanOneConsecutiveEntry(listOf("InputMethod"))

                            imeAppWindowIsAlwaysVisible(testApp)
                        }

@@ -95,6 +100,8 @@ class CloseImeWindowToAppTest(
                            noUncoveredRegions(configuration.startRotation)
                            navBarLayerRotatesAndScales(configuration.startRotation)
                            statusBarLayerRotatesScales(configuration.startRotation)
                            visibleLayersShownMoreThanOneConsecutiveEntry()

                            imeLayerBecomesInvisible(enabled = false)
                            imeAppLayerIsAlwaysVisible(testApp)
                        }
Loading