| 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);
|
| }
|
| }
|
|
|