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

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

Issue 11743011: Add history popup when long pressing on the back key. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use a padding drawable for null favicons to avoid jumping UI. Created 7 years, 12 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 | « content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9caff9616e568eb174b928e247dd1f1f19ffd2b9..23637df82ec4ea8a81769d91417cb25a4039bd09 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
@@ -10,14 +10,17 @@ import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
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.LoadUrlParams;
+import org.chromium.content.browser.test.util.CallbackHelper;
import org.chromium.content.browser.test.util.Criteria;
import org.chromium.content.browser.test.util.CriteriaHelper;
+import org.chromium.content.browser.test.util.TestCallbackHelperContainer;
+
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Base test class for all ContentShell based tests.
@@ -27,6 +30,8 @@ public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte
/** The maximum time the waitForActiveShellToBeDoneLoading method will wait. */
private static final long WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT = 10000;
+ protected static final int WAIT_PAGE_LOADING_TIMEOUT_SECONDS = 15;
+
public ContentShellTestBase() {
super(ContentShellActivity.class);
}
@@ -144,4 +149,39 @@ public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte
}
}, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
}
+
+ /**
+ * Loads a URL in the specified content view.
+ *
+ * @param contentView The content view to load the URL in.
+ * @param callbackHelperContainer The callback helper container used to monitor progress.
+ * @param params The URL params to use.
+ */
+ protected void loadUrl(
+ final ContentView contentView, TestCallbackHelperContainer callbackHelperContainer,
+ final LoadUrlParams params) throws Throwable {
+ handleBlockingCallbackAction(
+ callbackHelperContainer.getOnPageFinishedHelper(),
+ new Runnable() {
+ @Override
+ public void run() {
+ contentView.loadUrl(params);
+ }
+ });
+ }
+
+ /**
+ * Handles performing an action on the UI thread that will return when the specified callback
+ * is incremented.
+ *
+ * @param callbackHelper The callback helper that will be blocked on.
+ * @param action The action to be performed on the UI thread.
+ */
+ protected void handleBlockingCallbackAction(
+ CallbackHelper callbackHelper, Runnable action) throws Throwable {
+ int currentCallCount = callbackHelper.getCallCount();
+ runTestOnUiThread(action);
+ callbackHelper.waitForCallback(
+ currentCallCount, 1, WAIT_PAGE_LOADING_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+ }
}
« no previous file with comments | « content/public/android/javatests/src/org/chromium/content/browser/NavigationTest.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698