From 6ea9b656cd9aeedcf6537509d781dec47efb298f Mon Sep 17 00:00:00 2001 From: "tedchoc@chromium.org" Date: Wed, 7 Nov 2012 04:53:26 +0000 Subject: Fix adb_run_content_shell to correctly pass URL. Also fixes testshell to support launching with a URL and triggering new intents (and fixes it's adb_run_chromium_testshell. BUG=159602 Review URL: https://chromiumcodereview.appspot.com/11377011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166357 0039d316-1c4b-4281-b951-d872f2087c98 --- build/android/adb_run_chromium_testshell | 2 +- build/android/adb_run_content_shell | 2 +- chrome/android/testshell/java/AndroidManifest.xml | 1 + .../chromium/chrome/testshell/ChromiumTestShellActivity.java | 4 ++++ .../java/src/org/chromium/chrome/testshell/TabManager.java | 11 ++++++++++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/build/android/adb_run_chromium_testshell b/build/android/adb_run_chromium_testshell index 7829a76..b17482c 100755 --- a/build/android/adb_run_chromium_testshell +++ b/build/android/adb_run_chromium_testshell @@ -5,7 +5,7 @@ # found in the LICENSE file. if [ $# -gt 0 ] ; then - INTENT_ARGS='-d "$1"' # e.g. a URL + INTENT_ARGS="-d \"$1\"" # e.g. a URL fi adb shell am start \ diff --git a/build/android/adb_run_content_shell b/build/android/adb_run_content_shell index bfc7367..ea92f5a 100755 --- a/build/android/adb_run_content_shell +++ b/build/android/adb_run_content_shell @@ -5,7 +5,7 @@ # found in the LICENSE file. if [ $# -gt 0 ] ; then - INTENT_ARGS='-d "$1"' # e.g. a URL + INTENT_ARGS="-d \"$1\"" # e.g. a URL fi adb shell am start \ diff --git a/chrome/android/testshell/java/AndroidManifest.xml b/chrome/android/testshell/java/AndroidManifest.xml index 8990f3a..2806af9 100644 --- a/chrome/android/testshell/java/AndroidManifest.xml +++ b/chrome/android/testshell/java/AndroidManifest.xml @@ -16,6 +16,7 @@ android:label="ChromiumTestShell"> diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java index 489dc77..ede99c1 100644 --- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java +++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/ChromiumTestShellActivity.java @@ -46,6 +46,10 @@ public class ChromiumTestShellActivity extends Activity { setContentView(R.layout.testshell_activity); mTabManager = (TabManager) findViewById(R.id.tab_manager); + String startupUrl = getUrlFromIntent(getIntent()); + if (!TextUtils.isEmpty(startupUrl)) { + mTabManager.setStartupUrl(startupUrl); + } mWindow = new ActivityNativeWindow(this); mWindow.restoreInstanceState(savedInstanceState); diff --git a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/TabManager.java b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/TabManager.java index f072a6d..649b40f 100644 --- a/chrome/android/testshell/java/src/org/chromium/chrome/testshell/TabManager.java +++ b/chrome/android/testshell/java/src/org/chromium/chrome/testshell/TabManager.java @@ -35,6 +35,8 @@ public class TabManager extends LinearLayout { private TabBase mCurrentTab; + private String mStartupUrl = DEFAULT_URL; + /** * @param context The Context the view is running in. * @param attrs The attributes of the XML tag that is inflating the view. @@ -61,7 +63,7 @@ public class TabManager extends LinearLayout { public void surfaceCreated(SurfaceHolder holder) { nativeSurfaceCreated(holder.getSurface()); - if (mCurrentTab == null) createTab(DEFAULT_URL); + if (mCurrentTab == null) createTab(mStartupUrl); } @Override @@ -79,6 +81,13 @@ public class TabManager extends LinearLayout { } /** + * @param startupUrl The URL that the first tab should navigate to. + */ + public void setStartupUrl(String startupUrl) { + mStartupUrl = startupUrl; + } + + /** * @return The currently visible {@link TabBase}. */ public TabBase getCurrentTab() { -- cgit v1.1