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

Unified Diff: content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java

Issue 2770393002: Add setup action interface (Closed)
Patch Set: 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: content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java
index ba3d5cfa664603720c3ce49d691b71863f9e5157..3e3ee3e4dcc55695a21c86a7710ea7469dced3af 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/JavaBridgeActivityTestRule.java
@@ -7,6 +7,7 @@ package org.chromium.content.browser;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
+import org.chromium.base.test.SetUpTestRule;
import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
import org.chromium.content_shell_apk.ContentShellActivity;
import org.chromium.content_shell_apk.ContentShellActivityTestRule;
@@ -18,13 +19,10 @@ import java.lang.annotation.Annotation;
* ActivityTestRule with common functionality for testing the Java Bridge.
*/
public class JavaBridgeActivityTestRule
- extends ContentShellActivityTestRule implements TestCommonCallback<ContentShellActivity> {
- private JavaBridgeTestCommon mTestCommon;
-
- public JavaBridgeActivityTestRule() {
- super();
- mTestCommon = new JavaBridgeTestCommon(this);
- }
+ extends ContentShellActivityTestRule implements TestCommonCallback<ContentShellActivity>,
+ SetUpTestRule<JavaBridgeActivityTestRule> {
+ private JavaBridgeTestCommon mTestCommon = new JavaBridgeTestCommon(this);
+ private boolean mRunSetUp = false;
/**
* Sets up the ContentView. Intended to be called from setUp().
@@ -62,12 +60,17 @@ public class JavaBridgeActivityTestRule
@Override
public Statement apply(final Statement base, Description desc) {
- return super.apply(new Statement() {
- @Override
- public void evaluate() throws Throwable {
- setUpContentView();
- base.evaluate();
- }
- }, desc);
+ return super.apply(new SetUpStatement(base, this, mRunSetUp), desc);
mikecase (-- gone --) 2017/03/27 18:40:59 guessing this needs to be SetUpTestRule.SetUpState
the real yoland 2017/03/27 20:52:36 Done
+ }
+
+ @Override
+ public JavaBridgeActivityTestRule shouldSetUp(boolean shouldSetUp) {
+ mRunSetUp = shouldSetUp;
+ return this;
+ }
+
+ @Override
+ public void setUp() {
+ setUpContentView();
}
}

Powered by Google App Engine
This is Rietveld 408576698