I have discovered more information about this issue which seems far
more troubling. I created a simple test which I thought would
demonstrate this bug but instead the test worked. So I returned to my
functional code and analyzed the logcat differences only to find the
following after I launch the instrumented tests:
D/AndroidRuntime( 764):
D/AndroidRuntime( 764): >>>>>>>>>>>>>> AndroidRuntime START
<<<<<<<<<<<<<<
D/AndroidRuntime( 764): CheckJNI is ON
D/AndroidRuntime( 764): --- registering native functions ---
I/jdwp ( 764): received file descriptor 20 from ADB
D/ActivityManager( 49): Uninstalling process org.devtcg.five
D/ActivityManager( 49): Force removing process
ProcessRecord{434f8728 org.devtcg.five/10015} (org.devtcg.five/10015)
W/ActivityManager( 49): Crash of app org.devtcg.five running
instrumentation ComponentInfo{org.devtcg.five.tests/
android.test.InstrumentationTestRunner}
D/ActivityManager( 49): Uninstalling process org.devtcg.five
I/Process ( 49): Sending signal. PID: 739 SIG: 9
I/ActivityManager( 49): Start proc org.devtcg.five for added
application org.devtcg.five: pid=770 uid=10015 gids={3003}
D/ActivityManager( 49): Received spurious death notification for
thread [EMAIL PROTECTED]
This is then followed by the tests seemingly running as expected but
without recursive binder transactions (callbacks don't fire). The
lines about the forced removal and crashed app are not present when
running my simple demonstration code which works otherwise as
expected.
On Aug 26, 11:54 am, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
> *bump*
>
> I'm sure I'm just doing something stupid wrong but I really would love
> to get this working right so I can write good automated tests for my
> project! Please help if you can...
>
> On Aug 25, 4:01 pm, Josh Guilfoyle <[EMAIL PROTECTED]> wrote:
>
> > I am trying to add unit tests to a service of mine that utilizes
> > remote callbacks (managed by the service with RemoteCallbackList). I
> > know that this service functions properly already, I am just trying to
> > formalize with a unit test as I have recently discovered how to make
> > instrumentation work. The service otherwise works fine except that it
> > seems that the service callbacks never fire on the observing side. My
> > simple test case looks similar to the following sample:
>
> > -- begin paste --
>
> > public void testMyService() throws RemoteException {
> > IMyService svc = IMyService.Stub.asInterface(bindService(new
> > Intent(this, MyService.class)));
>
> > svc.registerObserver(new IMyServiceObserver.Stub() {
> > public void onFoo()
> > {
> > Log.d(TAG, "Here I am !");
> > synchronized(MyServiceTest.this) { mDone = true;
> > MyServiceTest.this.notify(); }
> > }
> > });
>
> > svc.doStuffThatWillEventuallyCallBack();
>
> > synchronized(this) {
> > while (mDone == false) {
> > try { wait(); } catch (InterruptException e) {}
> > }
> > }
>
> > }
>
> > -- end paste --
>
> > "Here I am" is never logged, in this case and the call to adb shell am
> > never returns. I have verified that
> > doStuffThatWillEventuallyCallback() does actually return, and the test
> > thread enters the synchronized wait loop correctly. My suspicion is
> > that the binder's normal transaction thread loop is somehow not the
> > same in the context of an instrumented test, however I have no way to
> > validate this.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---