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

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

Merge changes from topic "flicker-refactor-assertion" into udc-qpr-dev

* changes:
  12/Compatibilize with new FlickerTest class package
  2/Rename scenario class
parents ff360361 893f6edd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -19,14 +19,14 @@ package com.android.wm.shell.flicker
import android.app.Instrumentation
import android.tools.device.flicker.junit.FlickerBuilderProvider
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.FlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation

abstract class BaseBenchmarkTest
@JvmOverloads
constructor(
    protected open val flicker: FlickerTest,
    protected open val flicker: LegacyFlickerTest,
    protected val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(),
    protected val tapl: LauncherInstrumentation = LauncherInstrumentation()
) {
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.wm.shell.flicker

import android.app.Instrumentation
import android.tools.common.traces.component.ComponentNameMatcher
import android.tools.device.flicker.legacy.FlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTest
import androidx.test.platform.app.InstrumentationRegistry
import com.android.launcher3.tapl.LauncherInstrumentation

@@ -30,7 +30,7 @@ import com.android.launcher3.tapl.LauncherInstrumentation
abstract class BaseTest
@JvmOverloads
constructor(
    override val flicker: FlickerTest,
    override val flicker: LegacyFlickerTest,
    instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(),
    tapl: LauncherInstrumentation = LauncherInstrumentation()
) : BaseBenchmarkTest(flicker, instrumentation, tapl), ICommonAssertions
+38 −38
Original line number Diff line number Diff line
@@ -23,18 +23,18 @@ import android.tools.common.datatypes.Region
import android.tools.common.flicker.subject.layers.LayerTraceEntrySubject
import android.tools.common.flicker.subject.layers.LayersTraceSubject
import android.tools.common.traces.component.IComponentMatcher
import android.tools.device.flicker.legacy.FlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTest
import android.tools.device.helpers.WindowUtils

fun FlickerTest.appPairsDividerIsVisibleAtEnd() {
fun LegacyFlickerTest.appPairsDividerIsVisibleAtEnd() {
    assertLayersEnd { this.isVisible(APP_PAIR_SPLIT_DIVIDER_COMPONENT) }
}

fun FlickerTest.appPairsDividerIsInvisibleAtEnd() {
fun LegacyFlickerTest.appPairsDividerIsInvisibleAtEnd() {
    assertLayersEnd { this.notContains(APP_PAIR_SPLIT_DIVIDER_COMPONENT) }
}

fun FlickerTest.appPairsDividerBecomesVisible() {
fun LegacyFlickerTest.appPairsDividerBecomesVisible() {
    assertLayers {
        this.isInvisible(DOCKED_STACK_DIVIDER_COMPONENT)
            .then()
@@ -42,7 +42,7 @@ fun FlickerTest.appPairsDividerBecomesVisible() {
    }
}

fun FlickerTest.splitScreenEntered(
fun LegacyFlickerTest.splitScreenEntered(
    component1: IComponentMatcher,
    component2: IComponentMatcher,
    fromOtherApp: Boolean,
@@ -69,7 +69,7 @@ fun FlickerTest.splitScreenEntered(
    splitScreenDividerIsVisibleAtEnd()
}

fun FlickerTest.splitScreenDismissed(
fun LegacyFlickerTest.splitScreenDismissed(
    component1: IComponentMatcher,
    component2: IComponentMatcher,
    toHome: Boolean
@@ -87,27 +87,27 @@ fun FlickerTest.splitScreenDismissed(
    splitScreenDividerIsInvisibleAtEnd()
}

fun FlickerTest.splitScreenDividerIsVisibleAtStart() {
fun LegacyFlickerTest.splitScreenDividerIsVisibleAtStart() {
    assertLayersStart { this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
}

fun FlickerTest.splitScreenDividerIsVisibleAtEnd() {
fun LegacyFlickerTest.splitScreenDividerIsVisibleAtEnd() {
    assertLayersEnd { this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
}

fun FlickerTest.splitScreenDividerIsInvisibleAtStart() {
fun LegacyFlickerTest.splitScreenDividerIsInvisibleAtStart() {
    assertLayersStart { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
}

fun FlickerTest.splitScreenDividerIsInvisibleAtEnd() {
fun LegacyFlickerTest.splitScreenDividerIsInvisibleAtEnd() {
    assertLayersEnd { this.isInvisible(SPLIT_SCREEN_DIVIDER_COMPONENT) }
}

fun FlickerTest.splitScreenDividerBecomesVisible() {
fun LegacyFlickerTest.splitScreenDividerBecomesVisible() {
    layerBecomesVisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
}

fun FlickerTest.splitScreenDividerBecomesInvisible() {
fun LegacyFlickerTest.splitScreenDividerBecomesInvisible() {
    assertLayers {
        this.isVisible(SPLIT_SCREEN_DIVIDER_COMPONENT)
            .then()
@@ -115,23 +115,23 @@ fun FlickerTest.splitScreenDividerBecomesInvisible() {
    }
}

fun FlickerTest.layerBecomesVisible(component: IComponentMatcher) {
fun LegacyFlickerTest.layerBecomesVisible(component: IComponentMatcher) {
    assertLayers { this.isInvisible(component).then().isVisible(component) }
}

fun FlickerTest.layerBecomesInvisible(component: IComponentMatcher) {
fun LegacyFlickerTest.layerBecomesInvisible(component: IComponentMatcher) {
    assertLayers { this.isVisible(component).then().isInvisible(component) }
}

fun FlickerTest.layerIsVisibleAtEnd(component: IComponentMatcher) {
fun LegacyFlickerTest.layerIsVisibleAtEnd(component: IComponentMatcher) {
    assertLayersEnd { this.isVisible(component) }
}

fun FlickerTest.layerKeepVisible(component: IComponentMatcher) {
fun LegacyFlickerTest.layerKeepVisible(component: IComponentMatcher) {
    assertLayers { this.isVisible(component) }
}

fun FlickerTest.splitAppLayerBoundsBecomesVisible(
fun LegacyFlickerTest.splitAppLayerBoundsBecomesVisible(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean
@@ -150,7 +150,7 @@ fun FlickerTest.splitAppLayerBoundsBecomesVisible(
    }
}

fun FlickerTest.splitAppLayerBoundsBecomesVisibleByDrag(component: IComponentMatcher) {
fun LegacyFlickerTest.splitAppLayerBoundsBecomesVisibleByDrag(component: IComponentMatcher) {
    assertLayers {
        this.notContains(SPLIT_SCREEN_DIVIDER_COMPONENT.or(component), isOptional = true)
            .then()
@@ -161,7 +161,7 @@ fun FlickerTest.splitAppLayerBoundsBecomesVisibleByDrag(component: IComponentMat
    }
}

fun FlickerTest.splitAppLayerBoundsBecomesInvisible(
fun LegacyFlickerTest.splitAppLayerBoundsBecomesInvisible(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean
@@ -180,7 +180,7 @@ fun FlickerTest.splitAppLayerBoundsBecomesInvisible(
    }
}

fun FlickerTest.splitAppLayerBoundsIsVisibleAtEnd(
fun LegacyFlickerTest.splitAppLayerBoundsIsVisibleAtEnd(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean
@@ -195,7 +195,7 @@ fun FlickerTest.splitAppLayerBoundsIsVisibleAtEnd(
    }
}

fun FlickerTest.splitAppLayerBoundsKeepVisible(
fun LegacyFlickerTest.splitAppLayerBoundsKeepVisible(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean
@@ -210,7 +210,7 @@ fun FlickerTest.splitAppLayerBoundsKeepVisible(
    }
}

fun FlickerTest.splitAppLayerBoundsChanges(
fun LegacyFlickerTest.splitAppLayerBoundsChanges(
    component: IComponentMatcher,
    landscapePosLeft: Boolean,
    portraitPosTop: Boolean
@@ -304,7 +304,7 @@ fun LayerTraceEntrySubject.splitAppLayerBoundsSnapToDivider(
    }
}

fun FlickerTest.appWindowBecomesVisible(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowBecomesVisible(component: IComponentMatcher) {
    assertWm {
        this.isAppWindowInvisible(component)
            .then()
@@ -316,39 +316,39 @@ fun FlickerTest.appWindowBecomesVisible(component: IComponentMatcher) {
    }
}

fun FlickerTest.appWindowBecomesInvisible(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowBecomesInvisible(component: IComponentMatcher) {
    assertWm { this.isAppWindowVisible(component).then().isAppWindowInvisible(component) }
}

fun FlickerTest.appWindowIsVisibleAtStart(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowIsVisibleAtStart(component: IComponentMatcher) {
    assertWmStart { this.isAppWindowVisible(component) }
}

fun FlickerTest.appWindowIsVisibleAtEnd(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowIsVisibleAtEnd(component: IComponentMatcher) {
    assertWmEnd { this.isAppWindowVisible(component) }
}

fun FlickerTest.appWindowIsInvisibleAtStart(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowIsInvisibleAtStart(component: IComponentMatcher) {
    assertWmStart { this.isAppWindowInvisible(component) }
}

fun FlickerTest.appWindowIsInvisibleAtEnd(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowIsInvisibleAtEnd(component: IComponentMatcher) {
    assertWmEnd { this.isAppWindowInvisible(component) }
}

fun FlickerTest.appWindowIsNotContainAtStart(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowIsNotContainAtStart(component: IComponentMatcher) {
    assertWmStart { this.notContains(component) }
}

fun FlickerTest.appWindowKeepVisible(component: IComponentMatcher) {
fun LegacyFlickerTest.appWindowKeepVisible(component: IComponentMatcher) {
    assertWm { this.isAppWindowVisible(component) }
}

fun FlickerTest.dockedStackDividerIsVisibleAtEnd() {
fun LegacyFlickerTest.dockedStackDividerIsVisibleAtEnd() {
    assertLayersEnd { this.isVisible(DOCKED_STACK_DIVIDER_COMPONENT) }
}

fun FlickerTest.dockedStackDividerBecomesVisible() {
fun LegacyFlickerTest.dockedStackDividerBecomesVisible() {
    assertLayers {
        this.isInvisible(DOCKED_STACK_DIVIDER_COMPONENT)
            .then()
@@ -356,7 +356,7 @@ fun FlickerTest.dockedStackDividerBecomesVisible() {
    }
}

fun FlickerTest.dockedStackDividerBecomesInvisible() {
fun LegacyFlickerTest.dockedStackDividerBecomesInvisible() {
    assertLayers {
        this.isVisible(DOCKED_STACK_DIVIDER_COMPONENT)
            .then()
@@ -364,11 +364,11 @@ fun FlickerTest.dockedStackDividerBecomesInvisible() {
    }
}

fun FlickerTest.dockedStackDividerNotExistsAtEnd() {
fun LegacyFlickerTest.dockedStackDividerNotExistsAtEnd() {
    assertLayersEnd { this.notContains(DOCKED_STACK_DIVIDER_COMPONENT) }
}

fun FlickerTest.appPairsPrimaryBoundsIsVisibleAtEnd(
fun LegacyFlickerTest.appPairsPrimaryBoundsIsVisibleAtEnd(
    rotation: Rotation,
    primaryComponent: IComponentMatcher
) {
@@ -380,7 +380,7 @@ fun FlickerTest.appPairsPrimaryBoundsIsVisibleAtEnd(
    }
}

fun FlickerTest.dockedStackPrimaryBoundsIsVisibleAtEnd(
fun LegacyFlickerTest.dockedStackPrimaryBoundsIsVisibleAtEnd(
    rotation: Rotation,
    primaryComponent: IComponentMatcher
) {
@@ -392,7 +392,7 @@ fun FlickerTest.dockedStackPrimaryBoundsIsVisibleAtEnd(
    }
}

fun FlickerTest.appPairsSecondaryBoundsIsVisibleAtEnd(
fun LegacyFlickerTest.appPairsSecondaryBoundsIsVisibleAtEnd(
    rotation: Rotation,
    secondaryComponent: IComponentMatcher
) {
@@ -404,7 +404,7 @@ fun FlickerTest.appPairsSecondaryBoundsIsVisibleAtEnd(
    }
}

fun FlickerTest.dockedStackSecondaryBoundsIsVisibleAtEnd(
fun LegacyFlickerTest.dockedStackSecondaryBoundsIsVisibleAtEnd(
    rotation: Rotation,
    secondaryComponent: IComponentMatcher
) {
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ package com.android.wm.shell.flicker

import android.platform.test.annotations.Presubmit
import android.tools.common.traces.component.ComponentNameMatcher
import android.tools.device.flicker.legacy.FlickerTest
import android.tools.device.flicker.legacy.LegacyFlickerTest
import com.android.server.wm.flicker.entireScreenCovered
import com.android.server.wm.flicker.navBarLayerIsVisibleAtStartAndEnd
import com.android.server.wm.flicker.navBarLayerPositionAtStartAndEnd
@@ -32,7 +32,7 @@ import org.junit.Assume
import org.junit.Test

interface ICommonAssertions {
    val flicker: FlickerTest
    val flicker: LegacyFlickerTest

    /** Checks that all parts of the screen are covered during the transition */
    @Presubmit @Test fun entireScreenCovered() = flicker.entireScreenCovered()
+11 −13
Original line number Diff line number Diff line
@@ -20,20 +20,20 @@ import android.content.Context
import android.system.helpers.CommandsHelper
import android.tools.common.traces.component.ComponentNameMatcher
import android.tools.device.flicker.legacy.FlickerBuilder
import android.tools.device.flicker.legacy.FlickerTest
import com.android.server.wm.flicker.helpers.setRotation
import android.tools.device.flicker.legacy.FlickerTestData
import android.tools.device.flicker.legacy.LegacyFlickerTest
import com.android.server.wm.flicker.helpers.LetterboxAppHelper
import android.tools.device.flicker.legacy.IFlickerTestData
import com.android.server.wm.flicker.helpers.setRotation
import com.android.wm.shell.flicker.BaseTest
import com.android.wm.shell.flicker.appWindowIsVisibleAtStart
import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd
import com.android.wm.shell.flicker.appWindowIsVisibleAtStart
import com.android.wm.shell.flicker.appWindowKeepVisible
import com.android.wm.shell.flicker.layerKeepVisible
import org.junit.After
import org.junit.Assume
import org.junit.Before

abstract class BaseAppCompat(flicker: FlickerTest) : BaseTest(flicker) {
abstract class BaseAppCompat(flicker: LegacyFlickerTest) : BaseTest(flicker) {
    protected val context: Context = instrumentation.context
    protected val letterboxApp = LetterboxAppHelper(instrumentation)
    lateinit var cmdHelper: CommandsHelper
@@ -47,9 +47,7 @@ abstract class BaseAppCompat(flicker: FlickerTest) : BaseTest(flicker) {
                letterboxApp.launchViaIntent(wmHelper)
                setEndRotation()
            }
            teardown {
                letterboxApp.exit(wmHelper)
            }
            teardown { letterboxApp.exit(wmHelper) }
        }

    @Before
@@ -100,9 +98,9 @@ abstract class BaseAppCompat(flicker: FlickerTest) : BaseTest(flicker) {
        return res != null && res.contains("true")
    }

    fun IFlickerTestData.setStartRotation() = setRotation(flicker.scenario.startRotation)
    fun FlickerTestData.setStartRotation() = setRotation(flicker.scenario.startRotation)

    fun IFlickerTestData.setEndRotation() = setRotation(flicker.scenario.endRotation)
    fun FlickerTestData.setEndRotation() = setRotation(flicker.scenario.endRotation)

    /** Checks that app entering letterboxed state have rounded corners */
    fun assertLetterboxAppAtStartHasRoundedCorners() {
Loading