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

Unified Diff: content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java

Issue 11348361: Add insertion handle tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More findbugs :( Created 8 years 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/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
diff --git a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
index 0b5c9715d02ae0ccc9e1269559cdd70eb35e0083..9caff9616e568eb174b928e247dd1f1f19ffd2b9 100644
--- a/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
+++ b/content/shell/android/javatests/src/org/chromium/content_shell/ContentShellTestBase.java
@@ -13,6 +13,9 @@ import android.text.TextUtils;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import org.chromium.base.test.util.UrlUtils;
+import org.chromium.content.browser.ContentView;
+import org.chromium.content.browser.ContentViewCore;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
@@ -56,6 +59,49 @@ public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte
return getActivity();
}
+ // TODO(cjhopman): These functions are inconsistent with launchContentShell***. Should be
+ // startContentShell*** and should use the url exactly without the getTestFileUrl call. Possibly
+ // these two ways of starting the activity (launch* and start*) should be merged into one.
+ /**
+ * Starts the content shell activity with the provided test url.
+ * The url is synchronously loaded.
+ * @param url Test url to load.
+ */
+ protected void startActivityWithTestUrl(String url) throws Throwable {
+ launchContentShellWithUrl(UrlUtils.getTestFileUrl(url));
+ assertNotNull(getActivity());
+ assertTrue(waitForActiveShellToBeDoneLoading());
+ assertEquals(UrlUtils.getTestFileUrl(url), getContentView().getUrl());
+ }
+
+ /**
+ * Starts the content shell activity with the provided test url and optional command line
+ * arguments to append.
+ * The url is synchronously loaded.
+ * @param url Test url to load.
+ * @param commandLineArgs Optional command line args to append when launching the activity.
+ */
+ protected void startActivityWithTestUrlAndCommandLineArgs(
+ String url, String[] commandLineArgs) throws Throwable {
+ launchContentShellWithUrlAndCommandLineArgs(
+ UrlUtils.getTestFileUrl(url), commandLineArgs);
+ assertNotNull(getActivity());
+ assertTrue(waitForActiveShellToBeDoneLoading());
+ }
+
+ /**
+ * Returns the current ContentView.
+ */
+ protected ContentView getContentView() {
+ return getActivity().getActiveShell().getContentView();
+ }
+
+ /**
+ * Returns the current ContentViewCore or null if there is no ContentView.
+ */
+ protected ContentViewCore getContentViewCore() {
+ return getContentView() == null ? null : getContentView().getContentViewCore();
+ }
/**
* Waits for the Active shell to finish loading. This times out after

Powered by Google App Engine
This is Rietveld 408576698