Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1228)

Unified Diff: testing/android/native_test_launcher.cc

Issue 864563002: Separate JNI registration with initialization (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments and sync Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « testing/android/native_test_launcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/android/native_test_launcher.cc
diff --git a/testing/android/native_test_launcher.cc b/testing/android/native_test_launcher.cc
index 191dfcd2ee9003e1c933e91973d4b7d04c793ebf..4cc87d211c3bb172e260f2dd820fee81477462b1 100644
--- a/testing/android/native_test_launcher.cc
+++ b/testing/android/native_test_launcher.cc
@@ -60,20 +60,6 @@ void SignalHandler(int sig, siginfo_t* info, void* reserved) {
g_old_sa[sig].sa_sigaction(sig, info, reserved);
}
-// TODO(nileshagrawal): now that we're using FIFO, test scripts can detect EOF.
-// Remove the signal handlers.
-void InstallHandlers() {
- struct sigaction sa;
- memset(&sa, 0, sizeof(sa));
-
- sa.sa_sigaction = SignalHandler;
- sa.sa_flags = SA_SIGINFO;
-
- for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) {
- sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]);
- }
-}
-
// Writes printf() style string to Android's logger where |priority| is one of
// the levels defined in <android/log.h>.
void AndroidLog(int priority, const char* format, ...) {
@@ -92,8 +78,6 @@ static void RunTests(JNIEnv* env,
jstring jstdout_file_path,
jboolean jstdout_fifo,
jobject app_context) {
- base::AtExitManager exit_manager;
-
// Command line initialized basically, will be fully initialized later.
static const char* const kInitialArgv[] = { "ChromeTestActivity" };
base::CommandLine::Init(arraysize(kInitialArgv), kInitialArgv);
@@ -157,16 +141,21 @@ static void RunTests(JNIEnv* env,
main(argc, &argv[0]);
}
-// This is called by the VM when the shared library is first loaded.
-JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
- // Install signal handlers to detect crashes.
- InstallHandlers();
+bool RegisterNativeTestJNI(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
- base::android::InitVM(vm);
- JNIEnv* env = base::android::AttachCurrentThread();
- if (!RegisterNativesImpl(env)) {
- return -1;
- }
- return JNI_VERSION_1_4;
+// TODO(nileshagrawal): now that we're using FIFO, test scripts can detect EOF.
+// Remove the signal handlers.
+void InstallHandlers() {
+ struct sigaction sa;
+ memset(&sa, 0, sizeof(sa));
+
+ sa.sa_sigaction = SignalHandler;
+ sa.sa_flags = SA_SIGINFO;
+
+ for (unsigned int i = 0; kExceptionSignals[i] != -1; ++i) {
+ sigaction(kExceptionSignals[i], &sa, &g_old_sa[kExceptionSignals[i]]);
+ }
}
« no previous file with comments | « testing/android/native_test_launcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698