Loading libs/WindowManager/Shell/tests/flicker/Android.bp +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ package { default_applicable_licenses: ["frameworks_base_license"], } filegroup { name: "WMShellFlickerTestsUtils-src", srcs: ["src/com/android/wm/shell/flicker/utils/*.kt"], } filegroup { name: "WMShellFlickerTestsBase-src", srcs: ["src/com/android/wm/shell/flicker/*.kt"], Loading Loading @@ -53,6 +58,28 @@ filegroup { ], } java_library { name: "wm-shell-flicker-utils", platform_apis: true, optimize: { enabled: false, }, srcs: [ ":WMShellFlickerTestsUtils-src", ], static_libs: [ "androidx.test.ext.junit", "flickertestapplib", "flickerlib", "flickerlib-helpers", "platform-test-annotations", "wm-flicker-common-app-helpers", "wm-flicker-common-assertions", "launcher-helper-lib", "launcher-aosp-tapl", ], } java_defaults { name: "WMShellFlickerTestsDefault", manifest: "manifests/AndroidManifest.xml", Loading @@ -65,6 +92,7 @@ java_defaults { test_suites: ["device-tests"], libs: ["android.test.runner"], static_libs: [ "wm-shell-flicker-utils", "androidx.test.ext.junit", "flickertestapplib", "flickerlib", Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/BaseTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.tools.common.traces.component.ComponentNameMatcher import android.tools.device.flicker.legacy.LegacyFlickerTest import androidx.test.platform.app.InstrumentationRegistry import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.flicker.utils.ICommonAssertions /** * Base test class containing common assertions for [ComponentNameMatcher.NAV_BAR], Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/BaseAppCompat.kt +5 −8 Original line number Diff line number Diff line Loading @@ -24,11 +24,10 @@ import android.tools.device.flicker.legacy.LegacyFlickerTest import com.android.server.wm.flicker.helpers.LetterboxAppHelper import com.android.server.wm.flicker.helpers.setRotation import com.android.wm.shell.flicker.BaseTest 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 com.android.wm.shell.flicker.utils.appWindowIsVisibleAtEnd import com.android.wm.shell.flicker.utils.appWindowIsVisibleAtStart import com.android.wm.shell.flicker.utils.appWindowKeepVisible import com.android.wm.shell.flicker.utils.layerKeepVisible import org.junit.Assume import org.junit.Before import org.junit.Rule Loading @@ -37,9 +36,7 @@ abstract class BaseAppCompat(flicker: LegacyFlickerTest) : BaseTest(flicker) { protected val context: Context = instrumentation.context protected val letterboxApp = LetterboxAppHelper(instrumentation) @JvmField @Rule val letterboxRule: LetterboxRule = LetterboxRule() @JvmField @Rule val letterboxRule: LetterboxRule = LetterboxRule() /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/LetterboxRule.kt +15 −17 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement /** * JUnit Rule to handle letterboxStyles and states */ /** JUnit Rule to handle letterboxStyles and states */ class LetterboxRule( private val withLetterboxEducationEnabled: Boolean = false, private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(), Loading Loading @@ -62,8 +60,7 @@ class LetterboxRule( var hasLetterboxEducationStateChanged = false if ("$withLetterboxEducationEnabled" != isLetterboxEducationEnabled) { hasLetterboxEducationStateChanged = true execAdb("wm set-letterbox-style --isEducationEnabled " + withLetterboxEducationEnabled) execAdb("wm set-letterbox-style --isEducationEnabled " + withLetterboxEducationEnabled) } return try { object : Statement() { Loading @@ -74,8 +71,8 @@ class LetterboxRule( } } finally { if (hasLetterboxEducationStateChanged) { execAdb("wm set-letterbox-style --isEducationEnabled " + isLetterboxEducationEnabled execAdb( "wm set-letterbox-style --isEducationEnabled " + isLetterboxEducationEnabled ) } resetLetterboxStyle() Loading @@ -100,7 +97,8 @@ class LetterboxRule( execAdb("wm reset-letterbox-style") } private fun asInt(str: String?): Int? = try { private fun asInt(str: String?): Int? = try { str?.toInt() } catch (e: NumberFormatException) { null Loading libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenTransparentActivityTest.kt +11 −22 Original line number Diff line number Diff line Loading @@ -54,9 +54,7 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { setup { letterboxTranslucentLauncherApp.launchViaIntent(wmHelper) } setup { letterboxTranslucentLauncherApp.launchViaIntent(wmHelper) } transitions { waitAndGetLaunchTransparent()?.click() ?: error("Launch Transparent not found") } Loading @@ -66,9 +64,7 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks the transparent activity is launched on top of the opaque one */ /** Checks the transparent activity is launched on top of the opaque one */ @Postsubmit @Test fun translucentActivityIsLaunchedOnTopOfOpaqueActivity() { Loading @@ -79,18 +75,14 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks that the activity is letterboxed */ /** Checks that the activity is letterboxed */ @Postsubmit @Test fun translucentActivityIsLetterboxed() { flicker.assertLayers { isVisible(ComponentNameMatcher.LETTERBOX) } } /** * Checks that the translucent activity inherits bounds from the opaque one. */ /** Checks that the translucent activity inherits bounds from the opaque one. */ @Postsubmit @Test fun translucentActivityInheritsBoundsFromOpaqueActivity() { Loading @@ -100,29 +92,26 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks that the translucent activity has rounded corners */ /** Checks that the translucent activity has rounded corners */ @Postsubmit @Test fun translucentActivityHasRoundedCorners() { flicker.assertLayersEnd { this.hasRoundedCorners(letterboxTranslucentApp) } flicker.assertLayersEnd { this.hasRoundedCorners(letterboxTranslucentApp) } } companion object { /** * Creates the test configurations. * * See [FlickerTestFactory.rotationTests] for configuring screen orientation and * navigation modes. * See [FlickerTestFactory.rotationTests] for configuring screen orientation and navigation * modes. */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection<FlickerTest> { return LegacyFlickerTestFactory .nonRotationTests(supportedRotations = listOf(Rotation.ROTATION_90)) return LegacyFlickerTestFactory.nonRotationTests( supportedRotations = listOf(Rotation.ROTATION_90) ) } } } Loading
libs/WindowManager/Shell/tests/flicker/Android.bp +28 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,11 @@ package { default_applicable_licenses: ["frameworks_base_license"], } filegroup { name: "WMShellFlickerTestsUtils-src", srcs: ["src/com/android/wm/shell/flicker/utils/*.kt"], } filegroup { name: "WMShellFlickerTestsBase-src", srcs: ["src/com/android/wm/shell/flicker/*.kt"], Loading Loading @@ -53,6 +58,28 @@ filegroup { ], } java_library { name: "wm-shell-flicker-utils", platform_apis: true, optimize: { enabled: false, }, srcs: [ ":WMShellFlickerTestsUtils-src", ], static_libs: [ "androidx.test.ext.junit", "flickertestapplib", "flickerlib", "flickerlib-helpers", "platform-test-annotations", "wm-flicker-common-app-helpers", "wm-flicker-common-assertions", "launcher-helper-lib", "launcher-aosp-tapl", ], } java_defaults { name: "WMShellFlickerTestsDefault", manifest: "manifests/AndroidManifest.xml", Loading @@ -65,6 +92,7 @@ java_defaults { test_suites: ["device-tests"], libs: ["android.test.runner"], static_libs: [ "wm-shell-flicker-utils", "androidx.test.ext.junit", "flickertestapplib", "flickerlib", Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/BaseTest.kt +1 −0 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.tools.common.traces.component.ComponentNameMatcher import android.tools.device.flicker.legacy.LegacyFlickerTest import androidx.test.platform.app.InstrumentationRegistry import com.android.launcher3.tapl.LauncherInstrumentation import com.android.wm.shell.flicker.utils.ICommonAssertions /** * Base test class containing common assertions for [ComponentNameMatcher.NAV_BAR], Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/BaseAppCompat.kt +5 −8 Original line number Diff line number Diff line Loading @@ -24,11 +24,10 @@ import android.tools.device.flicker.legacy.LegacyFlickerTest import com.android.server.wm.flicker.helpers.LetterboxAppHelper import com.android.server.wm.flicker.helpers.setRotation import com.android.wm.shell.flicker.BaseTest 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 com.android.wm.shell.flicker.utils.appWindowIsVisibleAtEnd import com.android.wm.shell.flicker.utils.appWindowIsVisibleAtStart import com.android.wm.shell.flicker.utils.appWindowKeepVisible import com.android.wm.shell.flicker.utils.layerKeepVisible import org.junit.Assume import org.junit.Before import org.junit.Rule Loading @@ -37,9 +36,7 @@ abstract class BaseAppCompat(flicker: LegacyFlickerTest) : BaseTest(flicker) { protected val context: Context = instrumentation.context protected val letterboxApp = LetterboxAppHelper(instrumentation) @JvmField @Rule val letterboxRule: LetterboxRule = LetterboxRule() @JvmField @Rule val letterboxRule: LetterboxRule = LetterboxRule() /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/LetterboxRule.kt +15 −17 Original line number Diff line number Diff line Loading @@ -23,9 +23,7 @@ import org.junit.rules.TestRule import org.junit.runner.Description import org.junit.runners.model.Statement /** * JUnit Rule to handle letterboxStyles and states */ /** JUnit Rule to handle letterboxStyles and states */ class LetterboxRule( private val withLetterboxEducationEnabled: Boolean = false, private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation(), Loading Loading @@ -62,8 +60,7 @@ class LetterboxRule( var hasLetterboxEducationStateChanged = false if ("$withLetterboxEducationEnabled" != isLetterboxEducationEnabled) { hasLetterboxEducationStateChanged = true execAdb("wm set-letterbox-style --isEducationEnabled " + withLetterboxEducationEnabled) execAdb("wm set-letterbox-style --isEducationEnabled " + withLetterboxEducationEnabled) } return try { object : Statement() { Loading @@ -74,8 +71,8 @@ class LetterboxRule( } } finally { if (hasLetterboxEducationStateChanged) { execAdb("wm set-letterbox-style --isEducationEnabled " + isLetterboxEducationEnabled execAdb( "wm set-letterbox-style --isEducationEnabled " + isLetterboxEducationEnabled ) } resetLetterboxStyle() Loading @@ -100,7 +97,8 @@ class LetterboxRule( execAdb("wm reset-letterbox-style") } private fun asInt(str: String?): Int? = try { private fun asInt(str: String?): Int? = try { str?.toInt() } catch (e: NumberFormatException) { null Loading
libs/WindowManager/Shell/tests/flicker/src/com/android/wm/shell/flicker/appcompat/OpenTransparentActivityTest.kt +11 −22 Original line number Diff line number Diff line Loading @@ -54,9 +54,7 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA /** {@inheritDoc} */ override val transition: FlickerBuilder.() -> Unit get() = { setup { letterboxTranslucentLauncherApp.launchViaIntent(wmHelper) } setup { letterboxTranslucentLauncherApp.launchViaIntent(wmHelper) } transitions { waitAndGetLaunchTransparent()?.click() ?: error("Launch Transparent not found") } Loading @@ -66,9 +64,7 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks the transparent activity is launched on top of the opaque one */ /** Checks the transparent activity is launched on top of the opaque one */ @Postsubmit @Test fun translucentActivityIsLaunchedOnTopOfOpaqueActivity() { Loading @@ -79,18 +75,14 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks that the activity is letterboxed */ /** Checks that the activity is letterboxed */ @Postsubmit @Test fun translucentActivityIsLetterboxed() { flicker.assertLayers { isVisible(ComponentNameMatcher.LETTERBOX) } } /** * Checks that the translucent activity inherits bounds from the opaque one. */ /** Checks that the translucent activity inherits bounds from the opaque one. */ @Postsubmit @Test fun translucentActivityInheritsBoundsFromOpaqueActivity() { Loading @@ -100,29 +92,26 @@ class OpenTransparentActivityTest(flicker: LegacyFlickerTest) : TransparentBaseA } } /** * Checks that the translucent activity has rounded corners */ /** Checks that the translucent activity has rounded corners */ @Postsubmit @Test fun translucentActivityHasRoundedCorners() { flicker.assertLayersEnd { this.hasRoundedCorners(letterboxTranslucentApp) } flicker.assertLayersEnd { this.hasRoundedCorners(letterboxTranslucentApp) } } companion object { /** * Creates the test configurations. * * See [FlickerTestFactory.rotationTests] for configuring screen orientation and * navigation modes. * See [FlickerTestFactory.rotationTests] for configuring screen orientation and navigation * modes. */ @Parameterized.Parameters(name = "{0}") @JvmStatic fun getParams(): Collection<FlickerTest> { return LegacyFlickerTestFactory .nonRotationTests(supportedRotations = listOf(Rotation.ROTATION_90)) return LegacyFlickerTestFactory.nonRotationTests( supportedRotations = listOf(Rotation.ROTATION_90) ) } } }