| Index: base/test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java
|
| diff --git a/base/test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java b/base/test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java
|
| index efca73402ebd05f289498f397dbf05c6a0eb70e6..9cc96dc14c39edaa1d8711a7279b37db34a14d9b 100644
|
| --- a/base/test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java
|
| +++ b/base/test/android/junit/src/org/chromium/base/test/util/SkipCheckTest.java
|
| @@ -10,6 +10,7 @@ import org.chromium.testing.local.LocalRobolectricTestRunner;
|
| import org.junit.Assert;
|
| import org.junit.Test;
|
| import org.junit.runner.RunWith;
|
| +import org.junit.runners.model.FrameworkMethod;
|
| import org.robolectric.annotation.Config;
|
|
|
| import java.lang.annotation.Annotation;
|
| @@ -30,8 +31,12 @@ public class SkipCheckTest {
|
| return getAnnotations(element, annotationClass);
|
| }
|
|
|
| + public static FrameworkMethod getTestFrameworkMethodForTesting(TestCase testCase) {
|
| + return getTestFrameworkMethod(testCase);
|
| + }
|
| +
|
| @Override
|
| - public boolean shouldSkip(TestCase t) {
|
| + public boolean shouldSkip(FrameworkMethod m) {
|
| return false;
|
| }
|
| }
|
| @@ -39,11 +44,6 @@ public class SkipCheckTest {
|
| @Retention(RetentionPolicy.RUNTIME)
|
| private @interface TestAnnotation {}
|
|
|
| - private class UnannotatedBaseClass {
|
| - public void unannotatedMethod() {}
|
| - @TestAnnotation public void annotatedMethod() {}
|
| - }
|
| -
|
| @TestAnnotation
|
| private class AnnotatedBaseClass {
|
| public void unannotatedMethod() {}
|
| @@ -54,6 +54,18 @@ public class SkipCheckTest {
|
| public void anotherUnannotatedMethod() {}
|
| }
|
|
|
| + private class ExtendsTestCaseClass extends TestCase {
|
| + public ExtendsTestCaseClass(String name) {
|
| + super(name);
|
| + }
|
| + public void testMethodA() {}
|
| + }
|
| +
|
| + private class UnannotatedBaseClass {
|
| + public void unannotatedMethod() {}
|
| + @TestAnnotation public void annotatedMethod() {}
|
| + }
|
| +
|
| @Test
|
| public void getAnnotationsForClassNone() {
|
| List<TestAnnotation> annotations = TestableSkipCheck.getAnnotationsForTesting(
|
| @@ -120,4 +132,20 @@ public class SkipCheckTest {
|
| Assert.assertEquals(2, annotations.size());
|
| }
|
|
|
| + @Test
|
| + public void getExistingTestFrameworkMethod() {
|
| + String testMethodName = "testMethodA";
|
| + ExtendsTestCaseClass testCase = new ExtendsTestCaseClass(testMethodName);
|
| + FrameworkMethod method = TestableSkipCheck.getTestFrameworkMethodForTesting(testCase);
|
| + Assert.assertNotNull(method);
|
| + Assert.assertTrue(testMethodName.equals(method.getName()));
|
| + }
|
| +
|
| + @Test
|
| + public void getNoneTestFrameworkMethod() {
|
| + String testMethodName = "noSuchTestMethod";
|
| + ExtendsTestCaseClass testCase = new ExtendsTestCaseClass(testMethodName);
|
| + FrameworkMethod method = TestableSkipCheck.getTestFrameworkMethodForTesting(testCase);
|
| + Assert.assertNull(method);
|
| + }
|
| }
|
|
|