diff options
author | 2022-02-01 01:24:58 +0000 | |
---|---|---|
committer | 2022-02-08 09:16:51 +0000 | |
commit | be9e23a61983cd4a3aa7c20f2e96d56333d92cf7 (patch) | |
tree | eb03deb8b8e5adb1fbcc924fa77a77e572aa22c2 | |
parent | ad67bbb66666c36f9de4a196602c989808114308 (diff) |
Use art::CommonRuntimeTest to set up a test with a runtime.
This is hopefully a better way than a plain call to JNI_CreateJavaVM to
set up a runtime that works in all the various test environments.
Test: m cts cts-tradefed
cts-tradefed run commandAndExit cts \
--module art_standalone_libartpalette_tests
Test: art/tools/run-gtests.sh \
/apex/com.android.art/bin/art/{x86,x86_64}/art_libartpalette_tests
in device chroot test environment
Test: m test-art-host-gtest-art_libartpalette_tests
Bug: 216838549
Change-Id: I763dbaa6f449b58fb1b060054618b8b48507fce2
-rw-r--r-- | libartpalette/apex/palette_test.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/libartpalette/apex/palette_test.cc b/libartpalette/apex/palette_test.cc index 78ff90ee26..853dc29f58 100644 --- a/libartpalette/apex/palette_test.cc +++ b/libartpalette/apex/palette_test.cc @@ -21,6 +21,7 @@ #include <sys/syscall.h> #include <unistd.h> +#include "common_runtime_test.h" #include "gtest/gtest.h" namespace { @@ -68,3 +69,15 @@ TEST_F(PaletteClientTest, Ashmem) { EXPECT_EQ(0, close(fd)); #endif } + +class PaletteClientJniTest : public art::CommonRuntimeTest {}; + +TEST_F(PaletteClientJniTest, JniInvocation) { + bool enabled; + EXPECT_EQ(PALETTE_STATUS_OK, PaletteShouldReportJniInvocations(&enabled)); + + JNIEnv* env = art::Thread::Current()->GetJniEnv(); + ASSERT_NE(nullptr, env); + PaletteNotifyBeginJniInvocation(env); + PaletteNotifyEndJniInvocation(env); +} |