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

Commit f1bafbef authored by Andrii Kulian's avatar Andrii Kulian Committed by android-build-merger
Browse files

Merge "Add unit tests for activity client state changes" into qt-dev

am: 153f73cb

Change-Id: I8d843d99025dac74f13d83224eacfdeca682a69c
parents 2ae53bea 153f73cb
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -27,5 +27,15 @@
                }
            ]
        }
    ],
    "postsubmit": [
        {
            "file_patterns": ["(/|^)ActivityThreadClientTest.java"],
            "name": "FrameworksMockingCoreTests"
        },
        {
            "file_patterns": ["(/|^)ActivityThreadTest.java"],
            "name": "FrameworksCoreTests"
        }
    ]
}
+53 −0
Original line number Diff line number Diff line
//
// Copyright (C) 2019 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.
//

android_test {
    name: "FrameworksMockingCoreTests",

    srcs: [
        "src/**/*.java",
    ],

    static_libs: [
        "frameworks-base-testutils",
        "services.core",
        "androidx.test.runner",
        "androidx.test.rules",
        "androidx.test.ext.junit",
        "mockito-target-extended-minus-junit4",
        "platform-test-annotations",
        "truth-prebuilt",
        "testables",
        "ub-uiautomator",
    ],

    libs: [
        "android.test.base",
        "android.test.mock",
        "android.test.runner",
    ],

    // These are not normally accessible from apps so they must be explicitly included.
    jni_libs: [
        "libdexmakerjvmtiagent",
        "libstaticjvmtiagent",
    ],

    platform_apis: true,
    test_suites: ["device-tests"],

    certificate: "platform",
}
+35 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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
  -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          android:installLocation="internalOnly"
          package="com.android.frameworks.mockingcoretests"
          android:sharedUserId="com.android.uid.test">

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

        <activity android:name="android.app.activity.ActivityThreadClientTest$TestActivity"
            android:exported="true">
        </activity>

    </application>

    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
            android:targetPackage="com.android.frameworks.mockingcoretests"
            android:label="Frameworks Mocking Core Tests" />
</manifest>
+31 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (C) 2019 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 Frameworks Mocking Core Tests.">
    <option name="test-suite-tag" value="apct" />
    <option name="test-suite-tag" value="apct-instrumentation" />

    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
        <option name="cleanup-apks" value="true" />
        <option name="test-file-name" value="FrameworksMockingCoreTests.apk" />
    </target_preparer>
    <option name="test-tag" value="FrameworksMockingCoreTests" />
    <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
        <option name="package" value="com.android.frameworks.mockingcoretests" />
        <option name="runner" value="androidx.test.runner.AndroidJUnitRunner" />
        <option name="hidden-api-checks" value="false"/>
    </test>
</configuration>
+33 −0
Original line number Diff line number Diff line
* Copyright (C) 2019 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.


INTRODUCTION

The Android platform core tests that require additional mocking capabilities and use Extended
Mockito, such as the ability to stub static methods. ExtendedMockito is not fully compatible with
regular Mockito library, so tests that use it have to be verified and adapted. For that reason a
separate module is used instead of adding to FrameworksCoreTests.

For more information about ExtendedMockito see documentation of
com.android.dx.mockito.inline.extended.ExtendedMockito class.

See ../coretests/README for more information on FrameworksCoreTests.


INSTRUCTIONS

To build, install and run:

  atest FrameworksMockingCoreTests
Loading