Index: testing/android/native_test/main_runner.cc |
diff --git a/testing/android/native_test/main_runner.cc b/testing/android/native_test/main_runner.cc |
index 2dc41f3842496d4d613a16bdee89bf0f1efcf515..0c548e417eba5b0802120c9b530e110da270c450 100644 |
--- a/testing/android/native_test/main_runner.cc |
+++ b/testing/android/native_test/main_runner.cc |
@@ -4,10 +4,12 @@ |
#include <vector> |
+#include "base/android/global_object_registry.h" |
#include "base/android/jni_array.h" |
#include "base/logging.h" |
#include "base/posix/global_descriptors.h" |
#include "jni/MainRunner_jni.h" |
+#include "mojo/edk/embedder/embedder.h" |
#include "testing/android/native_test/native_test_util.h" |
extern int main(int argc, char** argv); |
@@ -15,6 +17,8 @@ extern int main(int argc, char** argv); |
namespace testing { |
namespace android { |
+jobject g_side_channel; |
+ |
bool RegisterMainRunnerJni(JNIEnv* env) { |
return RegisterNativesImpl(env); |
} |
@@ -24,7 +28,9 @@ static jint RunMain( |
const base::android::JavaParamRef<jclass>& jcaller, |
const base::android::JavaParamRef<jobjectArray>& command_line, |
const base::android::JavaParamRef<jintArray>& fds_to_map_keys, |
- const base::android::JavaParamRef<jintArray>& fds_to_map_fds) { |
+ const base::android::JavaParamRef<jintArray>& fds_to_map_fds, |
+ const base::android::JavaParamRef<jintArray>& jobjects_to_map_keys, |
+ const base::android::JavaParamRef<jobjectArray>& jobjects_to_map_jobjects) { |
// Guards against process being reused. |
// In most cases, running main again will cause problems (static variables, |
// singletons, lazy instances won't be in the same state as a clean run). |
@@ -37,11 +43,21 @@ static jint RunMain( |
std::vector<int> fds; |
base::android::JavaIntArrayToIntVector(env, fds_to_map_fds, &fds); |
CHECK_EQ(keys.size(), fds.size()); |
- |
for (size_t i = 0; i < keys.size(); i++) { |
base::GlobalDescriptors::GetInstance()->Set(keys[i], fds[i]); |
} |
+ keys.clear(); |
+ base::android::JavaIntArrayToIntVector(env, jobjects_to_map_keys, &keys); |
+ std::vector<base::android::ScopedJavaLocalRef<jobject>> jobjects; |
+ base::android::JavaJObjectArrayToJObjectVector(env, jobjects_to_map_jobjects, |
+ &jobjects); |
+ CHECK_EQ(keys.size(), jobjects.size()); |
+ for (size_t i = 0; i < keys.size(); i++) { |
+ base::android::GlobalObjectRegistry::GetInstance()->Set(keys[i], |
+ jobjects[i]); |
+ } |
+ |
std::vector<std::string> cpp_command_line; |
AppendJavaStringArrayToStringVector(env, command_line, &cpp_command_line); |