Björn Terelius 711e1a8beb Create a custom test launcher for android
Set use_default_launcher=false in rtc_test on android

Bug: webrtc:42223878
Change-Id: If05da40b420d5da8f9e0f39560eb07380ebada14
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368921
Owners-Override: Jeremy Leconte <jleconte@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Jeremy Leconte <jleconte@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Jeremy Leconte <jleconte@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#43505}
2024-12-06 09:30:37 +00:00

34 lines
1.2 KiB
C++

/*
* Copyright (c) 2018 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include <jni.h>
#undef JNIEXPORT
#define JNIEXPORT __attribute__((visibility("default")))
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
#include "sdk/android/native_api/base/init.h"
#include "sdk/android/native_api/jni/java_types.h"
#include "test/android/native_test_launcher.h" // nogncheck
// This is called by the VM when the shared library is first loaded.
JNIEXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
RTC_LOG(LS_INFO) << "Entering JNI_OnLoad in test_jni_onload.cc";
jni_zero::InitVM(vm);
// TODO(webrtc:42223878): Set exception handler?
// jni_zero::SetExceptionHandler(CheckException);
// JNIEnv* env = jni_zero::AttachCurrentThread();
// TODO(webrtc:42223878): Classloader, OOM error handler?
webrtc::InitAndroid(vm);
webrtc::test::android::InstallHandlers();
return JNI_VERSION_1_4;
}