summaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorcyBerta <cyberta@riseup.net>2021-11-07 05:20:25 +0100
committercyBerta <cyberta@riseup.net>2021-11-07 05:20:25 +0100
commit7bde8bbb733dfcba7baace5c2261f67da8e0d3d0 (patch)
treea350614b04c41ff0a38fc13251f4ccc935cad6d9 /app/src/main/java
parent7ece2b7cf81ac1e69003f288fc15f7d56ab9ca25 (diff)
Add provider setup unit tests wrt. Tor handling
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java
index 3be4ce12..fae7d063 100644
--- a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java
+++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java
@@ -83,8 +83,9 @@ public class TorStatusObservable extends Observable {
* @param timeout Timout in seconds
* @throws InterruptedException if thread was interrupted while waiting
* @throws TimeoutException thrown if timeout was reached
+ * @return true return value only needed to mock this method call
*/
- public static void waitUntil(StatusCondition condition, int timeout) throws InterruptedException, TimeoutException {
+ public static boolean waitUntil(StatusCondition condition, int timeout) throws InterruptedException, TimeoutException {
CountDownLatch countDownLatch = new CountDownLatch(1);
final AtomicBoolean conditionMet = new AtomicBoolean(false);
Observer observer = (o, arg) -> {
@@ -95,7 +96,7 @@ public class TorStatusObservable extends Observable {
};
if (condition.met()) {
// no need to wait
- return;
+ return true;
}
getInstance().addObserver(observer);
countDownLatch.await(timeout, TimeUnit.SECONDS);
@@ -103,6 +104,7 @@ public class TorStatusObservable extends Observable {
if (!conditionMet.get()) {
throw new TimeoutException("Status condition not met within " + timeout + "s.");
}
+ return true;
}
public static void logSnowflakeMessage(Context context, String message) {