I notice this in SingleLaunchActivityTestCase.java:

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

Regards.

On 4 mar, 11:41, cg-dev <[email protected]> wrote:
> Hi,
>
> 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.
> testA()
> testB()
> testC()
>
> 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
> com.android.launcher/com.android.launcher2.Launcher (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 :
>
> testA()
> testB()
> testC()
> testActivityTestCaseSetUpProperly()
>
> In that way, the issue is not visible.
>
> Hope it helps.

-- 
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]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to