summaryrefslogtreecommitdiff
path: root/test-runner/src/android/test/ServiceTestCase.java
diff options
context:
space:
mode:
Diffstat (limited to 'test-runner/src/android/test/ServiceTestCase.java')
-rw-r--r--test-runner/src/android/test/ServiceTestCase.java11
1 files changed, 3 insertions, 8 deletions
diff --git a/test-runner/src/android/test/ServiceTestCase.java b/test-runner/src/android/test/ServiceTestCase.java
index c8ff0f904d6d..cd54955f22fa 100644
--- a/test-runner/src/android/test/ServiceTestCase.java
+++ b/test-runner/src/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);