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

Commit 5853a277 authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Unify ComponentMatcher / WM / SF trace and state API

Use a single API for different components for simplicity

Bug: 234735502
Test: atest FlickerTests
Change-Id: I94182437ae2b6e158465322a557482b418123594
parent a80162db
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ package com.android.wm.shell.flicker
import android.view.Surface
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.IComponentMatcher
import com.android.server.wm.traces.common.region.Region

fun FlickerTestParameter.appPairsDividerIsVisibleAtEnd() {
@@ -48,7 +48,7 @@ fun FlickerTestParameter.splitScreenDividerBecomesVisible() {
}

fun FlickerTestParameter.layerBecomesVisible(
    component: FlickerComponentName
    component: IComponentMatcher
) {
    assertLayers {
        this.isInvisible(component)
@@ -58,7 +58,7 @@ fun FlickerTestParameter.layerBecomesVisible(
}

fun FlickerTestParameter.layerIsVisibleAtEnd(
    component: FlickerComponentName
    component: IComponentMatcher
) {
    assertLayersEnd {
        this.isVisible(component)
@@ -67,7 +67,7 @@ fun FlickerTestParameter.layerIsVisibleAtEnd(

fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(
    rotation: Int,
    component: FlickerComponentName,
    component: IComponentMatcher,
    splitLeftTop: Boolean
) {
    assertLayers {
@@ -88,7 +88,7 @@ fun FlickerTestParameter.splitAppLayerBoundsBecomesVisible(

fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd(
    rotation: Int,
    component: FlickerComponentName,
    component: IComponentMatcher,
    splitLeftTop: Boolean
) {
    assertLayersEnd {
@@ -104,7 +104,7 @@ fun FlickerTestParameter.splitAppLayerBoundsIsVisibleAtEnd(
}

fun FlickerTestParameter.appWindowBecomesVisible(
    component: FlickerComponentName
    component: IComponentMatcher
) {
    assertWm {
        this.isAppWindowInvisible(component)
@@ -114,7 +114,7 @@ fun FlickerTestParameter.appWindowBecomesVisible(
}

fun FlickerTestParameter.appWindowIsVisibleAtEnd(
    component: FlickerComponentName
    component: IComponentMatcher
) {
    assertWmEnd {
        this.isAppWindowVisible(component)
@@ -151,7 +151,7 @@ fun FlickerTestParameter.dockedStackDividerNotExistsAtEnd() {

fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(
    rotation: Int,
    primaryComponent: FlickerComponentName
    primaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -162,7 +162,7 @@ fun FlickerTestParameter.appPairsPrimaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(
    rotation: Int,
    primaryComponent: FlickerComponentName
    primaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
@@ -173,7 +173,7 @@ fun FlickerTestParameter.dockedStackPrimaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(
    rotation: Int,
    secondaryComponent: FlickerComponentName
    secondaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(APP_PAIR_SPLIT_DIVIDER_COMPONENT).visibleRegion.region
@@ -184,7 +184,7 @@ fun FlickerTestParameter.appPairsSecondaryBoundsIsVisibleAtEnd(

fun FlickerTestParameter.dockedStackSecondaryBoundsIsVisibleAtEnd(
    rotation: Int,
    secondaryComponent: FlickerComponentName
    secondaryComponent: IComponentMatcher
) {
    assertLayersEnd {
        val dividerRegion = layer(DOCKED_STACK_DIVIDER_COMPONENT).visibleRegion.region
+4 −4
Original line number Diff line number Diff line
@@ -17,9 +17,9 @@
@file:JvmName("CommonConstants")
package com.android.wm.shell.flicker

import com.android.server.wm.traces.common.FlickerComponentName
import com.android.server.wm.traces.common.ComponentMatcher

const val SYSTEM_UI_PACKAGE_NAME = "com.android.systemui"
val APP_PAIR_SPLIT_DIVIDER_COMPONENT = FlickerComponentName("", "AppPairSplitDivider#")
val DOCKED_STACK_DIVIDER_COMPONENT = FlickerComponentName("", "DockedStackDivider#")
val SPLIT_SCREEN_DIVIDER_COMPONENT = FlickerComponentName("", "StageCoordinatorSplitDivider#")
val APP_PAIR_SPLIT_DIVIDER_COMPONENT = ComponentMatcher("", "AppPairSplitDivider#")
val DOCKED_STACK_DIVIDER_COMPONENT = ComponentMatcher("", "DockedStackDivider#")
val SPLIT_SCREEN_DIVIDER_COMPONENT = ComponentMatcher("", "StageCoordinatorSplitDivider#")
+2 −2
Original line number Diff line number Diff line
@@ -28,8 +28,8 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
@@ -70,7 +70,7 @@ open class DismissBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScree
    @Test
    open fun testAppIsAlwaysVisible() {
        testSpec.assertLayers {
            this.isVisible(testApp.component)
            this.isVisible(testApp)
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -24,8 +24,8 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.annotation.Group4
import com.android.server.wm.flicker.dsl.FlickerBuilder
import org.junit.runner.RunWith
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.Parameterized

/**
@@ -63,7 +63,7 @@ open class ExpandBubbleScreen(testSpec: FlickerTestParameter) : BaseBubbleScreen
    @Test
    open fun testAppIsAlwaysVisible() {
        testSpec.assertLayers {
            this.isVisible(testApp.component)
            this.isVisible(testApp)
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
    fun testAppIsVisibleAtEnd() {
        Assume.assumeFalse(isShellTransitionsEnabled)
        testSpec.assertLayersEnd {
            this.isVisible(testApp.component)
            this.isVisible(testApp)
        }
    }

@@ -99,7 +99,7 @@ class LaunchBubbleFromLockScreen(testSpec: FlickerTestParameter) : BaseBubbleScr
    fun testAppIsVisibleAtEnd_ShellTransit() {
        Assume.assumeTrue(isShellTransitionsEnabled)
        testSpec.assertLayersEnd {
            this.isVisible(testApp.component)
            this.isVisible(testApp)
        }
    }
}
Loading