Index: base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java |
diff --git a/base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java b/base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0a31a850b3a3142b381c54590188dd79221ef536 |
--- /dev/null |
+++ b/base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java |
@@ -0,0 +1,35 @@ |
+// Copyright 2017 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; |
+ |
+import org.junit.rules.TestRule; |
+ |
+/** |
+ * Interface to ensure TestRule that implements it specifies if it would run a set-up process |
jbudorick
2017/04/12 13:04:03
An interface for TestRules that can be configured
the real yoland
2017/04/12 20:56:19
Done
|
+ * before @Before. |
+ * |
+ * TestRule that implements this interface should return a {@link SetUpStatement} with |
jbudorick
2017/04/12 13:04:03
TestRules that implement this interface should ret
the real yoland
2017/04/12 20:56:19
Done
|
+ * its {@link TestRule#apply} method. |
+ * |
+ * @param <T> TestRule type that implements this SetUpTestRule |
+ */ |
+public interface SetUpTestRule<T extends TestRule> { |
+ /** |
+ * Set whether the TestRule should run setUp automatically. |
+ * |
+ * So TestRule can be declared in test like this: |
+ * <code> |
+ * @Rule TestRule mRule = new MySetUpTestRule().shouldSetUp(true); |
+ * </code> |
+ * |
+ * @return itself to chain up the calls for convenience |
+ */ |
+ T shouldSetUp(boolean runSetUp); |
+ |
+ /** |
+ * Specify setUp action in this method |
+ */ |
+ void setUp(); |
+} |