summaryrefslogtreecommitdiff
path: root/test-runner
diff options
context:
space:
mode:
authorJiyong Park <jiyong@google.com>2020-05-29 10:51:18 +0900
committerJiyong Park <jiyong@google.com>2020-06-26 01:39:20 +0000
commitc357d960d9e754da3afc56cd6e17ea5e04e60068 (patch)
treeeb250f769368bd5fe703ab5277ef437e416c207b /test-runner
parent978aa81cf850de85574033eb31441d1d67729d7e (diff)
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.) Exempt-From-Owner-Approval: cherry-pick from master Bug: 157007292 Test: m Merged-In: I14cf217f21fd3534c920c3a6336cf2d14c02e60c (cherry picked from commit b4e458d1063a3ece9a7f539ed6dbaeb6fb9c495d) Change-Id: I14cf217f21fd3534c920c3a6336cf2d14c02e60c
Diffstat (limited to 'test-runner')
-rw-r--r--test-runner/Android.bp1
-rw-r--r--test-runner/api/current.txt1
-rw-r--r--test-runner/src/android/test/InstrumentationTestRunner.java1
3 files changed, 2 insertions, 1 deletions
diff --git a/test-runner/Android.bp b/test-runner/Android.bp
index 75f5b5a96eb1..1f6db8403eee 100644
--- a/test-runner/Android.bp
+++ b/test-runner/Android.bp
@@ -41,6 +41,7 @@ java_sdk_library {
],
compile_dex: true,
+ default_to_stubs: true,
}
// Build the android.test.runner-minus-junit library
diff --git a/test-runner/api/current.txt b/test-runner/api/current.txt
index 2c19a2e85410..5407b685bb34 100644
--- a/test-runner/api/current.txt
+++ b/test-runner/api/current.txt
@@ -78,6 +78,7 @@ package android.test {
@Deprecated public class InstrumentationTestRunner extends android.app.Instrumentation implements android.test.TestSuiteProvider {
ctor @Deprecated public InstrumentationTestRunner();
+ method @Deprecated protected void addTestListener(junit.framework.TestListener);
method @Deprecated public junit.framework.TestSuite getAllTests();
method @Deprecated protected android.test.AndroidTestRunner getAndroidTestRunner();
method @Deprecated public android.os.Bundle getArguments();
diff --git a/test-runner/src/android/test/InstrumentationTestRunner.java b/test-runner/src/android/test/InstrumentationTestRunner.java
index b2582c19b548..07e3f8736cc8 100644
--- a/test-runner/src/android/test/InstrumentationTestRunner.java
+++ b/test-runner/src/android/test/InstrumentationTestRunner.java
@@ -410,7 +410,6 @@ public class InstrumentationTestRunner extends Instrumentation implements TestSu
/**
* Add a {@link TestListener}
- * @hide
*/
protected void addTestListener(TestListener listener){
if(mTestRunner!=null && listener!=null){