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

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

Issue 2840933004: Add ChromeTabbedActivityTestRules for JUnit4 instrumentation tests (Closed)
Patch Set: add TODO 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/ChromeTabbedActivityTestCommon.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/ChromeTabbedActivityTestRule.java
diff --git a/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeTabbedActivityTestRule.java b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeTabbedActivityTestRule.java
new file mode 100644
index 0000000000000000000000000000000000000000..6fd8809f7a7b1be7c9de21f5738882ba98b15dca
--- /dev/null
+++ b/chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeTabbedActivityTestRule.java
@@ -0,0 +1,47 @@
+// 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.view.View;
+
+import org.chromium.chrome.browser.ChromeTabbedActivity;
+import org.chromium.chrome.test.ChromeTabbedActivityTestCommon.ChromeTabbedActivityTestCommonCallback;
+
+/** Custom ActivityTestRule for test using ChromeTabbedActivity */
+public class ChromeTabbedActivityTestRule extends ChromeActivityTestRule<ChromeTabbedActivity>
+ implements ChromeTabbedActivityTestCommonCallback {
+ private final ChromeTabbedActivityTestCommon mTestCommon;
+
+ public ChromeTabbedActivityTestRule() {
+ super(ChromeTabbedActivity.class);
+ mTestCommon = new ChromeTabbedActivityTestCommon(this);
+ }
+
+ /**
+ * Load a url in multiple new tabs in parallel. Each {@link Tab} will pretend to be
+ * created from a link.
+ *
+ * @param url The url of the page to load.
+ * @param numTabs The number of tabs to open.
+ */
+ public void loadUrlInManyNewTabs(final String url, final int numTabs)
+ throws InterruptedException {
+ mTestCommon.loadUrlInManyNewTabs(url, numTabs);
+ }
+
+ /**
+ * Long presses the view, selects an item from the context menu, and
+ * asserts that a new tab is opened and is incognito if expectIncognito is true.
+ * @param view The View to long press.
+ * @param contextMenuItemId The context menu item to select on the view.
+ * @param expectIncognito Whether the opened tab is expected to be incognito.
+ * @param expectedUrl The expected url for the new tab.
+ */
+ public void invokeContextMenuAndOpenInANewTab(View view, int contextMenuItemId,
+ boolean expectIncognito, final String expectedUrl) throws InterruptedException {
+ mTestCommon.invokeContextMenuAndOpenInANewTab(
+ view, contextMenuItemId, expectIncognito, expectedUrl);
+ }
+}
« no previous file with comments | « chrome/test/android/javatests/src/org/chromium/chrome/test/ChromeTabbedActivityTestCommon.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698