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

Commit da5136ea authored by Nataniel Borges's avatar Nataniel Borges
Browse files

Provides assertion blocks on Flicker

Enable tests ot be in presubmit, postsubmit or marked as flaky

Do not require flicker DSL changes

Bug: 162923992
Test: atest FlickerTests WMShellFlickerTests
Change-Id: I74fdadaf5f6f08d96973683682297200eec6658d
parent 277cfb35
Loading
Loading
Loading
Loading
+1 −23
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ android_test {
    name: "WMShellFlickerTests",
    srcs: ["src/**/*.java", "src/**/*.kt"],
    manifest: "AndroidManifest.xml",
    test_config: "AndroidTestPhysicalDevices.xml",
    test_config: "AndroidTest.xml",
    platform_apis: true,
    certificate: "platform",
    test_suites: ["device-tests"],
@@ -36,25 +36,3 @@ android_test {
        "wmshell-flicker-test-components",
    ],
}

android_test {
    name: "WMShellFlickerTestsVirtual",
    srcs: ["src/**/*.java", "src/**/*.kt"],
    manifest: "AndroidManifest.xml",
    test_config: "AndroidTestVirtualDevices.xml",
    platform_apis: true,
    certificate: "platform",
    libs: ["android.test.runner"],
    static_libs: [
        "androidx.test.ext.junit",
        "flickerlib",
        "truth-prebuilt",
        "app-helpers-core",
        "launcher-helper-lib",
        "launcher-aosp-tapl",
        "wm-flicker-common-assertions",
        "wm-flicker-common-app-helpers",
        "platform-test-annotations",
        "wmshell-flicker-test-components",
    ],
}
+0 −41
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
 * Copyright 2020 Google Inc. All Rights Reserved.
 -->
<configuration description="Runs WindowManager Shell Flicker Tests">
    <option name="test-tag" value="FlickerTests" />
    <target_preparer class="com.android.tradefed.targetprep.DeviceSetup">
        <!-- keeps the screen on during tests -->
        <option name="screen-always-on" value="on" />
        <!-- prevents the phone from restarting -->
        <option name="force-skip-system-props" value="true" />
        <!-- set WM tracing verbose level to all -->
        <option name="run-command" value="cmd window tracing level all" />
        <!-- inform WM to log all transactions -->
        <option name="run-command" value="cmd window tracing transaction" />
        <!-- restart launcher to activate TAPL -->
        <option name="run-command" value="setprop ro.test_harness 1 ; am force-stop com.google.android.apps.nexuslauncher" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.DeviceCleaner">
        <!-- reboot the device to teardown any crashed tests -->
        <option name="cleanup-action" value="REBOOT" />
    </target_preparer>
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true"/>
        <option name="test-file-name" value="WMShellFlickerTests.apk"/>
        <option name="test-file-name" value="WMShellFlickerTestApp.apk" />
    </target_preparer>
    <test class="com.android.tradefed.testtype.AndroidJUnitTest">
        <option name="package" value="com.android.wm.shell.flicker"/>
        <option name="exclude-annotation" value="androidx.test.filters.RequiresDevice" />
        <option name="exclude-annotation" value="androidx.test.filters.FlakyTest" />
        <option name="shell-timeout" value="6600s" />
        <option name="test-timeout" value="6000s" />
        <option name="hidden-api-checks" value="false" />
    </test>
    <metrics_collector class="com.android.tradefed.device.metric.FilePullerLogCollector">
        <option name="directory-keys" value="/sdcard/flicker" />
        <option name="collect-on-run-ended-only" value="true" />
        <option name="clean-up" value="true" />
    </metrics_collector>
</configuration>
 No newline at end of file
+12 −12
Original line number Diff line number Diff line
@@ -18,14 +18,14 @@ package com.android.wm.shell.flicker

import android.graphics.Region
import android.view.Surface
import com.android.server.wm.flicker.dsl.LayersAssertionBuilderLegacy
import com.android.server.wm.flicker.APP_PAIR_SPLIT_DIVIDER
import com.android.server.wm.flicker.DOCKED_STACK_DIVIDER
import com.android.server.wm.flicker.dsl.LayersAssertionBuilder
import com.android.server.wm.flicker.helpers.WindowUtils
import com.android.server.wm.flicker.traces.layers.getVisibleBounds

