Merge "Fix the case that the app doesn't exist"

This commit is contained in:
TreeHugger Robot
2022-11-03 09:09:09 +00:00
committed by Android (Google) Code Review
2 changed files with 27 additions and 6 deletions

View File

@@ -45,14 +45,23 @@ fun FlickerTestParameter.appPairsDividerBecomesVisible() {
fun FlickerTestParameter.splitScreenEntered(
component1: IComponentMatcher,
component2: IComponentMatcher,
fromOtherApp: Boolean
fromOtherApp: Boolean,
appExistAtStart: Boolean = true
) {
if (fromOtherApp) {
appWindowIsInvisibleAtStart(component1)
if (appExistAtStart) {
appWindowIsInvisibleAtStart(component1)
} else {
appWindowIsNotContainAtStart(component1)
}
} else {
appWindowIsVisibleAtStart(component1)
}
appWindowIsInvisibleAtStart(component2)
if (appExistAtStart) {
appWindowIsInvisibleAtStart(component2)
} else {
appWindowIsNotContainAtStart(component2)
}
splitScreenDividerIsInvisibleAtStart()
appWindowIsVisibleAtEnd(component1)
@@ -315,6 +324,10 @@ fun FlickerTestParameter.appWindowIsInvisibleAtEnd(component: IComponentMatcher)
assertWmEnd { this.isAppWindowInvisible(component) }
}
fun FlickerTestParameter.appWindowIsNotContainAtStart(component: IComponentMatcher) {
assertWmStart { this.notContains(component) }
}
fun FlickerTestParameter.appWindowKeepVisible(component: IComponentMatcher) {
assertWm { this.isAppWindowVisible(component) }
}

View File

@@ -23,7 +23,6 @@ import com.android.server.wm.flicker.FlickerParametersRunnerFactory
import com.android.server.wm.flicker.FlickerTestParameter
import com.android.server.wm.flicker.FlickerTestParameterFactory
import com.android.server.wm.flicker.dsl.FlickerBuilder
import com.android.wm.shell.flicker.appWindowBecomesVisible
import com.android.wm.shell.flicker.appWindowIsVisibleAtEnd
import com.android.wm.shell.flicker.layerBecomesVisible
import com.android.wm.shell.flicker.layerIsVisibleAtEnd
@@ -78,7 +77,8 @@ class EnterSplitScreenByDragFromShortcut(
@Postsubmit
@Test
fun cujCompleted() = testSpec.splitScreenEntered(primaryApp, secondaryApp, fromOtherApp = false)
fun cujCompleted() = testSpec.splitScreenEntered(primaryApp, secondaryApp,
fromOtherApp = false, appExistAtStart = false)
@Postsubmit
@Test
@@ -108,7 +108,15 @@ class EnterSplitScreenByDragFromShortcut(
@Postsubmit
@Test
fun secondaryAppWindowBecomesVisible() = testSpec.appWindowBecomesVisible(secondaryApp)
fun secondaryAppWindowBecomesVisible() {
testSpec.assertWm {
this.notContains(secondaryApp)
.then()
.isAppWindowInvisible(secondaryApp, isOptional = true)
.then()
.isAppWindowVisible(secondaryApp)
}
}
/** {@inheritDoc} */
@Postsubmit