Index: testing/android/junit/java/src/org/chromium/testing/local/PackageFilter.java |
diff --git a/testing/android/junit/java/src/org/chromium/testing/local/PackageFilter.java b/testing/android/junit/java/src/org/chromium/testing/local/PackageFilter.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4d6a580d47f587708ac2f4b0301c276837b89b6c |
--- /dev/null |
+++ b/testing/android/junit/java/src/org/chromium/testing/local/PackageFilter.java |
@@ -0,0 +1,41 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+package org.chromium.testing.local; |
+ |
+import org.junit.runner.Description; |
+import org.junit.runner.manipulation.Filter; |
+ |
+/** |
+ * Filters tests based on the package. |
+ */ |
+class PackageFilter extends Filter { |
+ |
+ private final String mFilterString; |
+ |
+ /** |
+ * Creates the filter. |
+ */ |
+ public PackageFilter(String filterString) { |
+ mFilterString = filterString; |
+ } |
+ |
+ /** |
+ * Determines whether or not a test with the provided description should |
+ * run based on its package. |
+ */ |
+ @Override |
+ public boolean shouldRun(Description description) { |
+ return description.getTestClass().getPackage().getName().equals(mFilterString); |
+ } |
+ |
+ /** |
+ * Returns a description of this filter. |
+ */ |
+ @Override |
+ public String describe() { |
+ return "package-filter: " + mFilterString; |
+ } |
+ |
+} |