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

Commit 232a6987 authored by Liran Binyamin's avatar Liran Binyamin
Browse files

Convert BubblePositionerTest to deviceless testing

This change introduces Robolectric to WMShell and converts BubblePositionerTest
to a bivalent test.

Flag: NONE
Bug: 308004028
Test: atest BubblePositionerTest
Change-Id: I0aa7ccd99d20fadc86429615f249124eb3f4f51b
parent af6e1e5b
Loading
Loading
Loading
Loading
+71 −0
Original line number Diff line number Diff line
@@ -175,3 +175,74 @@ android_library {
    plugins: ["dagger2-compiler"],
    use_resource_processor: true,
}

android_app {
    name: "WindowManagerShellRobolectric",
    platform_apis: true,
    static_libs: [
        "WindowManager-Shell",
    ],
    manifest: "multivalentTests/AndroidManifestRobolectric.xml",
    use_resource_processor: true,
}

android_robolectric_test {
    name: "WMShellRobolectricTests",
    instrumentation_for: "WindowManagerShellRobolectric",
    upstream: true,
    java_resource_dirs: [
        "multivalentTests/robolectric/config",
    ],
    srcs: [
        "multivalentTests/src/**/*.kt",
    ],
    static_libs: [
        "junit",
        "androidx.test.runner",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "mockito-robolectric-prebuilt",
        "mockito-kotlin2",
        "truth",
    ],
}

android_test {
    name: "WMShellMultivalentTestsOnDevice",
    srcs: [
        "multivalentTests/src/**/*.kt",
    ],
    static_libs: [
        "WindowManager-Shell",
        "junit",
        "androidx.test.runner",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "frameworks-base-testutils",
        "mockito-kotlin2",
        "mockito-target-extended-minus-junit4",
        "truth",
        "platform-test-annotations",
        "platform-test-rules",
    ],
    libs: [
        "android.test.base",
        "android.test.runner",
    ],
    jni_libs: [
        "libdexmakerjvmtiagent",
        "libstaticjvmtiagent",
    ],
    kotlincflags: ["-Xjvm-default=all"],
    optimize: {
        enabled: false,
    },
    test_suites: ["device-tests"],
    platform_apis: true,
    certificate: "platform",
    aaptflags: [
        "--extra-packages",
        "com.android.wm.shell",
    ],
    manifest: "multivalentTests/AndroidManifest.xml",
}
+13 −0
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.wm.shell.multivalenttests">

    <application android:debuggable="true" android:supportsRtl="true" >
        <uses-library android:name="android.test.runner" />
    </application>

    <instrumentation
        android:name="androidx.test.runner.AndroidJUnitRunner"
        android:label="Multivalent tests for WindowManager-Shell"
        android:targetPackage="com.android.wm.shell.multivalenttests">
    </instrumentation>
</manifest>
+3 −0
Original line number Diff line number Diff line
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.android.wm.shell.multivalenttests">
</manifest>
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<configuration description="Runs Tests for WindowManagerShellLib">
    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="install-arg" value="-t" />
        <option name="test-file-name" value="WMShellMultivalentTestsOnDevice.apk" />
    </target_preparer>

    <option name="test-suite-tag" value="apct" />
    <option name="test-suite-tag" value="framework-base-presubmit" />
    <option name="test-tag" value="WMShellMultivalentTestsOnDevice" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.wm.shell.multivalenttests" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false"/>
    </test>
</configuration>
+2 −0
Original line number Diff line number Diff line
sdk=NEWEST_SDK
Loading