Issue with Test class SingleLaunchActivityTestCase

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


Sponsored Links
 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.





-- 



Re: Issue with Test class SingleLaunchActivityTestCase

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


 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.




-- 


Sponsored Links


Other Threads

1. what member variable in Activity class stores its state?

One can override the different OnX() methods and update state
(foreground, paused, stopped, destroyed) but just wondered what the
member variable in Activity is that stores it - we are after all,
extending from it - so we could directly access it unless it is
private.
background: wanted a service to know whether its UI Activity is active
or not. Yes, I can update the state but so much simpler if there were
a getState().

Anil

-- 

2. Where can i get the an updated version gdbserver for armv7-a-neon.mk

Hi All,

 I am using the froyo source code to build a armv7-a-neon version
rootfs, which will include the below setting for build. But it seems
the prebuilt version of gdbserver cannot work in such setting, it will
just throw a "segment fault" message. I believe it connected with
ARCH_ARM_HAVE_TLS_REGISTER setting. So my question where I can get the
gdbserver with TLS enable.

  ARCH_ARM_HAVE_THUMB_SUPPORT     := true
  ARCH_ARM_HAVE_FAST_INTERWORKING := true
  ARCH_ARM_HAVE_64BIT_DATA        := true
  ARCH_ARM_HAVE_HALFWORD_MULTIPLY := true
  ARCH_ARM_HAVE_CLZ               := true
  ARCH_ARM_HAVE_FFS               := true
 ARCH_ARM_HAVE_ARMV7A            := true
 ARCH_ARM_HAVE_VFP               := true
 ARCH_ARM_HAVE_VFP_D32           := true
 ARCH_ARM_HAVE_NEON              := true
 ARCH_ARM_HAVE_TLS_REGISTER      := true


BRs
Guoyin Chen

-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: 

3. Help with simple Bitmap issue

4. start emulator with ant

5. stop listview kinetic scrolling

6. How to enable/turning phone into a WiFi hot spot

7. ListActivity with Button at bottom