1 /*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 /*
18 * Native implementation for the JniCppTest class.
19 */
20
21 #include <jni.h>
22
23
24 /*
25 * This includes source for all the tests as well as for a runner
26 * function. See the comment in that file for more information.
27 */
28 #define INCLUDED_FROM_WRAPPER 1
29 #include "macroized_tests.c"
30
31
32 // private static native String runAllTests();
JniCppTest_runAllTests(JNIEnv * env,jclass clazz)33 static jstring JniCppTest_runAllTests(JNIEnv *env, jclass clazz) {
34 // Simply call the static function defined in "macroized_tests.c".
35 return runAllTests(env);
36 }
37
38 static JNINativeMethod methods[] = {
39 // name, signature, function
40 { "runAllTests", "()Ljava/lang/String;", (void *) JniCppTest_runAllTests },
41 };
42
register_JniCppTest(JNIEnv * env)43 extern "C" int register_JniCppTest(JNIEnv *env) {
44 return registerJniMethods(
45 env, "android/jni/cts/JniCppTest",
46 methods, sizeof(methods) / sizeof(JNINativeMethod));
47 }
48