Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(575)

Unified Diff: testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java
diff --git a/testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java b/testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java
index 7b0e0f5e2c09c53b239ff819f8edf071074df419..a19b37945d8cee989bc54be4b2ad71e83c31df2b 100644
--- a/testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java
+++ b/testing/android/junit/javatests/src/org/chromium/testing/local/GtestFilterTest.java
@@ -17,102 +17,108 @@ import org.junit.runners.BlockJUnit4ClassRunner;
@RunWith(BlockJUnit4ClassRunner.class)
public class GtestFilterTest {
+ private class TestClass {}
+ private class OtherTestClass {}
+
@Test
public void testDescription() {
- Filter filterUnderTest = new GtestFilter("TestClass.*");
- Assert.assertEquals("gtest-filter: TestClass.*", filterUnderTest.describe());
+ Filter filterUnderTest = new GtestFilter(TestClass.class.getName() + ".*");
+ Assert.assertEquals("gtest-filter: " + TestClass.class.getName() + ".*",
+ filterUnderTest.describe());
}
@Test
public void testNoFilter() {
Filter filterUnderTest = new GtestFilter("");
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testPositiveFilterExplicit() {
- Filter filterUnderTest = new GtestFilter("TestClass.testMethod");
+ Filter filterUnderTest = new GtestFilter(TestClass.class.getName() + ".testMethod");
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testPositiveFilterClassRegex() {
- Filter filterUnderTest = new GtestFilter("TestClass.*");
+ Filter filterUnderTest = new GtestFilter(TestClass.class.getName() + ".*");
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testNegativeFilterExplicit() {
- Filter filterUnderTest = new GtestFilter("-TestClass.testMethod");
+ Filter filterUnderTest = new GtestFilter("-" + TestClass.class.getName() + ".testMethod");
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testNegativeFilterClassRegex() {
- Filter filterUnderTest = new GtestFilter("-TestClass.*");
+ Filter filterUnderTest = new GtestFilter("-" + TestClass.class.getName() + ".*");
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testPositiveAndNegativeFilter() {
- Filter filterUnderTest = new GtestFilter("TestClass.*-TestClass.testMethod");
+ Filter filterUnderTest = new GtestFilter(TestClass.class.getName() + ".*"
+ + "-" + TestClass.class.getName() + ".testMethod");
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
@Test
public void testMultiplePositiveFilters() {
Filter filterUnderTest = new GtestFilter(
- "TestClass.otherTestMethod:OtherTestClass.otherTestMethod");
+ TestClass.class.getName() + ".otherTestMethod:"
+ + OtherTestClass.class.getName() + ".otherTestMethod");
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "otherTestMethod")));
+ Description.createTestDescription(OtherTestClass.class, "otherTestMethod")));
}
@Test
public void testMultipleFiltersPositiveAndNegative() {
- Filter filterUnderTest = new GtestFilter("TestClass.*:-TestClass.testMethod");
+ Filter filterUnderTest = new GtestFilter(TestClass.class.getName() + ".*:"
+ + "-" + TestClass.class.getName() + ".testMethod");
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "testMethod")));
+ Description.createTestDescription(TestClass.class, "testMethod")));
Assert.assertTrue(filterUnderTest.shouldRun(
- Description.createTestDescription("TestClass", "otherTestMethod")));
+ Description.createTestDescription(TestClass.class, "otherTestMethod")));
Assert.assertFalse(filterUnderTest.shouldRun(
- Description.createTestDescription("OtherTestClass", "testMethod")));
+ Description.createTestDescription(OtherTestClass.class, "testMethod")));
}
-
}

Powered by Google App Engine
This is Rietveld 408576698