Index: base/test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java |
diff --git a/base/test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java b/base/test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java |
index 3e97532defd47333206199f04b187891c359919a..5c7e82e1ce4cb468b98ad0c1e18f25783bd716e4 100644 |
--- a/base/test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java |
+++ b/base/test/android/javatests/src/org/chromium/base/test/util/CommandLineFlags.java |
@@ -6,7 +6,7 @@ package org.chromium.base.test.util; |
import android.content.Context; |
-import junit.framework.Assert; |
+import org.junit.Assert; |
import org.chromium.base.BaseChromiumApplication; |
import org.chromium.base.CommandLine; |
@@ -60,26 +60,34 @@ public final class CommandLineFlags { |
} |
/** |
- * Sets up the CommandLine with the appropriate flags. |
+ * Sets up the CommandLine flags using a set of flag strings. |
* |
- * This will add the difference of the sets of flags specified by {@link CommandLineFlags.Add} |
- * and {@link CommandLineFlags.Remove} to the {@link org.chromium.base.CommandLine}. Note that |
- * trying to remove a flag set externally, i.e. by the command-line flags file, will not work. |
+ * This will add {@code flags} to the {@link org.chromium.base.CommandLine}. |
*/ |
- public static void setUp(Context targetContext, AnnotatedElement element) { |
+ public static void setUp(Context targetContext, Set<String> flags) { |
Assert.assertNotNull("Unable to get a non-null target context.", targetContext); |
CommandLine.reset(); |
BaseChromiumApplication.initCommandLine(targetContext); |
- Set<String> flags = getFlags(element); |
for (String flag : flags) { |
CommandLine.getInstance().appendSwitch(flag); |
} |
} |
+ /** |
+ * Sets up the CommandLine with the appropriate flags. |
+ * |
+ * This will add the difference of the sets of flags specified by {@link CommandLineFlags.Add} |
+ * and {@link CommandLineFlags.Remove} to the {@link org.chromium.base.CommandLine}. Note that |
+ * trying to remove a flag set externally, i.e. by the command-line flags file, will not work. |
+ */ |
+ public static void setUp(Context targetContext, AnnotatedElement element) { |
+ setUp(targetContext, getFlags(element)); |
+ } |
+ |
private static Set<String> getFlags(AnnotatedElement element) { |
AnnotatedElement parent = (element instanceof Method) |
? ((Method) element).getDeclaringClass() |
- : ((Class) element).getSuperclass(); |
+ : ((Class<?>) element).getSuperclass(); |
Set<String> flags = (parent == null) ? new HashSet<String>() : getFlags(parent); |
if (element.isAnnotationPresent(CommandLineFlags.Add.class)) { |