From 2eabee9eb5954772081d10a16dfda86c9a3d1e24 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 8 Apr 2015 17:59:39 +0200 Subject: [PATCH] Removed unneeded testStartService() case and dead code (fixes #302). We don't really need this test, as testBindService() does basically the same thing. --- .../test/syncthing/SyncthingServiceTest.java | 49 ------------------- 1 file changed, 49 deletions(-) diff --git a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java index 45853592..3a82f090 100644 --- a/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java +++ b/src/androidTest/java/com/nutomic/syncthingandroid/test/syncthing/SyncthingServiceTest.java @@ -4,13 +4,9 @@ import android.content.Context; import android.content.Intent; import android.preference.PreferenceManager; import android.test.ServiceTestCase; -import android.test.suitebuilder.annotation.LargeTest; import android.test.suitebuilder.annotation.MediumTest; 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.SyncthingServiceBinder; import com.nutomic.syncthingandroid.test.MockContext; @@ -19,8 +15,6 @@ import com.nutomic.syncthingandroid.util.ConfigXml; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; @@ -30,12 +24,8 @@ import java.util.concurrent.TimeUnit; */ public class SyncthingServiceTest extends ServiceTestCase { - private static final int STARTUP_TIME_SECONDS = 90; - private Context mContext; - private CountDownLatch mLatch; - public SyncthingServiceTest() { super(SyncthingService.class); } @@ -53,28 +43,6 @@ public class SyncthingServiceTest extends ServiceTestCase { 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 public void testFirstStart() { setContext(mContext); @@ -112,23 +80,6 @@ public class SyncthingServiceTest extends ServiceTestCase { 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() { setContext(mContext); SyncthingServiceBinder binder = (SyncthingServiceBinder)