13 Commits

Author SHA1 Message Date
Jiyong Park
912db8daaf Don't use impl lib of android.test.[mock|base|runners]
The java_sdk_library modules are now added with 'default_to_stubs: true'
so that their impl libraries are not used even when the clients don't
have sdk_version property set.

This will allow us to replace the direct references to the stub
libraries of the java_sdk_library modules with the references to the
modules themselves (e.g. android.test.base.stubs -> android.test.base)
in many of the CTS tests without unintentionally exposing the private
APIs in the impl lib.

As part of the change, MockContentProvider.getIContentProviderBinder()
now returns an anonymous Binder object instead of throwing an exception.
This is to eliminate the need for clients to override the now
inaccessible method to escape from the exception.

Also, InstrumentationTestRunner.addTestListener method is added to the
stub because it is used by several tests (MtpServiceTests, etc.)

Bug: 157007292
Test: m
Merged-In: I14cf217f21fd3534c920c3a6336cf2d14c02e60c
(cherry picked from commit b4e458d1063a3ece9a7f539ed6dbaeb6fb9c495d)
Change-Id: I14cf217f21fd3534c920c3a6336cf2d14c02e60c
2020-06-26 09:42:06 +09:00
Jiyong Park
edb968e237 Make LaunchPerformanceBase and UnitTestSuiteBuilder as APIs
Those two classes are used by many tests using android.test.runner.
Making them as public APIs so that those tests can depend on the public
stub of android.test.runner and stop depending on its implementation
library.

Bug: 157007292
Test: m

Change-Id: I33b458f34ffd4c73430f538a85aac308baa6e010
2020-06-12 11:08:57 +09:00
Paul Duffin
ee5a4af4c5 Add lint-baseline.txt files for test base/runner/mock
In preparation for enabling API lint checking on java_sdk_library
adds lint-baseline.txt containing all the existing issues for these
APIs.

The test-base and test-runner APIs are old and have been deprecated
so there is little benefit in fixing those issues.

The test-mock API while old has not been deprecated and so should be
cleaned up. Bug 156175891 tracks that cleanup work.

Bug: 156126315
Bug: 156175891
Test: m checkapi
Change-Id: Ifb4669fcf7f2a36e5cb4d593bfc5d03330901ee9
2020-05-10 19:26:45 +01:00
Paul Duffin
507cbc4e58 Add TEST_MAPPING for api specifications
Changes to the various api directories will run the
tests which make use of the API specification in those directories.

Could not include CtsSystemApiSignatureTestCases as it is broken on
git_master because of bug 116632058.

Bug: 123254057
Test: atest
Change-Id: I1fe4ca498cbd0393aba7cf4c1386a6325ace7937
2019-02-06 13:57:42 +00:00
Tor Norbye
8752dedb76 Update signature files to the new format
The new format is described in tools/metalava/FORMAT.md.

Fixes: 116589402 Switch signature files over to the v2 format
Fixes: 112626813 Drop "synchronized" modifier from the signature format
Fixes: 122358225 Omit overriding methods that only differ in final [...]
Fixes: 73088715 API Review: Need doclava to output nullability
Fixes: 79739773 API Review: Metalava enforcing constants are constant
Exempt-From-Owner-Approval: Large-scale tooling change
Test: make sdk, make update-api, make checkapi
Change-Id: I8314f4e7099fa92e4f8ed7d283ccf836cc9a84a0
Merged-In: Ia248aece5250e84e47c815c601133b698bf644c2
2019-01-19 07:22:55 -08:00
Sundong Ahn
26420f6345 Switch to metalava
android.test.base and android.test.runner libraries are changed to using
metalava instead of docalava

Bug: 119625999
Test: m -j
Change-Id: I589ea59240f8b5d442931a1f1b614221d9eaf221
2018-12-12 18:38:46 +09:00
Sundong Ahn
e933cedf83 Build android.test.* with java_sdk_library
android.test.* are built with java_sdk_library and api files are added
by running "make update-api".

android.test.base_static is created for allowing to use
android.test.base as a static library.

Bug:77577799
Test: make -j
Test: make checkapi
Test: make checkapi fails with a random change in the txt file
Test: adb shell cmd package list libraries |\
      grep android.test.*
      And check the android.test.* libraries

Merged-In: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
Change-Id: Ia27612657532e50b077a9c55dbef59ee3ec04b8a
2018-08-29 12:22:59 +09:00
Paul Duffin
69516f4df7 Separate android.test.mock from test-runner source
Extracts the source for the android.test.mock library from the
frameworks/base/test-runner directory into its own
frameworks/base/test-mock directory. They are already treated separately
at runtime and compile time so this just makes the separation complete.

Bug: 30188076
Test: make checkbuild
Change-Id: I20e5b06ba79677e76117c82e9f9e2ecd15e5fed6
Merged-In: I20e5b06ba79677e76117c82e9f9e2ecd15e5fed6
(cherry picked from commit e254526f0fe5d22681555bd4a00b7ee96fee1dc1)
2017-12-12 23:23:31 +00:00
Jeff Sharkey
2337aec921 Deeper sanity checking of emitted types.
When emitting a method or field, verify that we're able to reference
all mentioned types.  This ensures that we don't accidentally
reference undefined classes/interfaces.

Test: manual inspection of API files
Bug: 69791141
Change-Id: I84e0c87fe83daa118661f61dbdf17b58ea5282d4
Merged-In: I84e0c87fe83daa118661f61dbdf17b58ea5282d4
2017-12-07 00:22:25 -07:00
Jeff Sharkey
bc4f48b21d Emit all APIs using Predicates.
Generate APIs using updated doclava.

Test: manual inspection of API text files
Bug: 69505783
Change-Id: I2efd22998a64ebb57588b073c4a591242f4aef91
Merged-In: I2efd22998a64ebb57588b073c4a591242f4aef91
2017-12-06 21:56:12 -07:00
Todd Kennedy
9da8b8a7fc Add new API to retrieve app names in a batch
Change-Id: I57e5c132bc58a32d70007a7a105775b526ff7bb9
Fixes: 62805090
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_null
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_empty
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.pm.cts.PackageManagerTest#testGetNamesForUids_valid
2017-07-31 11:29:37 -07:00
Paul Duffin
09c29c1324 Update android.test.runner API
Bug 62675475 changed DocLava to add some missing methods to the API
definition file. This updates the API definition for the
android.test.runner API.

The reason this was not found when it was uploaded is because there is a
discrepancy between the checkapi target and the update-api. The checkapi
target will not detect that the update-api needs to make changes. This
issue has been reported.

Bug: 30188076
Test: make update-api && make checkapi
Change-Id: I598774d3239d58eb5c58ff78e24e8ca84078e64a
2017-06-29 10:32:44 +01:00
Paul Duffin
bacad4088d Stubs/api check for legacy-test and android.test.runner
Adds stub generation for legacy-test classes and android.test.runner
classes. Changes name of android.test.mock.sdk to
android.test.mock.stubs for consistency and clarity, adds new
temporary android.test.mock.sdk target to prevent build breakage.

Adds api check and update targets for legacy.test.stubs,
android.test.runner.stubs and android.test.mock.stubs to prevent
accidental changes to the API.

Bug: 30188076
Test: make checkapi and make update-api
Change-Id: I40cc7b967f1ab1c7e148407d6965526550ee2f9b
2017-06-28 12:55:31 +01:00