mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 20:15:21 +00:00
fc21d2038f
// FREEBIE
38 lines
1.3 KiB
Java
38 lines
1.3 KiB
Java
package org.thoughtcrime.securesms;
|
|
|
|
import android.app.Activity;
|
|
import android.app.Instrumentation.ActivityMonitor;
|
|
import android.preference.PreferenceManager;
|
|
import android.test.ActivityInstrumentationTestCase2;
|
|
import android.util.Log;
|
|
|
|
import org.thoughtcrime.securesms.crypto.MasterSecretUtil;
|
|
|
|
public class RoutedInstrumentationTestCase extends ActivityInstrumentationTestCase2<RoutingActivity> {
|
|
private static final String TAG = RoutedInstrumentationTestCase.class.getSimpleName();
|
|
|
|
public RoutedInstrumentationTestCase() {
|
|
super(RoutingActivity.class);
|
|
}
|
|
|
|
@Override
|
|
public void setUp() throws Exception {
|
|
System.setProperty("dexmaker.dexcache", getInstrumentation().getTargetContext().getCacheDir().getPath());
|
|
super.setUp();
|
|
clearSharedPrefs();
|
|
getActivity();
|
|
}
|
|
|
|
protected void clearSharedPrefs() {
|
|
PreferenceManager.getDefaultSharedPreferences(getInstrumentation().getTargetContext())
|
|
.edit().clear().commit();
|
|
getInstrumentation().getTargetContext().getSharedPreferences(MasterSecretUtil.PREFERENCES_NAME, 0)
|
|
.edit().clear().commit();
|
|
}
|
|
|
|
protected static void waitOn(Class<? extends Activity> clazz) {
|
|
Log.w(TAG, "waiting for " + clazz.getName());
|
|
new ActivityMonitor(clazz.getName(), null, true).waitForActivityWithTimeout(10000);
|
|
}
|
|
}
|