Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / third_party / android_crazy_linker / src / tests / jni_lib.cpp
blob8fd12d622ba89d90a9946a66607d62960259ef5a
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // A simple library that provides JNI_OnLoad() and JNI_OnUnload() hooks.
6 // Used by test_java_vm.cpp
8 #include <jni.h>
9 #include <stdio.h>
10 #include <stdlib.h>
12 #define VARNAME "TEST_VAR"
14 extern "C" int JNI_OnLoad(JavaVM* vm, void* reserved) {
15 printf("%s: Entering\n", __FUNCTION__);
16 const char* env = getenv(VARNAME);
17 if (!env || strcmp(env, "INIT")) {
18 fprintf(stderr,
19 "%s: Env variable %s has invalid value: %s (expected INIT)\n",
20 __FUNCTION__,
21 VARNAME,
22 env);
23 exit(1);
25 setenv(VARNAME, "LOADED", 1);
26 printf("%s: Exiting\n", __FUNCTION__);
27 return JNI_VERSION_1_4;
30 extern "C" void JNI_OnUnload(JavaVM* vm, void* reserved) {
31 printf("%s: Entering\n", __FUNCTION__);
32 const char* env = getenv(VARNAME);
33 if (!env || strcmp(env, "LOADED")) {
34 fprintf(stderr,
35 "%s: Env variable %s has invalid value: %s (expected LOADED)\n",
36 __FUNCTION__,
37 VARNAME,
38 env);
39 exit(1);
41 setenv(VARNAME, "UNLOADED", 1);
42 printf("%s: Exiting\n", __FUNCTION__);