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

Unified Diff: chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java

Issue 2847933002: Convert MultiActivityTestBase children to JUnit4 (Closed)
Patch Set: Add imports and 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
« no previous file with comments | « chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestCommon.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java
new file mode 100644
index 0000000000000000000000000000000000000000..98440c53f1bef7c19b7e0ff50c81b55d5c66a612
--- /dev/null
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestRule.java
@@ -0,0 +1,60 @@
+// 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.chrome.test;
+
+import android.app.Instrumentation;
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+import org.chromium.chrome.browser.ChromeActivity;
+import org.chromium.chrome.test.MultiActivityTestCommon.MultiActivityTestCommonCallback;
+import org.chromium.chrome.test.util.browser.tabmodel.document.MockStorageDelegate;
+
+/** Custom TestRule for MultiActivity Tests. */
+public class MultiActivityTestRule implements TestRule, MultiActivityTestCommonCallback {
+ private final MultiActivityTestCommon mTestCommon;
+
+ public MultiActivityTestRule() {
+ mTestCommon = new MultiActivityTestCommon(this);
+ }
+
+ public MockStorageDelegate getStorageDelegate() {
+ return mTestCommon.mStorageDelegate;
+ }
+
+ public Context getContext() {
+ return mTestCommon.mContext;
+ }
+
+ public void waitForFullLoad(final ChromeActivity activity, final String expectedTitle) {
+ mTestCommon.waitForFullLoad(activity, expectedTitle);
+ }
+
+ public void waitForFullLoad(
+ final ChromeActivity activity, final String expectedTitle, boolean waitLongerForLoad) {
+ mTestCommon.waitForFullLoad(activity, expectedTitle, waitLongerForLoad);
+ }
+
+ @Override
+ public Statement apply(final Statement base, Description desc) {
+ return new Statement() {
+ @Override
+ public void evaluate() throws Throwable {
+ mTestCommon.setUp();
+ base.evaluate();
+ mTestCommon.tearDown();
+ }
+ };
+ }
+
+ @Override
+ public Instrumentation getInstrumentation() {
+ return InstrumentationRegistry.getInstrumentation();
+ }
+}
« no previous file with comments | « chrome/test/android/javatests/src/org/chromium/chrome/test/MultiActivityTestCommon.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698