mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-11-23 12:51:16 +00:00
Removed unneeded testStartService() case and dead code (fixes #302).
We don't really need this test, as testBindService() does basically the same thing.
This commit is contained in:
parent
329f073106
commit
2eabee9eb5
1 changed files with 0 additions and 49 deletions
|
@ -4,13 +4,9 @@ import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.test.ServiceTestCase;
|
import android.test.ServiceTestCase;
|
||||||
import android.test.suitebuilder.annotation.LargeTest;
|
|
||||||
import android.test.suitebuilder.annotation.MediumTest;
|
import android.test.suitebuilder.annotation.MediumTest;
|
||||||
import android.test.suitebuilder.annotation.SmallTest;
|
import android.test.suitebuilder.annotation.SmallTest;
|
||||||
import android.util.Log;
|
|
||||||
import android.util.Pair;
|
|
||||||
|
|
||||||
import com.nutomic.syncthingandroid.syncthing.DeviceStateHolder;
|
|
||||||
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
import com.nutomic.syncthingandroid.syncthing.SyncthingService;
|
||||||
import com.nutomic.syncthingandroid.syncthing.SyncthingServiceBinder;
|
import com.nutomic.syncthingandroid.syncthing.SyncthingServiceBinder;
|
||||||
import com.nutomic.syncthingandroid.test.MockContext;
|
import com.nutomic.syncthingandroid.test.MockContext;
|
||||||
|
@ -19,8 +15,6 @@ import com.nutomic.syncthingandroid.util.ConfigXml;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
@ -30,12 +24,8 @@ import java.util.concurrent.TimeUnit;
|
||||||
*/
|
*/
|
||||||
public class SyncthingServiceTest extends ServiceTestCase<SyncthingService> {
|
public class SyncthingServiceTest extends ServiceTestCase<SyncthingService> {
|
||||||
|
|
||||||
private static final int STARTUP_TIME_SECONDS = 90;
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
|
|
||||||
private CountDownLatch mLatch;
|
|
||||||
|
|
||||||
public SyncthingServiceTest() {
|
public SyncthingServiceTest() {
|
||||||
super(SyncthingService.class);
|
super(SyncthingService.class);
|
||||||
}
|
}
|
||||||
|
@ -53,28 +43,6 @@ public class SyncthingServiceTest extends ServiceTestCase<SyncthingService> {
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@LargeTest
|
|
||||||
public void testStartService() throws InterruptedException {
|
|
||||||
startService(new Intent(getContext(), SyncthingService.class));
|
|
||||||
final CountDownLatch latch = new CountDownLatch(2);
|
|
||||||
getService().registerOnWebGuiAvailableListener(new SyncthingService.OnWebGuiAvailableListener() {
|
|
||||||
@Override
|
|
||||||
public void onWebGuiAvailable() {
|
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
getService().registerOnApiChangeListener(new SyncthingService.OnApiChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onApiChange(SyncthingService.State currentState) {
|
|
||||||
if (currentState == SyncthingService.State.ACTIVE)
|
|
||||||
latch.countDown();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
latch.await(10, TimeUnit.SECONDS);
|
|
||||||
assertNotNull(getService().getApi());
|
|
||||||
assertNotNull(getService().getWebGuiUrl());
|
|
||||||
}
|
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
public void testFirstStart() {
|
public void testFirstStart() {
|
||||||
setContext(mContext);
|
setContext(mContext);
|
||||||
|
@ -112,23 +80,6 @@ public class SyncthingServiceTest extends ServiceTestCase<SyncthingService> {
|
||||||
assertNotNull(service);
|
assertNotNull(service);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Listener implements SyncthingService.OnApiChangeListener {
|
|
||||||
|
|
||||||
private SyncthingService.State mLastState;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onApiChange(SyncthingService.State currentState) {
|
|
||||||
mLatch.countDown();
|
|
||||||
|
|
||||||
mLastState = currentState;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SyncthingService.State getLastState() {
|
|
||||||
return mLastState;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void testImportExportConfig() {
|
public void testImportExportConfig() {
|
||||||
setContext(mContext);
|
setContext(mContext);
|
||||||
SyncthingServiceBinder binder = (SyncthingServiceBinder)
|
SyncthingServiceBinder binder = (SyncthingServiceBinder)
|
||||||
|
|
Loading…
Reference in a new issue