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

Unified Diff: base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java

Issue 2770393002: Add setup action interface (Closed)
Patch Set: Move SetUpStatement to its own file Created 3 years, 9 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/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..33aa056ab09dd3d1e890b9fe02059449a297a762
--- /dev/null
+++ b/base/test/android/javatests/src/org/chromium/base/test/SetUpTestRule.java
@@ -0,0 +1,32 @@
+// 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;
+
+/**
jbudorick 2017/04/10 19:08:45 This comment should mention the relation to SetUpS
the real yoland 2017/04/12 00:52:34 Done
+ * Interface to ensure TestRule that implements it specifies if it would run a set-up process
+ * before @Before.
+ *
+ * @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>
+ * &#064;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();
+}

Powered by Google App Engine
This is Rietveld 408576698