Skip to content

Commit

Permalink
Updated the test cases for jni 0.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyannide committed Nov 9, 2024
1 parent b26f0bc commit ac3b953
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
8 changes: 4 additions & 4 deletions rustls-platform-verifier/src/tests/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ mod android {
const SUCCESS_MARKER: &str = "success";

fn run_android_test<'a>(
env: &'a JNIEnv,
env: &'a mut JNIEnv,
cx: JObject,
suite_name: &'static str,
test_cases: &'static [fn()],
Expand Down Expand Up @@ -98,7 +98,7 @@ mod android {
"mock tests",
tests::verification_mock::ALL_TEST_CASES,
)
.into_inner()
.into_raw()
}

#[export_name = "Java_org_rustls_platformverifier_CertificateVerifierTests_verifyMockRootUsage"]
Expand All @@ -115,7 +115,7 @@ mod android {
"mock root verification",
&[tests::verification_mock::verification_without_mock_root],
)
.into_inner()
.into_raw()
}

#[export_name = "Java_org_rustls_platformverifier_CertificateVerifierTests_realWorldTests"]
Expand All @@ -132,7 +132,7 @@ mod android {
"real world",
tests::verification_real_world::ALL_TEST_CASES,
)
.into_inner()
.into_raw()
}
}

Expand Down
5 changes: 2 additions & 3 deletions rustls-platform-verifier/src/verification/android.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ impl Default for Verifier {
#[cfg(any(test, feature = "ffi-testing"))]
impl Drop for Verifier {
fn drop(&mut self) {
with_context::<_, ()>(|cx| {
let env = cx.env();
with_context::<_, ()>(|cx, env| {
env.call_static_method(CERT_VERIFIER_CLASS.get(cx)?, "clearMockRoots", "()V", &[])?
.v()?;
Ok(())
Expand Down Expand Up @@ -160,7 +159,7 @@ impl Verifier {
CERT_VERIFIER_CLASS.get(cx)?,
"addMockRoot",
"([B)V",
&[JValue::from(mock_root)],
&[JValue::from(&mock_root)],
)?
.v()
.expect("failed to add test root")
Expand Down

0 comments on commit ac3b953

Please sign in to comment.