-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add libsignal-jni-testing crate with test-only functions for Java
This parallels the exiting libsignal-jni crate but exports functions from libsignal-bridge-testing instead of libsignal-bridge. The crate is compiled as a separate shared object that is included in the published libsignal package, but which can be excluded at Android packaging time.
- Loading branch information
1 parent
c6857dd
commit 0e4d420
Showing
24 changed files
with
371 additions
and
51 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
java/shared/java/org/signal/libsignal/internal/NativeTesting.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// Copyright (C) 2024 Signal Messenger, LLC. | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// | ||
|
||
// WARNING: this file was automatically generated | ||
|
||
package org.signal.libsignal.internal; | ||
|
||
import org.signal.libsignal.protocol.message.CiphertextMessage; | ||
import org.signal.libsignal.protocol.state.IdentityKeyStore; | ||
import org.signal.libsignal.protocol.state.SessionStore; | ||
import org.signal.libsignal.protocol.state.PreKeyStore; | ||
import org.signal.libsignal.protocol.state.SignedPreKeyStore; | ||
import org.signal.libsignal.protocol.state.KyberPreKeyStore; | ||
import org.signal.libsignal.protocol.groups.state.SenderKeyStore; | ||
import org.signal.libsignal.protocol.logging.Log; | ||
import org.signal.libsignal.protocol.logging.SignalProtocolLogger; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
import java.nio.ByteBuffer; | ||
import java.nio.file.Files; | ||
import java.nio.file.Path; | ||
import java.util.concurrent.Future; | ||
import java.util.UUID; | ||
import java.util.Map; | ||
|
||
public final class NativeTesting { | ||
private static void loadNativeCode() { | ||
try { | ||
Native.loadLibrary("signal_jni_testing"); | ||
} catch (Exception e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
static { | ||
loadNativeCode(); | ||
} | ||
|
||
private NativeTesting() {} | ||
|
||
public static native int test_only_fn_returns_123(); | ||
} |
18 changes: 18 additions & 0 deletions
18
java/shared/test/java/org/signal/libsignal/internal/NativeTestingTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// Copyright 2024 Signal Messenger, LLC. | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
// | ||
|
||
package org.signal.libsignal.internal; | ||
|
||
import static org.junit.Assert.*; | ||
|
||
import org.junit.Test; | ||
|
||
public class NativeTestingTest { | ||
@Test | ||
public void canCallNativeTestingFns() throws Exception { | ||
int result = NativeTesting.test_only_fn_returns_123(); | ||
assertEquals(123, result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.