marykarthur2civ / maven-android-plugin

Automatically exported from code.google.com/p/maven-android-plugin
0 stars 0 forks source link

SecurityException performing 'single click' on view #431

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. mvn package
(I wasn't able to run the tests without following 
https://code.google.com/p/android-test-kit/issues/detail?id=4)
2. adb shell setprop dalvik.vm.dexopt-flags v=n,o=v
3. adb shell stop installd
4. adb shell start installd
5. adb shell am instrument -w -e class 
com.google.android.apps.common.testing.ui.espresso.tests.BasicTest#testTypingAnd
PressBack 
com.google.android.apps.common.testing.ui.espresso.tests/com.google.android.apps
.common.testing.testrunner.GoogleInstrumentationTestRunner

What is the expected output?

Test passes

What do you see instead?

com.google.android.apps.common.testing.ui.espresso.tests.BasicTest:
Error in testTypingAndPressBack:
com.google.android.apps.common.testing.ui.espresso.PerformException: Error 
performing 'single click' on view 'with id: is <2131034239>'.
    at com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.build(PerformException.java:67)
    at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.getUserFriendlyError(DefaultFailureHandler.java:57)
    at com.google.android.apps.common.testing.ui.espresso.base.DefaultFailureHandler.handle(DefaultFailureHandler.java:40)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.runSynchronouslyOnUiThread(ViewInteraction.java:146)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.doPerform(ViewInteraction.java:77)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction.perform(ViewInteraction.java:69)
    at com.google.android.apps.common.testing.ui.espresso.tests.BasicTest.testTypingAndPressBack(BasicTest.java:57)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
    at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
    at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
    at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
    at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:554)
    at com.google.android.apps.common.testing.testrunner.GoogleInstrumentationTestRunner.onStart(GoogleInstrumentationTestRunner.java:119)
    at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1701)
Caused by: com.google.android.apps.common.testing.ui.espresso.PerformException: 
Error performing 'Send down montion event' on view 'unknown'.
    at com.google.android.apps.common.testing.ui.espresso.PerformException$Builder.build(PerformException.java:67)
    at com.google.android.apps.common.testing.ui.espresso.action.Tap.sendDown(Tap.java:154)
    at com.google.android.apps.common.testing.ui.espresso.action.Tap.access$100(Tap.java:19)
    at com.google.android.apps.common.testing.ui.espresso.action.Tap$1.sendTap(Tap.java:27)
    at com.google.android.apps.common.testing.ui.espresso.action.GeneralClickAction.perform(GeneralClickAction.java:81)
    at com.google.android.apps.common.testing.ui.espresso.ViewInteraction$1.run(ViewInteraction.java:106)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at android.os.Handler.handleCallback(Handler.java:730)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5103)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: 
com.google.android.apps.common.testing.ui.espresso.InjectEventSecurityException:
 java.lang.SecurityException: Injecting to another application requires 
INJECT_EVENTS permission
    at com.google.android.apps.common.testing.ui.espresso.base.InputManagerEventInjectionStrategy.injectMotionEvent(InputManagerEventInjectionStrategy.java:131)
    at com.google.android.apps.common.testing.ui.espresso.base.EventInjector.injectMotionEvent(EventInjector.java:80)
    at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl$3.call(UiControllerImpl.java:199)
    at com.google.android.apps.common.testing.ui.espresso.base.UiControllerImpl$3.call(UiControllerImpl.java:196)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
    at java.util.concurrent.FutureTask.run(FutureTask.java:234)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
    at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.SecurityException: Injecting to another application 
requires INJECT_EVENTS permission
    at android.os.Parcel.readException(Parcel.java:1431)
    at android.os.Parcel.readException(Parcel.java:1385)
    at android.hardware.input.IInputManager$Stub$Proxy.injectInputEvent(IInputManager.java:356)
    at android.hardware.input.InputManager.injectInputEvent(InputManager.java:623)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at com.google.android.apps.common.testing.ui.espresso.base.InputManagerEventInjectionStrategy.injectMotionEvent(InputManagerEventInjectionStrategy.java:122)
    ... 9 more

Test results for GoogleInstrumentationTestRunner$BridgeTestRunner=.E
Time: 2.552

FAILURES!!!
Tests run: 1,  Failures: 0,  Errors: 1

What version of maven-android-plugin are you using?

  Unknown (how do I find this?)

What are the complete output lines of "mvn -version" on your machine?

Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500)
Maven home: /usr/share/maven
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Please provide any additional information below.

The problem was first observed running tests on an LG Nexus 4. The error was 
then reproduced in an emulator running the Nexus 4 preset (hardware keyboard 
not enabled).
Turning on the hardware keyboard option works around the crash (in the 
emulator). Using a different resolution emulator image (ex. 480x854) also seems 
to avoid the problem.

It appears that Espresso is not waiting for the completion of the 
closeSoftKeyboard() and the perform(click()) is being sent to the system UI 
view (soft keyboard) instead of the Button, as desired. 

Original issue reported on code.google.com by daniel.j...@jadedpixel.com on 28 Nov 2013 at 5:28

GoogleCodeExporter commented 9 years ago
Crap. Sorry. I must have had more than one issue window open. This was supposed 
to be logged against android-test-kit. Very sorry. Please disregard

Original comment by daniel.j...@jadedpixel.com on 28 Nov 2013 at 5:30

GoogleCodeExporter commented 9 years ago

Original comment by mosa...@gmail.com on 18 Dec 2013 at 7:08