diff options
author | Paul Duffin <paulduffin@google.com> | 2018-01-05 13:52:17 +0000 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2018-02-06 13:38:44 +0000 |
commit | 4ea70a23ea0a5df44028e5dabdf2a2a8fc5adc2a (patch) | |
tree | 2387bf951b9585f77980cdf360d262217c1697db /test-runner/src/android/test/ServiceTestCase.java | |
parent | 0aa3b20a66197da5c6843afc1f9de0a1691ca5cc (diff) |
Modify android.test.runner to use new mock APIs
Previous change added some new public APIs to allow the
android.test.runner classes to be built against the public API stubs
rather than the internal classes. This change updates the
android.test.runner classes to use that new API.
This in turn is preparation for building an android.test.legacy library
that can be safely statically included in APKs.
Bug: 30188076
Test: make checkbuild
(cherry picked from commit 20af1df63f77f6b3ab12fd6221f581fe84182091)
Merged-In: I302626abb7e048ef0c3169e9a5209b85f2f87d34
Change-Id: Ie05a17598fcabc1189cacc912c01a25782ebd29c
Diffstat (limited to 'test-runner/src/android/test/ServiceTestCase.java')
-rw-r--r-- | test-runner/src/android/test/ServiceTestCase.java | 11 |
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); |