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

Unified Diff: chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java

Issue 2722243002: 📰 Add tests for Tile and TileGroup (Closed)
Patch Set: moar tests Created 3 years, 10 months 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: chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java b/chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java
index a1344931264634fd8e6d2afe2839ae0d1a941f93..bdc4a89cc417aa0b9c2f2c674f0f0c2154cd6534 100644
--- a/chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/EnableFeatures.java
@@ -12,6 +12,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
@@ -39,20 +40,26 @@
String[] value();
/**
- * Add this rule to tests to activate the {@link EnableFeatures} annotations and choose flags
- * to enable, or get rid of exceptions when the production code tries to check for enabled
- * features.
+ * Add this rule to tests get rid of exceptions when the production code tries to check for
+ * enabled features. It also activates the {@link EnableFeatures} annotation and allows to
+ * choose which features to enable. All are disabled by default.
Bernhard Bauer 2017/03/03 11:54:38 Ooh, there is one thing I had been thinking of: wo
dgn 2017/03/03 13:48:30 Yes we could do that. But I think it becomes inter
Bernhard Bauer 2017/03/03 14:01:22 Well, what I'm a bit worried about is if we make a
dgn 2017/03/03 15:53:45 Okay got it. In that case, I reverted the change t
*/
- public static class Processor extends AnnotationProcessor<EnableFeatures> {
+ class Processor extends AnnotationProcessor<EnableFeatures> {
public Processor() {
- super(EnableFeatures.class);
+ super(EnableFeatures.class, true);
}
@Override
protected void before() throws Throwable {
- Set<String> enabledFeatures = new HashSet<>();
- String[] values = getAnnotation().value();
- enabledFeatures.addAll(Arrays.asList(values));
+ Set<String> enabledFeatures;
+
+ if (getAnnotation() != null) {
+ String[] values = getAnnotation().value();
+ enabledFeatures = new HashSet<>(Arrays.asList(values));
+ } else {
+ enabledFeatures = Collections.emptySet();
+ }
+
ChromeFeatureList.setTestEnabledFeatures(enabledFeatures);
}

Powered by Google App Engine
This is Rietveld 408576698