@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsVisible(
fun LayersAssertionBuilderLegacy.appPairsDividerIsVisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -35,7 +35,7 @@ fun LayersAssertionBuilder.appPairsDividerIsVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerIsInvisible(
fun LayersAssertionBuilderLegacy.appPairsDividerIsInvisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -45,7 +45,7 @@ fun LayersAssertionBuilder.appPairsDividerIsInvisible(
}

@JvmOverloads
fun LayersAssertionBuilder.appPairsDividerBecomesVisible(
fun LayersAssertionBuilderLegacy.appPairsDividerBecomesVisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -57,7 +57,7 @@ fun LayersAssertionBuilder.appPairsDividerBecomesVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsVisible(
fun LayersAssertionBuilderLegacy.dockedStackDividerIsVisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -67,7 +67,7 @@ fun LayersAssertionBuilder.dockedStackDividerIsVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesVisible(
fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesVisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -79,7 +79,7 @@ fun LayersAssertionBuilder.dockedStackDividerBecomesVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerBecomesInvisible(
fun LayersAssertionBuilderLegacy.dockedStackDividerBecomesInvisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -91,7 +91,7 @@ fun LayersAssertionBuilder.dockedStackDividerBecomesInvisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackDividerIsInvisible(
fun LayersAssertionBuilderLegacy.dockedStackDividerIsInvisible(
    bugId: Int = 0,
    enabled: Boolean = bugId == 0
) {
@@ -101,7 +101,7 @@ fun LayersAssertionBuilder.dockedStackDividerIsInvisible(
}

@JvmOverloads
fun LayersAssertionBuilder.appPairsPrimaryBoundsIsVisible(
fun LayersAssertionBuilderLegacy.appPairsPrimaryBoundsIsVisible(
    rotation: Int,
    primaryLayerName: String,
    bugId: Int = 0,
@@ -114,7 +114,7 @@ fun LayersAssertionBuilder.appPairsPrimaryBoundsIsVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.appPairsSecondaryBoundsIsVisible(
fun LayersAssertionBuilderLegacy.appPairsSecondaryBoundsIsVisible(
    rotation: Int,
    secondaryLayerName: String,
    bugId: Int = 0,
@@ -127,7 +127,7 @@ fun LayersAssertionBuilder.appPairsSecondaryBoundsIsVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackPrimaryBoundsIsVisible(
fun LayersAssertionBuilderLegacy.dockedStackPrimaryBoundsIsVisible(
    rotation: Int,
    primaryLayerName: String,
    bugId: Int = 0,
@@ -140,7 +140,7 @@ fun LayersAssertionBuilder.dockedStackPrimaryBoundsIsVisible(
}

@JvmOverloads
fun LayersAssertionBuilder.dockedStackSecondaryBoundsIsVisible(
fun LayersAssertionBuilderLegacy.dockedStackSecondaryBoundsIsVisible(
    rotation: Int,
    secondaryLayerName: String,
    bugId: Int = 0,
+1 −22
Original line number Diff line number Diff line
@@ -18,28 +18,7 @@ android_test {
    name: "FlickerTests",
    srcs: ["src/**/*.java", "src/**/*.kt"],
    manifest: "AndroidManifest.xml",
    test_config: "AndroidTestPhysicalDevices.xml",
    platform_apis: true,
    certificate: "platform",
    test_suites: ["device-tests"],
    libs: ["android.test.runner"],
    static_libs: [
        "androidx.test.ext.junit",
        "flickertestapplib",
        "flickerlib",
        "truth-prebuilt",
        "launcher-helper-lib",
        "launcher-aosp-tapl",
        "platform-test-annotations",
    ],
}


android_test {
    name: "FlickerTestsVirtual",
    srcs: ["src/**/*.java", "src/**/*.kt"],
    manifest: "AndroidManifest.xml",
    test_config: "AndroidTestVirtualDevices.xml",
    test_config: "AndroidTest.xml",
    platform_apis: true,
    certificate: "platform",
    test_suites: ["device-tests"],
Loading