diff options
Diffstat (limited to 'android/test/ServiceTestCase.java')
-rw-r--r-- | android/test/ServiceTestCase.java | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/android/test/ServiceTestCase.java b/android/test/ServiceTestCase.java index c8ff0f90..cd54955f 100644 --- a/android/test/ServiceTestCase.java +++ b/android/test/ServiceTestCase.java @@ -23,6 +23,7 @@ import android.content.Intent; import android.os.IBinder; import android.test.mock.MockApplication; +import android.test.mock.MockService; import java.util.Random; /** @@ -163,14 +164,8 @@ public abstract class ServiceTestCase<T extends Service> extends AndroidTestCase if (getApplication() == null) { setApplication(new MockApplication()); } - mService.attach( - getContext(), - null, // ActivityThread not actually used in Service - mServiceClass.getName(), - null, // token not needed when not talking with the activity manager - getApplication(), - null // mocked services don't talk with the activity manager - ); + MockService.attachForTesting( + mService, getContext(), mServiceClass.getName(), getApplication()); assertNotNull(mService); |