summaryrefslogtreecommitdiffstats
path: root/testing/android
diff options
context:
space:
mode:
authorshouqun.liu@intel.com <shouqun.liu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-05 15:55:25 +0000
committershouqun.liu@intel.com <shouqun.liu@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-05 15:55:25 +0000
commite3dc84c6576ca2199d2f5a2eee7d091c1d974328 (patch)
tree7c1599d77a0450c77a1cb0a4caaf712afae1a7a3 /testing/android
parentfeda45d4be98bf8cc64631b1277e928fe5bcac45 (diff)
downloadchromium_src-e3dc84c6576ca2199d2f5a2eee7d091c1d974328.zip
chromium_src-e3dc84c6576ca2199d2f5a2eee7d091c1d974328.tar.gz
chromium_src-e3dc84c6576ca2199d2f5a2eee7d091c1d974328.tar.bz2
Add WaitForDebugger for android native tests
For convenience of debugging APKs of native tests (*_unittests, DumpRenderTree) BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10697083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing/android')
-rw-r--r--testing/android/native_test_launcher.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc
index 68180917..d2a8e24 100644
--- a/testing/android/native_test_launcher.cc
+++ b/testing/android/native_test_launcher.cc
@@ -20,6 +20,7 @@
#include "base/android/path_utils.h"
#include "base/android/scoped_java_ref.h"
#include "base/at_exit.h"
+#include "base/base_switches.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -177,6 +178,7 @@ static void RunTests(JNIEnv* env,
jobject app_context) {
base::AtExitManager exit_manager;
+ // Command line initialized basically, will be fully initialized later.
static const char* const kInitialArgv[] = { "ChromeTestActivity" };
CommandLine::Init(arraysize(kInitialArgv), kInitialArgv);
@@ -203,6 +205,18 @@ static void RunTests(JNIEnv* env,
AndroidLogPrinter* log = new AndroidLogPrinter();
log->Init(&argc, &argv[0]);
+ // Fully initialize command line with arguments.
+ CommandLine::ForCurrentProcess()->AppendArguments(
+ CommandLine(argc, &argv[0]), false);
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+ if (command_line.HasSwitch(switches::kWaitForDebugger)) {
+ std::string msg = StringPrintf("Native test waiting for GDB because "
+ "flag %s was supplied",
+ switches::kWaitForDebugger);
+ log_write(ANDROID_LOG_VERBOSE, msg.c_str());
+ base::debug::WaitForDebugger(24 * 60 * 60, false);
+ }
+
main(argc, &argv[0]);
}