summaryrefslogtreecommitdiff
path: root/ravenwood/junit-src
diff options
context:
space:
mode:
author Jeff Sharkey <jsharkey@google.com> 2023-12-05 11:28:28 -0700
committer Jeff Sharkey <jsharkey@google.com> 2023-12-05 13:57:51 -0700
commit256d907060c0080d3404125edf01daecd97d71c0 (patch)
tree7c865300f2750a986768c82382dfbe9b3a6d9ae1 /ravenwood/junit-src
parent7812cce9adbe283cf84b18584fdd52eb4d703958 (diff)
Support more internal utils under Ravenwood.
Tests for these internal utils are local within the frameworks/base/ repo, instead of in CTS. To help future-proof, bring the entire utils/* test directory by default into the Ravenwood suites, and give developers the way to easily opt-out with @IgnoreUnderRavenwood at the class level. Bug: 292141694 Test: atest FrameworksCoreTestsRavenwood FrameworksCoreTests Test: atest FrameworksUtilTestsRavenwood FrameworksUtilTests Change-Id: I5251dca752396faa77774659d0923d8cdb719830
Diffstat (limited to 'ravenwood/junit-src')
-rw-r--r--ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java2
-rw-r--r--ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java5
2 files changed, 5 insertions, 2 deletions
diff --git a/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java b/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java
index edb0442e7b29..916dd5943059 100644
--- a/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java
+++ b/ravenwood/junit-src/android/platform/test/annotations/IgnoreUnderRavenwood.java
@@ -36,7 +36,7 @@ import java.lang.annotation.Target;
*
* @hide
*/
-@Target(ElementType.METHOD)
+@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface IgnoreUnderRavenwood {
/**
diff --git a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
index 9db5b9895749..d175713eb92f 100644
--- a/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
+++ b/ravenwood/junit-src/android/platform/test/ravenwood/RavenwoodRule.java
@@ -93,7 +93,7 @@ public class RavenwoodRule implements TestRule {
/**
* Return if the current process is running under a Ravenwood test environment.
*/
- public boolean isUnderRavenwood() {
+ public static boolean isUnderRavenwood() {
return IS_UNDER_RAVENWOOD;
}
@@ -102,6 +102,9 @@ public class RavenwoodRule implements TestRule {
return new Statement() {
@Override
public void evaluate() throws Throwable {
+ if (description.getTestClass().getAnnotation(IgnoreUnderRavenwood.class) != null) {
+ Assume.assumeFalse(IS_UNDER_RAVENWOOD);
+ }
if (description.getAnnotation(IgnoreUnderRavenwood.class) != null) {
Assume.assumeFalse(IS_UNDER_RAVENWOOD);
}