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

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

Issue 11085008: [Android] Upstream content detection and ChromeBrowserProvider tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clean-up for review. Created 8 years, 2 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
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 1c633db176f3e4127e949dae83c1d33f88785f85..68d7b8f3c108fa443e1664d9a52682e0610204e1 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
@@ -21,29 +21,47 @@ import org.chromium.content.browser.test.util.CriteriaHelper;
*/
public class ContentShellTestBase extends ActivityInstrumentationTestCase2<ContentShellActivity> {
+ /** The maximum time the waitForActiveShellToBeDoneLoading method will wait. */
+ private static final long WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT = 10000;
+
public ContentShellTestBase() {
super(ContentShellActivity.class);
}
/**
* Starts the ContentShell activity and loads the given URL.
+ * The URL can be null, in which case will default to ContentShellActivity.DEFAULT_SHELL_URL.
*/
protected ContentShellActivity launchContentShellWithUrl(String url) {
+ return launchContentShellWithUrlAndCommandLineArgs(url, null);
+ }
+
+ /**
+ * Starts the ContentShell activity appending the provided command line arguments
+ * and loads the given URL. The URL can be null, in which case will default to
+ * ContentShellActivity.DEFAULT_SHELL_URL.
+ */
+ protected ContentShellActivity launchContentShellWithUrlAndCommandLineArgs(String url,
+ String[] commandLineArgs) {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_LAUNCHER);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- intent.setData(Uri.parse(url));
+ if (url != null) intent.setData(Uri.parse(url));
intent.setComponent(new ComponentName(getInstrumentation().getTargetContext(),
ContentShellActivity.class));
+ if (commandLineArgs != null) {
+ intent.putExtra(ContentShellActivity.COMMAND_LINE_ARGS_KEY, commandLineArgs);
+ }
setActivityIntent(intent);
return getActivity();
}
+
/**
- * Waits for the Active shell to finish loading. This times out after three seconds,
- * so it shouldn't be used for long loading pages. Instead it should be used more for
- * test initialization. The proper way to wait is to use a TestCallbackHelperContainer
- * after the initial load is completed.
+ * Waits for the Active shell to finish loading. This times out after
+ * WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT milliseconds and it shouldn't be used for long
+ * loading pages. Instead it should be used more for test initialization. The proper way
+ * to wait is to use a TestCallbackHelperContainer after the initial load is completed.
* @return Whether or not the Shell was actually finished loading.
* @throws Exception
*/
@@ -78,6 +96,6 @@ public class ContentShellTestBase extends ActivityInstrumentationTestCase2<Conte
return false;
}
}
- });
+ }, WAIT_FOR_ACTIVE_SHELL_LOADING_TIMEOUT, CriteriaHelper.DEFAULT_POLLING_INTERVAL);
}
}

Powered by Google App Engine
This is Rietveld 408576698