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

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

Issue 2766393004: Convert most of the rest of instrumentation tests in content (Closed)
Patch Set: rebase Created 3 years, 8 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..4576cf030c9acf4e4b85f342bdfad11c957e3fdb 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,8 @@ package org.chromium.content.browser;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
+import org.chromium.base.test.SetUpStatement;
+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,8 +20,10 @@ import java.lang.annotation.Annotation;
* ActivityTestRule with common functionality for testing the Java Bridge.
*/
public class JavaBridgeActivityTestRule
- extends ContentShellActivityTestRule implements TestCommonCallback<ContentShellActivity> {
+ extends ContentShellActivityTestRule implements TestCommonCallback<ContentShellActivity>,
+ SetUpTestRule<JavaBridgeActivityTestRule> {
private JavaBridgeTestCommon mTestCommon;
+ private boolean mSetup = false;
public JavaBridgeActivityTestRule() {
super();
@@ -29,7 +33,7 @@ public class JavaBridgeActivityTestRule
/**
* Sets up the ContentView. Intended to be called from setUp().
*/
- private void setUpContentView() {
+ public void setUpContentView() {
mTestCommon.setUpContentView();
}
@@ -61,13 +65,19 @@ 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);
+ public Statement apply(Statement base, Description desc) {
+ SetUpStatement setUpBase = new SetUpStatement(base, this, mSetup);
+ return super.apply(setUpBase, desc);
+ }
+
+ @Override
+ public JavaBridgeActivityTestRule shouldSetUp(boolean runSetUp) {
+ mSetup = runSetUp;
+ return this;
+ }
+
+ @Override
+ public void setUp() {
+ setUpContentView();
}
}

Powered by Google App Engine
This is Rietveld 408576698