Chromium Code Reviews| Index: testing/android/native_test_launcher.cc |
| diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc |
| index bc5d47f3b9313321a6800776af54e883a2864059..c17a30fa2ee63f1bb0d97e73048bbb81388387c7 100644 |
| --- a/testing/android/native_test_launcher.cc |
| +++ b/testing/android/native_test_launcher.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/android/jni_android.h" |
| #include "base/android/jni_string.h" |
| #include "base/android/path_utils.h" |
| +#include "base/android/scoped_java_ref.h" |
| #include "base/at_exit.h" |
| #include "base/command_line.h" |
| #include "base/file_path.h" |
| @@ -156,7 +157,10 @@ void LibraryLoadedOnMainThread(JNIEnv* env) { |
| // This method is called on a separate java thread so that we won't trigger |
| // an ANR. |
| -static void RunTests(JNIEnv* env, jobject obj, jstring jfiles_dir) { |
| +static void RunTests(JNIEnv* env, |
| + jobject obj, |
| + jstring jfiles_dir, |
| + jobject app_context) { |
| FilePath files_dir(base::android::ConvertJavaStringToUTF8(env, jfiles_dir)); |
| // A few options, such "--gtest_list_tests", will just use printf directly |
| // and won't use the "AndroidLogPrinter". Redirect stdout to a known file. |
| @@ -175,6 +179,10 @@ static void RunTests(JNIEnv* env, jobject obj, jstring jfiles_dir) { |
| AndroidLogPrinter* log = new AndroidLogPrinter(); |
| log->Init(&argc, &argv[0]); |
| + // Set the application context in base. |
| + base::android::ScopedJavaLocalRef<jobject> scoped_context(env, app_context); |
|
John Grabowski
2012/04/25 20:22:12
This doesn't look correct. You don't create the l
nilesh
2012/04/25 23:33:26
Thanks for explaining this. I am now creating a Ne
|
| + base::android::InitApplicationContext(scoped_context); |
| + |
| main(argc, &argv[0]); |
| } |