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

Side by Side 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: Keep @CommenLineFlags 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.content.browser; 5 package org.chromium.content.browser;
6 6
7 import org.junit.runner.Description; 7 import org.junit.runner.Description;
8 import org.junit.runners.model.Statement; 8 import org.junit.runners.model.Statement;
9 9
10 import org.chromium.content.browser.test.util.TestCallbackHelperContainer; 10 import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
11 import org.chromium.content_shell_apk.ContentShellActivity; 11 import org.chromium.content_shell_apk.ContentShellActivity;
12 import org.chromium.content_shell_apk.ContentShellActivityTestRule; 12 import org.chromium.content_shell_apk.ContentShellActivityTestRule;
13 import org.chromium.content_shell_apk.ContentShellTestCommon.TestCommonCallback; 13 import org.chromium.content_shell_apk.ContentShellTestCommon.TestCommonCallback;
14 14
15 import java.lang.annotation.Annotation; 15 import java.lang.annotation.Annotation;
16 16
17 /** 17 /**
18 * ActivityTestRule with common functionality for testing the Java Bridge. 18 * ActivityTestRule with common functionality for testing the Java Bridge.
19 */ 19 */
20 public class JavaBridgeActivityTestRule 20 public class JavaBridgeActivityTestRule
21 extends ContentShellActivityTestRule implements TestCommonCallback<Conte ntShellActivity> { 21 extends ContentShellActivityTestRule implements TestCommonCallback<Conte ntShellActivity> {
22 private JavaBridgeTestCommon mTestCommon; 22 private JavaBridgeTestCommon mTestCommon;
23 private final boolean mSetup;
23 24
24 public JavaBridgeActivityTestRule() { 25 public JavaBridgeActivityTestRule() {
26 this(true);
27 }
28
29 public JavaBridgeActivityTestRule(boolean setUp) {
jbudorick 2017/04/04 00:39:55 Should this use https://codereview.chromium.org/27
the real yoland 2017/04/04 17:41:25 Yes, will change to that once it lands
25 super(); 30 super();
31 mSetup = setUp;
26 mTestCommon = new JavaBridgeTestCommon(this); 32 mTestCommon = new JavaBridgeTestCommon(this);
27 } 33 }
28 34
29 /** 35 /**
30 * Sets up the ContentView. Intended to be called from setUp(). 36 * Sets up the ContentView. Intended to be called from setUp().
31 */ 37 */
32 private void setUpContentView() { 38 public void setUpContentView() {
33 mTestCommon.setUpContentView(); 39 mTestCommon.setUpContentView();
34 } 40 }
35 41
36 public TestCallbackHelperContainer getTestCallBackHelperContainer() { 42 public TestCallbackHelperContainer getTestCallBackHelperContainer() {
37 return mTestCommon.getTestCallBackHelperContainer(); 43 return mTestCommon.getTestCallBackHelperContainer();
38 } 44 }
39 45
40 public void executeJavaScript(String script) throws Throwable { 46 public void executeJavaScript(String script) throws Throwable {
41 mTestCommon.executeJavaScript(script); 47 mTestCommon.executeJavaScript(script);
42 } 48 }
(...skipping 15 matching lines...) Expand all
58 64
59 public void synchronousPageReload() throws Throwable { 65 public void synchronousPageReload() throws Throwable {
60 mTestCommon.synchronousPageReload(); 66 mTestCommon.synchronousPageReload();
61 } 67 }
62 68
63 @Override 69 @Override
64 public Statement apply(final Statement base, Description desc) { 70 public Statement apply(final Statement base, Description desc) {
65 return super.apply(new Statement() { 71 return super.apply(new Statement() {
66 @Override 72 @Override
67 public void evaluate() throws Throwable { 73 public void evaluate() throws Throwable {
68 setUpContentView(); 74 if (mSetup) {
75 setUpContentView();
76 }
69 base.evaluate(); 77 base.evaluate();
70 } 78 }
71 }, desc); 79 }, desc);
72 } 80 }
73 } 81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698