Add foundation for automated performance tests.

This commit is contained in:
Greyson Parrelli
2021-03-05 13:54:57 -05:00
committed by GitHub
parent d8cc3c86b4
commit f92891895e
9 changed files with 226 additions and 2 deletions

View File

@@ -6,6 +6,7 @@ import android.content.Context;
import androidx.annotation.AnyThread;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
import org.signal.core.util.concurrent.SignalExecutors;
@@ -126,6 +127,15 @@ public final class KeyValueStore implements KeyValueReader {
}
}
/**
* Forces the store to re-fetch all of it's data from the database.
* Should only be used for testing!
*/
@VisibleForTesting
synchronized void resetCache() {
dataSet = null;
initializeIfNecessary();
}
private synchronized void write(@NonNull KeyValueDataSet newDataSet, @NonNull Collection<String> removes) {
initializeIfNecessary();

View File

@@ -1,9 +1,9 @@
package org.thoughtcrime.securesms.keyvalue;
import androidx.annotation.NonNull;
import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceDataStore;
import org.thoughtcrime.securesms.database.model.databaseprotos.Wallpaper;
import org.thoughtcrime.securesms.dependencies.ApplicationDependencies;
import org.thoughtcrime.securesms.util.SignalUncaughtExceptionHandler;
@@ -70,6 +70,15 @@ public final class SignalStore {
proxy().onFirstEverAppLaunch();
}
/**
* Forces the store to re-fetch all of it's data from the database.
* Should only be used for testing!
*/
@VisibleForTesting
public static void resetCache() {
INSTANCE.store.resetCache();
}
public static @NonNull KbsValues kbsValues() {
return INSTANCE.kbsValues;
}