From 0e70faadf6b0caae8b75ba608df5fd05b64d088e Mon Sep 17 00:00:00 2001 From: An An Yu Date: Tue, 30 May 2023 21:35:59 +0000 Subject: Move existing FlickerTests under subdirectory Test: atest Bug: 238043427 Change-Id: I709f34a4fa0bd3142c961dfe258d5847dc15bf17 --- .../OpenActivityEmbeddingPlaceholderSplitTest.kt | 129 --------------------- .../OpenActivityEmbeddingSecondaryToSplitTest.kt | 122 ------------------- .../OpenActivityEmbeddingPlaceholderSplitTest.kt | 129 +++++++++++++++++++++ .../OpenActivityEmbeddingSecondaryToSplitTest.kt | 122 +++++++++++++++++++ 4 files changed, 251 insertions(+), 251 deletions(-) delete mode 100644 tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingPlaceholderSplitTest.kt delete mode 100644 tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingSecondaryToSplitTest.kt create mode 100644 tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt create mode 100644 tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingPlaceholderSplitTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingPlaceholderSplitTest.kt deleted file mode 100644 index ed17059e79e7..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingPlaceholderSplitTest.kt +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2022 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm.flicker.activityembedding - -import android.platform.test.annotations.Presubmit -import android.tools.device.flicker.junit.FlickerParametersRunnerFactory -import android.tools.device.flicker.legacy.FlickerBuilder -import android.tools.device.flicker.legacy.FlickerTest -import android.tools.device.flicker.legacy.FlickerTestFactory -import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper -import org.junit.FixMethodOrder -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.MethodSorters -import org.junit.runners.Parameterized - -/** - * Test opening an activity that will launch another activity as ActivityEmbedding placeholder in - * split. - * - * To run this test: `atest FlickerTests:OpenActivityEmbeddingPlaceholderSplitTest` - */ -@RequiresDevice -@RunWith(Parameterized::class) -@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -class OpenActivityEmbeddingPlaceholderSplitTest(flicker: FlickerTest) : - ActivityEmbeddingTestBase(flicker) { - - /** {@inheritDoc} */ - override val transition: FlickerBuilder.() -> Unit = { - setup { - tapl.setExpectedRotationCheckEnabled(false) - testApp.launchViaIntent(wmHelper) - } - transitions { testApp.launchPlaceholderSplit(wmHelper) } - teardown { - tapl.goHome() - testApp.exit(wmHelper) - } - } - - /** Main activity should become invisible after launching the placeholder primary activity. */ - @Presubmit - @Test - fun mainActivityWindowBecomesInvisible() { - flicker.assertWm { - isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - } - } - - /** Main activity should become invisible after launching the placeholder primary activity. */ - @Presubmit - @Test - fun mainActivityLayerBecomesInvisible() { - flicker.assertLayers { - isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .then() - .isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - } - } - - /** - * Placeholder primary and secondary should become visible after launch. The windows are not - * necessarily to become visible at the same time. - */ - @Presubmit - @Test - fun placeholderSplitWindowsBecomeVisible() { - flicker.assertWm { - notContains(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) - .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) - .then() - .isAppWindowVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) - } - flicker.assertWm { - notContains(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) - .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) - .then() - .isAppWindowVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) - } - } - - /** Placeholder primary and secondary should become visible together after launch. */ - @Presubmit - @Test - fun placeholderSplitLayersBecomeVisible() { - flicker.assertLayers { - isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) - isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) - .then() - .isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) - .isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) - } - } - - companion object { - /** - * Creates the test configurations. - * - * See [FlickerTestFactory.nonRotationTests] for configuring screen orientation and - * navigation modes. - */ - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): Collection { - return FlickerTestFactory.nonRotationTests() - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingSecondaryToSplitTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingSecondaryToSplitTest.kt deleted file mode 100644 index 863828881d36..000000000000 --- a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/OpenActivityEmbeddingSecondaryToSplitTest.kt +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (C) 2023 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.server.wm.flicker.activityembedding - -import android.platform.test.annotations.Presubmit -import android.tools.common.traces.component.ComponentNameMatcher -import android.tools.device.flicker.junit.FlickerParametersRunnerFactory -import android.tools.device.flicker.legacy.FlickerBuilder -import android.tools.device.flicker.legacy.FlickerTest -import android.tools.device.flicker.legacy.FlickerTestFactory -import androidx.test.filters.RequiresDevice -import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper -import org.junit.FixMethodOrder -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.MethodSorters -import org.junit.runners.Parameterized - -/** - * Test opening a secondary activity that will split with the main activity. - * - * To run this test: `atest FlickerTests:OpenActivityEmbeddingSecondaryToSplitTest` - */ -@RequiresDevice -@RunWith(Parameterized::class) -@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) -@FixMethodOrder(MethodSorters.NAME_ASCENDING) -class OpenActivityEmbeddingSecondaryToSplitTest(flicker: FlickerTest) : - ActivityEmbeddingTestBase(flicker) { - - /** {@inheritDoc} */ - override val transition: FlickerBuilder.() -> Unit = { - setup { - tapl.setExpectedRotationCheckEnabled(false) - testApp.launchViaIntent(wmHelper) - } - transitions { testApp.launchSecondaryActivity(wmHelper) } - teardown { - tapl.goHome() - testApp.exit(wmHelper) - } - } - - /** Main activity should remain visible when enter split from fullscreen. */ - @Presubmit - @Test - fun mainActivityWindowIsAlwaysVisible() { - flicker.assertWm { isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) } - } - - /** - * Main activity surface is animated from fullscreen to ActivityEmbedding split. During the - * transition, there is a period of time that it is covered by a snapshot of itself. - */ - @Presubmit - @Test - fun mainActivityLayerIsAlwaysVisible() { - flicker.assertLayers { - isVisible( - ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT.or( - ComponentNameMatcher.TRANSITION_SNAPSHOT - ) - ) - } - flicker.assertLayersEnd { - isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) - .isInvisible(ComponentNameMatcher.TRANSITION_SNAPSHOT) - } - } - - /** Secondary activity should become visible after launching into split. */ - @Presubmit - @Test - fun secondaryActivityWindowBecomesVisible() { - flicker.assertWm { - notContains(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - .then() - .isAppWindowInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - .then() - .isAppWindowVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - } - } - - /** Secondary activity should become visible after launching into split. */ - @Presubmit - @Test - fun secondaryActivityLayerBecomesVisible() { - flicker.assertLayers { - isInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - .then() - .isVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) - } - } - - companion object { - /** - * Creates the test configurations. - * - * See [FlickerTestFactory.nonRotationTests] for configuring screen orientation and - * navigation modes. - */ - @Parameterized.Parameters(name = "{0}") - @JvmStatic - fun getParams(): Collection { - return FlickerTestFactory.nonRotationTests() - } - } -} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt new file mode 100644 index 000000000000..ed17059e79e7 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingPlaceholderSplitTest.kt @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wm.flicker.activityembedding + +import android.platform.test.annotations.Presubmit +import android.tools.device.flicker.junit.FlickerParametersRunnerFactory +import android.tools.device.flicker.legacy.FlickerBuilder +import android.tools.device.flicker.legacy.FlickerTest +import android.tools.device.flicker.legacy.FlickerTestFactory +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test opening an activity that will launch another activity as ActivityEmbedding placeholder in + * split. + * + * To run this test: `atest FlickerTests:OpenActivityEmbeddingPlaceholderSplitTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenActivityEmbeddingPlaceholderSplitTest(flicker: FlickerTest) : + ActivityEmbeddingTestBase(flicker) { + + /** {@inheritDoc} */ + override val transition: FlickerBuilder.() -> Unit = { + setup { + tapl.setExpectedRotationCheckEnabled(false) + testApp.launchViaIntent(wmHelper) + } + transitions { testApp.launchPlaceholderSplit(wmHelper) } + teardown { + tapl.goHome() + testApp.exit(wmHelper) + } + } + + /** Main activity should become invisible after launching the placeholder primary activity. */ + @Presubmit + @Test + fun mainActivityWindowBecomesInvisible() { + flicker.assertWm { + isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + .then() + .isAppWindowInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + } + } + + /** Main activity should become invisible after launching the placeholder primary activity. */ + @Presubmit + @Test + fun mainActivityLayerBecomesInvisible() { + flicker.assertLayers { + isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + .then() + .isInvisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + } + } + + /** + * Placeholder primary and secondary should become visible after launch. The windows are not + * necessarily to become visible at the same time. + */ + @Presubmit + @Test + fun placeholderSplitWindowsBecomeVisible() { + flicker.assertWm { + notContains(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) + .then() + .isAppWindowInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) + .then() + .isAppWindowVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) + } + flicker.assertWm { + notContains(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) + .then() + .isAppWindowInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) + .then() + .isAppWindowVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) + } + } + + /** Placeholder primary and secondary should become visible together after launch. */ + @Presubmit + @Test + fun placeholderSplitLayersBecomeVisible() { + flicker.assertLayers { + isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) + isInvisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) + .then() + .isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_PRIMARY_COMPONENT) + .isVisible(ActivityEmbeddingAppHelper.PLACEHOLDER_SECONDARY_COMPONENT) + } + } + + companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestFactory.nonRotationTests] for configuring screen orientation and + * navigation modes. + */ + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection { + return FlickerTestFactory.nonRotationTests() + } + } +} diff --git a/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt new file mode 100644 index 000000000000..863828881d36 --- /dev/null +++ b/tests/FlickerTests/src/com/android/server/wm/flicker/activityembedding/open/OpenActivityEmbeddingSecondaryToSplitTest.kt @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2023 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.server.wm.flicker.activityembedding + +import android.platform.test.annotations.Presubmit +import android.tools.common.traces.component.ComponentNameMatcher +import android.tools.device.flicker.junit.FlickerParametersRunnerFactory +import android.tools.device.flicker.legacy.FlickerBuilder +import android.tools.device.flicker.legacy.FlickerTest +import android.tools.device.flicker.legacy.FlickerTestFactory +import androidx.test.filters.RequiresDevice +import com.android.server.wm.flicker.helpers.ActivityEmbeddingAppHelper +import org.junit.FixMethodOrder +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.MethodSorters +import org.junit.runners.Parameterized + +/** + * Test opening a secondary activity that will split with the main activity. + * + * To run this test: `atest FlickerTests:OpenActivityEmbeddingSecondaryToSplitTest` + */ +@RequiresDevice +@RunWith(Parameterized::class) +@Parameterized.UseParametersRunnerFactory(FlickerParametersRunnerFactory::class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) +class OpenActivityEmbeddingSecondaryToSplitTest(flicker: FlickerTest) : + ActivityEmbeddingTestBase(flicker) { + + /** {@inheritDoc} */ + override val transition: FlickerBuilder.() -> Unit = { + setup { + tapl.setExpectedRotationCheckEnabled(false) + testApp.launchViaIntent(wmHelper) + } + transitions { testApp.launchSecondaryActivity(wmHelper) } + teardown { + tapl.goHome() + testApp.exit(wmHelper) + } + } + + /** Main activity should remain visible when enter split from fullscreen. */ + @Presubmit + @Test + fun mainActivityWindowIsAlwaysVisible() { + flicker.assertWm { isAppWindowVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) } + } + + /** + * Main activity surface is animated from fullscreen to ActivityEmbedding split. During the + * transition, there is a period of time that it is covered by a snapshot of itself. + */ + @Presubmit + @Test + fun mainActivityLayerIsAlwaysVisible() { + flicker.assertLayers { + isVisible( + ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT.or( + ComponentNameMatcher.TRANSITION_SNAPSHOT + ) + ) + } + flicker.assertLayersEnd { + isVisible(ActivityEmbeddingAppHelper.MAIN_ACTIVITY_COMPONENT) + .isInvisible(ComponentNameMatcher.TRANSITION_SNAPSHOT) + } + } + + /** Secondary activity should become visible after launching into split. */ + @Presubmit + @Test + fun secondaryActivityWindowBecomesVisible() { + flicker.assertWm { + notContains(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + .then() + .isAppWindowInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + .then() + .isAppWindowVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + } + } + + /** Secondary activity should become visible after launching into split. */ + @Presubmit + @Test + fun secondaryActivityLayerBecomesVisible() { + flicker.assertLayers { + isInvisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + .then() + .isVisible(ActivityEmbeddingAppHelper.SECONDARY_ACTIVITY_COMPONENT) + } + } + + companion object { + /** + * Creates the test configurations. + * + * See [FlickerTestFactory.nonRotationTests] for configuring screen orientation and + * navigation modes. + */ + @Parameterized.Parameters(name = "{0}") + @JvmStatic + fun getParams(): Collection { + return FlickerTestFactory.nonRotationTests() + } + } +} -- cgit v1.2.3-59-g8ed1b