diff options
author | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-05 12:17:41 +0000 |
---|---|---|
committer | jknotten@chromium.org <jknotten@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-07-05 12:17:41 +0000 |
commit | c30192f2cca80df9cf26d16e3f106390862c6a23 (patch) | |
tree | d5881871a34ef1b634ad894944bb8b604c31e865 /testing | |
parent | d037f9ae38f130ce35b922dfd127f4fb3ae0f513 (diff) | |
download | chromium_src-c30192f2cca80df9cf26d16e3f106390862c6a23.zip chromium_src-c30192f2cca80df9cf26d16e3f106390862c6a23.tar.gz chromium_src-c30192f2cca80df9cf26d16e3f106390862c6a23.tar.bz2 |
Upstream: Fix the native test launcher for Chrome on Android.
We need to terminate our own constructed argv[] before passing
it into gtest as gtest requires a null-terminated argv.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com/10692095
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'testing')
-rw-r--r-- | testing/android/native_test_launcher.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc index 1bf9cc7..68180917 100644 --- a/testing/android/native_test_launcher.cc +++ b/testing/android/native_test_launcher.cc @@ -89,13 +89,17 @@ void ParseArgsFromCommandLineFile(std::vector<std::string>* args) { } } -void ArgsToArgv(const std::vector<std::string>& args, +int ArgsToArgv(const std::vector<std::string>& args, std::vector<char*>* argv) { // We need to pass in a non-const char**. int argc = args.size(); - argv->resize(argc); + + argv->resize(argc + 1); for (int i = 0; i < argc; ++i) (*argv)[i] = const_cast<char*>(args[i].c_str()); + (*argv)[argc] = NULL; // argv must be NULL terminated. + + return argc; } // As we are the native side of an Android app, we don't have any 'console', so @@ -193,9 +197,8 @@ static void RunTests(JNIEnv* env, // We need to pass in a non-const char**. std::vector<char*> argv; - ArgsToArgv(args, &argv); + int argc = ArgsToArgv(args, &argv); - int argc = argv.size(); // This object is owned by gtest. AndroidLogPrinter* log = new AndroidLogPrinter(); log->Init(&argc, &argv[0]); |