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

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

Merge "Fix check for task bar assertions on OpenAppFromNotificationWarm"

parents 6817789e 8fb9fdfc
Loading
Loading
Loading
Loading
+53 −23
Original line number Diff line number Diff line
@@ -20,10 +20,10 @@ package com.android.server.wm.flicker
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.region.RegionSubject
import com.android.server.wm.traces.common.ComponentNameMatcher
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.common.IComponentNameMatcher

/**
 * Checks that [ComponentMatcher.STATUS_BAR] window is visible and above the app windows in
 * Checks that [ComponentNameMatcher.STATUS_BAR] window is visible and above the app windows in
 * all WM trace entries
 */
fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() {
@@ -33,7 +33,7 @@ fun FlickerTestParameter.statusBarWindowIsAlwaysVisible() {
}

/**
 * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows in
 * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows in
 * all WM trace entries
 */
fun FlickerTestParameter.navBarWindowIsAlwaysVisible() {
@@ -43,20 +43,36 @@ fun FlickerTestParameter.navBarWindowIsAlwaysVisible() {
}

/**
 * Checks that [ComponentMatcher.NAV_BAR] window is visible and above the app windows at the start
 * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
 * and end of the WM trace
 */
fun FlickerTestParameter.navBarWindowIsVisibleAtStartAndEnd() {
    this.navBarWindowIsVisibleAtStart()
    this.navBarWindowIsVisibleAtEnd()
}

/**
 * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the start
 * of the WM trace
 */
fun FlickerTestParameter.navBarWindowIsVisibleAtStart() {
    assertWmStart {
        this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
    }
}

/**
 * Checks that [ComponentNameMatcher.NAV_BAR] window is visible and above the app windows at the
 * end of the WM trace
 */
fun FlickerTestParameter.navBarWindowIsVisibleAtEnd() {
    assertWmEnd {
        this.isAboveAppWindowVisible(ComponentNameMatcher.NAV_BAR)
    }
}

/**
 * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in
 * Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
 * all WM trace entries
 */
fun FlickerTestParameter.taskBarWindowIsAlwaysVisible() {
@@ -66,7 +82,7 @@ fun FlickerTestParameter.taskBarWindowIsAlwaysVisible() {
}

/**
 * Checks that [ComponentMatcher.TASK_BAR] window is visible and above the app windows in
 * Checks that [ComponentNameMatcher.TASK_BAR] window is visible and above the app windows in
 * all WM trace entries
 */
fun FlickerTestParameter.taskBarWindowIsVisibleAtEnd() {
@@ -109,20 +125,34 @@ fun FlickerTestParameter.entireScreenCovered(allStates: Boolean = true) {
}

/**
 * Checks that [ComponentMatcher.NAV_BAR] layer is visible at the start and end of the SF
 * trace
 * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start of the SF trace
 */
fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
fun FlickerTestParameter.navBarLayerIsVisibleAtStart() {
    assertLayersStart {
        this.isVisible(ComponentNameMatcher.NAV_BAR)
    }
}

/**
 * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the end of the SF trace
 */
fun FlickerTestParameter.navBarLayerIsVisibleAtEnd() {
    assertLayersEnd {
        this.isVisible(ComponentNameMatcher.NAV_BAR)
    }
}

/**
 * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the start and end of the SF
 * Checks that [ComponentNameMatcher.NAV_BAR] layer is visible at the start and end of the SF
 * trace
 */
fun FlickerTestParameter.navBarLayerIsVisibleAtStartAndEnd() {
    this.navBarLayerIsVisibleAtStart()
    this.navBarLayerIsVisibleAtEnd()
}

/**
 * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start and end of the SF
 * trace
 */
fun FlickerTestParameter.taskBarLayerIsVisibleAtStartAndEnd() {
@@ -131,7 +161,7 @@ fun FlickerTestParameter.taskBarLayerIsVisibleAtStartAndEnd() {
}

/**
 * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the start of the SF
 * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the start of the SF
 * trace
 */
fun FlickerTestParameter.taskBarLayerIsVisibleAtStart() {
@@ -141,7 +171,7 @@ fun FlickerTestParameter.taskBarLayerIsVisibleAtStart() {
}

/**
 * Checks that [ComponentMatcher.TASK_BAR] layer is visible at the end of the SF
 * Checks that [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the SF
 * trace
 */
fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() {
@@ -151,7 +181,7 @@ fun FlickerTestParameter.taskBarLayerIsVisibleAtEnd() {
}

/**
 * Checks that [ComponentMatcher.STATUS_BAR] layer is visible at the start and end of the SF
 * Checks that [ComponentNameMatcher.STATUS_BAR] layer is visible at the start and end of the SF
 * trace
 */
fun FlickerTestParameter.statusBarLayerIsVisibleAtStartAndEnd() {
@@ -164,7 +194,7 @@ fun FlickerTestParameter.statusBarLayerIsVisibleAtStartAndEnd() {
}

/**
 * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
 * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
 * of the SF trace
 */
fun FlickerTestParameter.navBarLayerPositionAtStart() {
@@ -177,7 +207,7 @@ fun FlickerTestParameter.navBarLayerPositionAtStart() {
}

/**
 * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the end
 * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the end
 * of the SF trace
 */
fun FlickerTestParameter.navBarLayerPositionAtEnd() {
@@ -190,7 +220,7 @@ fun FlickerTestParameter.navBarLayerPositionAtEnd() {
}

/**
 * Asserts that the [ComponentMatcher.NAV_BAR] layer is at the correct position at the start
 * Asserts that the [ComponentNameMatcher.NAV_BAR] layer is at the correct position at the start
 * and end of the SF trace
 */
fun FlickerTestParameter.navBarLayerPositionAtStartAndEnd() {
@@ -199,7 +229,7 @@ fun FlickerTestParameter.navBarLayerPositionAtStartAndEnd() {
}

/**
 * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
 * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the start
 * of the SF trace
 */
fun FlickerTestParameter.statusBarLayerPositionAtStart() {
@@ -212,7 +242,7 @@ fun FlickerTestParameter.statusBarLayerPositionAtStart() {
}

/**
 * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the end
 * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the end
 * of the SF trace
 */
fun FlickerTestParameter.statusBarLayerPositionAtEnd() {
@@ -225,7 +255,7 @@ fun FlickerTestParameter.statusBarLayerPositionAtEnd() {
}

/**
 * Asserts that the [ComponentMatcher.STATUS_BAR] layer is at the correct position at the start
 * Asserts that the [ComponentNameMatcher.STATUS_BAR] layer is at the correct position at the start
 * and end of the SF trace
 */
fun FlickerTestParameter.statusBarLayerPositionAtStartAndEnd() {
@@ -234,11 +264,11 @@ fun FlickerTestParameter.statusBarLayerPositionAtStartAndEnd() {
}

/**
 * Asserts that the visibleRegion of the [ComponentMatcher.SNAPSHOT] layer can cover
 * Asserts that the visibleRegion of the [ComponentNameMatcher.SNAPSHOT] layer can cover
 * the visibleRegion of the given app component exactly
 */
fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
    component: IComponentMatcher
    component: IComponentNameMatcher
) {
    assertLayers {
        invoke("snapshotStartingWindowLayerCoversExactlyOnApp") {
@@ -281,8 +311,8 @@ fun FlickerTestParameter.snapshotStartingWindowLayerCoversExactlyOnApp(
 *      otherwise we won't and the layer must appear immediately.
 */
fun FlickerTestParameter.replacesLayer(
    originalLayer: IComponentMatcher,
    newLayer: IComponentMatcher,
    originalLayer: IComponentNameMatcher,
    newLayer: IComponentNameMatcher,
    ignoreEntriesWithRotationLayer: Boolean = false,
    ignoreSnapshot: Boolean = false,
    ignoreSplashscreen: Boolean = true
+19 −7
Original line number Diff line number Diff line
@@ -25,7 +25,9 @@ import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.annotation.Group1
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.server.wm.flicker.navBarLayerIsVisibleAtEnd
import com.android.server.wm.flicker.navBarLayerPositionAtEnd
import com.android.server.wm.flicker.navBarWindowIsVisibleAtEnd
import com.android.server.wm.flicker.statusBarLayerPositionAtEnd
import com.android.server.wm.traces.common.ComponentNameMatcher
import org.junit.Assume
@@ -100,8 +102,8 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
    @Test
    @Postsubmit
    fun screenLockedStart() {
        testSpec.assertLayersStart {
            isEmpty()
        testSpec.assertWmStart {
            isKeyguardShowing()
        }
    }

@@ -118,11 +120,11 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :

    /** {@inheritDoc} */
    @Test
    @Ignore("Not applicable to this CUJ. Display starts off and app is full screen at the end")
    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
    override fun navBarLayerPositionAtStartAndEnd() { }

    /**
     * Checks the position of the [ComponentMatcher.NAV_BAR] at the end of the transition
     * Checks the position of the [ComponentNameMatcher.NAV_BAR] at the end of the transition
     */
    @Postsubmit
    @Test
@@ -137,7 +139,7 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
    override fun statusBarLayerPositionAtStartAndEnd() { }

    /**
     * Checks the position of the [ComponentMatcher.STATUS_BAR] at the start and end of the
     * Checks the position of the [ComponentNameMatcher.STATUS_BAR] at the start and end of the
     * transition
     */
    @Postsubmit
@@ -145,15 +147,25 @@ open class OpenAppFromLockNotificationWarm(testSpec: FlickerTestParameter) :
    fun statusBarLayerPositionEnd() = testSpec.statusBarLayerPositionAtEnd()

    /** {@inheritDoc} */
    @Postsubmit
    @Test
    override fun navBarLayerIsVisibleAtStartAndEnd() = super.navBarLayerIsVisibleAtStartAndEnd()
    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
    override fun navBarLayerIsVisibleAtStartAndEnd() =
        super.navBarLayerIsVisibleAtStartAndEnd()

    /** {@inheritDoc} */
    @Postsubmit
    @Test
    fun navBarLayerIsVisibleAtEnd() = testSpec.navBarLayerIsVisibleAtEnd()

    /** {@inheritDoc} */
    @Test
    @Ignore("Not applicable to this CUJ. Display starts locked and app is full screen at the end")
    override fun navBarWindowIsAlwaysVisible() = super.navBarWindowIsAlwaysVisible()

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

    /** {@inheritDoc} */
    @Postsubmit
    @Test
+7 −4
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.server.wm.flicker.helpers.setRotation
import com.android.server.wm.flicker.helpers.wakeUpAndGoToHomeScreen
import com.android.server.wm.flicker.taskBarLayerIsVisibleAtEnd
import com.android.server.wm.flicker.taskBarWindowIsVisibleAtEnd
import com.android.server.wm.traces.common.ComponentNameMatcher
import org.junit.Assume
import org.junit.FixMethodOrder
import org.junit.Ignore
@@ -235,26 +236,28 @@ open class OpenAppFromNotificationWarm(
    }

    /**
     * Checks that the [ComponentMatcher.TASK_BAR] window is visible at the end of the transition
     * Checks that the [ComponentNameMatcher.TASK_BAR] window is visible at the end of the
     * transition
     *
     * Note: Large screen only
     */
    @Postsubmit
    @Test
    open fun taskBarWindowIsVisibleAtEnd() {
        Assume.assumeFalse(testSpec.isTablet)
        Assume.assumeTrue(testSpec.isTablet)
        testSpec.taskBarWindowIsVisibleAtEnd()
    }

    /**
     * Checks that the [ComponentMatcher.TASK_BAR] layer is visible at the end of the transition
     * Checks that the [ComponentNameMatcher.TASK_BAR] layer is visible at the end of the
     * transition
     *
     * Note: Large screen only
     */
    @Postsubmit
    @Test
    open fun taskBarLayerIsVisibleAtEnd() {
        Assume.assumeFalse(testSpec.isTablet)
        Assume.assumeTrue(testSpec.isTablet)
        testSpec.taskBarLayerIsVisibleAtEnd()
    }