Issue with Test class SingleLaunchActivityTestCase

by cg-dev » Fri, 04 Mar 2011 18:41:48 GMT

Sponsored Links

We're developping a test activity using SingleLaunchActivityTestCase<>
and JUnit on Android 2.3.3

We face the following issue :

In JUnit view in eclipse we have the following function call order :

testActivityTestCaseSetUpProperly() <- this one is built in android.

Each test use sendKeys() or TouchUtils.clickView().

On testC() sometimes we get this error :
W/InputDispatcher(  112): Permission denied: injecting event from pid
3753 uid 10001 to window with input channel 406a0b70 (server) owned by
uid 10022

??? Launcher (desktop) get Events ??? We do nothing for that

So I put a Thread.sleep(5000) in testC() at the beginning.

I launch the test again :

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
Here application is put in background (for no reason we do not call
activity.finish() and co.)
testC() is launched but desktop is display. The test failed as we
cannot inject events to desktop.

The workaround for this is to create a dummy testZZZZ() function in
that way, testC() is executed before activity get closed.

testActivityTestCaseSetUpProperly() : Ok
testA() : Ok
testB() : Ok
testC() : Ok
testZZZZ() : don't care of result.

NOTE : sometimes the function order change :


In that way, the issue is not visible.

Hope it helps.


Re: Issue with Test class SingleLaunchActivityTestCase

by cg-dev » Fri, 04 Mar 2011 18:46:07 GMT

 I notice this in

    protected void tearDown() throws Exception {
        // If it is the last test case, call finish on the activity.
        sTestCaseCounter --;
        if (sTestCaseCounter == 1) {
This : "if (sTestCaseCounter == 1)" should be replaced by "if
(sTestCaseCounter == 0)" ?



Sponsored Links

Other Threads

1. change the video surface dynamically

Hi All,

--> Can i change the video surface dynamically?
For example, if i am rendering a video on surface A but now i want to
render the same video at surface B without stoping the video, is it
possible? If yes, what about video path in opencore.
-->Do we need to recreate the video path in opencore with new surface
-->What will be the behaviour of surface in above cases?

Thanks in advance,


2. Calendar

Hi people,
I have o develop somethings in a android calendar to works with events in
the calendar, but someone sad to me that the informations have to be synch
with the blur account and it isnt recorded just in the phone.
Someone knows how the calendar works?? or someone knows how i can
communicate with the caledar events??


Rafael Sexta


3. ALSA: Unable to attach mixer to device AndroidPlayback

4. OpenGL 1.5 => 1.6 changes?

5. Fw: SOLD WTS Sprint HTC Hero BNIB Unlocked...

6. Not abt to push file in sdcard

7. how to install SDK in FreeBSD