mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 12:44:38 +00:00
Update to libsignal-client 0.10.0, which includes zkgroup.
This commit is contained in:
committed by
Cody Henthorne
parent
f0ab919ca5
commit
7ccc7ec856
@@ -17,7 +17,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.thoughtcrime.securesms.testutil.SecureRandomTestUtil.mockRandom;
|
||||
import static org.thoughtcrime.securesms.testutil.ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS;
|
||||
import static org.whispersystems.signalservice.test.LibSignalLibraryUtil.assumeLibSignalSupportedOnOS;
|
||||
|
||||
public final class GroupIdTest {
|
||||
|
||||
@@ -54,7 +54,7 @@ public final class GroupIdTest {
|
||||
|
||||
@Test
|
||||
public void can_create_for_gv2_from_GroupMasterKey() throws IOException, InvalidInputException {
|
||||
assumeZkGroupSupportedOnOS();
|
||||
assumeLibSignalSupportedOnOS();
|
||||
|
||||
GroupId.V2 groupId = GroupId.v2(new GroupMasterKey(Hex.fromStringCondensed("0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef")));
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.thoughtcrime.securesms.testutil.ZkGroupLibraryUtil.assumeZkGroupSupportedOnOS;
|
||||
import static org.whispersystems.signalservice.test.LibSignalLibraryUtil.assumeLibSignalSupportedOnOS;
|
||||
|
||||
@RunWith(Parameterized.class)
|
||||
@@ -20,7 +19,6 @@ public final class GroupId_v1_v2_migration_derivation_Test {
|
||||
@Before
|
||||
public void ensureNativeSupported() {
|
||||
assumeLibSignalSupportedOnOS();
|
||||
assumeZkGroupSupportedOnOS();
|
||||
}
|
||||
|
||||
@Parameterized.Parameter(0)
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
package org.thoughtcrime.securesms.testutil;
|
||||
|
||||
import org.signal.zkgroup.internal.Native;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assume.assumeNoException;
|
||||
|
||||
public final class ZkGroupLibraryUtil {
|
||||
|
||||
private ZkGroupLibraryUtil() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to initialize the ZkGroup Native class, which will load the native binaries.
|
||||
* <p>
|
||||
* If that fails to link, then on Unix, it will fail as we rely on that for CI.
|
||||
* <p>
|
||||
* If that fails to link, and it's not Unix, it will skip the test via assumption violation.
|
||||
* <p>
|
||||
* If using inside a PowerMocked test, the assumption violation can be fatal, use:
|
||||
* {@code @PowerMockRunnerDelegate(JUnit4.class)}
|
||||
*/
|
||||
public static void assumeZkGroupSupportedOnOS() {
|
||||
try {
|
||||
Class.forName(Native.class.getName());
|
||||
} catch (ClassNotFoundException e) {
|
||||
fail();
|
||||
} catch (UnsatisfiedLinkError | NoClassDefFoundError e) {
|
||||
String osName = System.getProperty("os.name");
|
||||
|
||||
if (isUnix(osName)) {
|
||||
fail("Not able to link native ZkGroup on a key OS: " + osName);
|
||||
} else {
|
||||
assumeNoException("Not able to link native ZkGroup on this operating system: " + osName, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isUnix(String osName) {
|
||||
assertNotNull(osName);
|
||||
osName = osName.toLowerCase();
|
||||
return osName.contains("nix") || osName.contains("nux") || osName.contains("aix");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user