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

Unified Diff: base/test/android/javatests/src/org/chromium/base/test/util/parameter/parameters/CommandLineArgumentParameter.java

Issue 1414403002: Add CommandLineArgumentParameter and use it for WebView tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix-cr-526885-read-nested-annotations
Patch Set: Final version Created 5 years, 2 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: base/test/android/javatests/src/org/chromium/base/test/util/parameter/parameters/CommandLineArgumentParameter.java
diff --git a/base/test/android/javatests/src/org/chromium/base/test/util/parameter/parameters/CommandLineArgumentParameter.java b/base/test/android/javatests/src/org/chromium/base/test/util/parameter/parameters/CommandLineArgumentParameter.java
new file mode 100644
index 0000000000000000000000000000000000000000..6c73ece2b9eb3d7602d0c363acbdbf08440a171e
--- /dev/null
+++ b/base/test/android/javatests/src/org/chromium/base/test/util/parameter/parameters/CommandLineArgumentParameter.java
@@ -0,0 +1,42 @@
+// Copyright 2015 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.base.test.util.parameter.parameters;
+
+import org.chromium.base.test.util.parameter.BaseParameter;
+import org.chromium.base.test.util.parameter.Parameter;
+
+/**
+ * Instructs the test runner to execute the test with modified command-line flags.
+ * Flags to add are specified using 'stringArray' of argument named 'add',
+ * and flags to remove -- in the argument named 'remove'. A parameter without arguments
+ * instructs to run the test with default command-line flags.
+ *
+ * Example:
+ * @ParameterizedTest.Set(tests = {
+ * @ParameterizedTest(parameters = {
+ * @Parameter(
+ * tag = CommandLineArgumentParameter.PARAMETER_TAG)}),
+ * @ParameterizedTest(parameters = {
+ * @Parameter(
+ * tag = CommandLineArgumentParameter.PARAMETER_TAG,
+ * arguments = {
+ * @Parameter.Argument(
+ * name = CommandLineArgumentParameter.ADD_ARG,
+ * stringArray = {'--arg1', '--arg2'})
+ * })})})
+ *
+ * Note that because the entire instrumentation test process needs to be restarted to apply
+ * modified command-line arguments, this annotation is handled by test_runner.py, not by
+ * BaseTestResult class.
+ */
+public class CommandLineArgumentParameter extends BaseParameter {
jbudorick 2015/10/27 16:14:36 I'm not crazy about having both this and @CommandL
mnaganov (inactive) 2015/10/27 23:53:30 I thought about that, but what I disliked is wordi
jbudorick 2015/10/28 16:36:35 Yeah, that's pretty nasty. What about something l
+ public static final String PARAMETER_TAG = "cmdlinearg-parameter";
+ public static final String ADD_ARG = "add";
+ public static final String REMOVE_ARG = "remove";
+
+ public CommandLineArgumentParameter(Parameter.Reader parameterReader) {
+ super(PARAMETER_TAG, parameterReader);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698