Closed Bug 879089 Opened 8 years ago Closed 7 years ago

Intermittent testMasterPassword | Exception caught - java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: RyanVM, Assigned: gbrown)

References

Details

(Keywords: intermittent-failure)

Attachments

(1 file)

https://tbpl.mozilla.org/php/getParsedLog.php?id=23734092&tree=Fx-Team

Android 4.0 Panda fx-team opt test robocop-2 on 2013-06-03 14:21:50 PDT for push c8b95e4bf23c
slave: panda-0779

0 INFO SimpleTest START
1 INFO TEST-START | testMasterPassword
EventExpecter: no longer listening for Gecko:Ready
2 INFO TEST-PASS | testMasterPassword | Verify if the OK button is inactive - The OK button is inactive until both fields are filled
3 INFO TEST-PASS | testMasterPassword | Verify if the OK button is inactive - The OK button is inactive until the Confirm password field is filled
4 INFO TEST-PASS | testMasterPassword | Verify if the OK button is inactive - The OK button is inactive until both fields contain the same password
5 INFO TEST-PASS | testMasterPassword | Verify if the OK button is inactive - The OK button is inactive until the Password field is filled
6 INFO TEST-PASS | testMasterPassword | Checking if no password was set if the action was canceled - No password was set
7 INFO TEST-PASS | testMasterPassword | waiting to convert the letters in dots - The letters are converted in dots
8 INFO TEST-PASS | testMasterPassword | Checking if the password is enabled - The password is enabled
9 INFO TEST-PASS | testMasterPassword | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_login.html should equal http://mochi.test:8888/tests/robocop/robocop_login.html
EventExpecter: no longer listening for DOMContentLoaded
10 INFO TEST-PASS | testMasterPassword | Doorhanger notification is displayed - true should equal true
11 INFO TEST-PASS | testMasterPassword | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_login.html should equal http://mochi.test:8888/tests/robocop/robocop_login.html
EventExpecter: no longer listening for DOMContentLoaded
12 INFO TEST-PASS | testMasterPassword | Doorhanger notification is hidden - false should equal false
Exception caught during test!
java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
	at android.os.Parcel.readException(Parcel.java:1327)
	at android.os.Parcel.readException(Parcel.java:1281)
	at android.view.IWindowManager$Stub$Proxy.injectKeyEvent(IWindowManager.java:1178)
	at android.app.Instrumentation.sendKeySync(Instrumentation.java:859)
	at android.app.Instrumentation.sendCharacterSync(Instrumentation.java:884)
	at org.mozilla.fennec.FennecNativeActions.sendKeyCode(FennecNativeActions.java:461)
	at org.mozilla.fennec.FennecNativeActions.sendSpecialKey(FennecNativeActions.java:446)
	at org.mozilla.fennec.tests.BaseTest.selectMenuItem(BaseTest.java:426)
	at org.mozilla.fennec.tests.testMasterPassword.clearPrivateData(testMasterPassword.java:154)
	at org.mozilla.fennec.tests.testMasterPassword.verifyLoginPage(testMasterPassword.java:204)
	at org.mozilla.fennec.tests.testMasterPassword.testMasterPassword(testMasterPassword.java:24)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	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 org.mozilla.fennec.tests.BaseTest.runTest(BaseTest.java:129)
	at junit.framework.TestCase.runBare(TestCase.java:127)
	at junit.framework.TestResult$1.protect(TestResult.java:106)
	at junit.framework.TestResult.runProtected(TestResult.java:124)
	at junit.framework.TestResult.run(TestResult.java:109)
	at junit.framework.TestCase.run(TestCase.java:118)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:545)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1551)
13 INFO TEST-UNEXPECTED-FAIL | testMasterPassword | Exception caught - java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission
14 INFO TEST-END | testMasterPassword | finished in 130478ms
15 INFO TEST-START | Shutdown
16 INFO Passed: 11
17 INFO Failed: 1
18 INFO Todo: 0
19 INFO SimpleTest FINISHED
This seems to be just another incident of Watcher death:

06-03 14:54:00.015 I/ActivityManager( 1405): No longer want com.mozilla.watcher (pid 1796): hidden #16
06-03 14:54:00.031 W/ActivityManager( 1405): Scheduling restart of crashed service com.mozilla.watcher/.WatcherService in 5000ms
Assignee: nobody → gbrown
Depends on: 867360
Although bug 867360 is resolved, the watcher still has not been deployed -- just waiting on watcher deployment to resolve this bug.
I'm seeing something similar to this bug on fig, happening to testSettingsMenuItems this time:
https://tbpl.mozilla.org/php/getParsedLog.php?id=26142200&tree=Fig

Could this have the same underlying cause?
(In reply to :Margaret Leibovic from comment #3)
 > Could this have the same underlying cause?

We get this "Injecting to another application..." exception during a robocop test whenever fennec is not in the foreground. Typical scenarios:
 - watcher (or sutagent) died and was restarted during the test and took foreground
 - fennec is exiting (crashing?) and has taken down the UI but is still executing sufficiently that the robocop test code is still running
I do not see evidence of these scenarios in your log. I notice:

08-04 16:23:19.180 I/ActivityManager( 1019): moveTaskToBack: 7
08-04 16:23:19.190 D/GeckoHealthRec( 4597): Recording session end: P
08-04 16:23:19.450 W/InputManagerService( 1019): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@48551b38

but I don't know how to interpret that.
Also, you can see that SUTagent is the application in foreground:

injecting key event from pid 4597 uid 10035 to window Window{4841f600 com.mozilla.SUTAgentAndroid/com.mozilla.SUTAgentAndroid.SUTAgentAndroid

which would be expected if fennec ended, or went to background (SUTagent has foreground until a test starts fennec).
looking in the logs for robocop I see:
 waitForText timeout on Enter Search

the problem cod in SelectMenuItems is here:
// Dismiss the Settings screen and verify that the view is returned to about:home page
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
verifyUrl("about:home");
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
waitForText("Enter Search"); // Waiting for page title to appear to be sure that is fully loaded before opening the menu

I believe the second BACK minimizes fennec instead of closing the keyboard(I think that is here). I haven't ran the test to verify but I believe this is the issue.
(In reply to Adrian Tamas (:AdrianT) from comment #6)
> looking in the logs for robocop I see:
>  waitForText timeout on Enter Search
> 
> the problem cod in SelectMenuItems is here:
> // Dismiss the Settings screen and verify that the view is returned to
> about:home page
> mActions.sendSpecialKey(Actions.SpecialKey.BACK);
> verifyUrl("about:home");
> mActions.sendSpecialKey(Actions.SpecialKey.BACK);
> waitForText("Enter Search"); // Waiting for page title to appear to be sure
> that is fully loaded before opening the menu
> 
> I believe the second BACK minimizes fennec instead of closing the keyboard(I
> think that is here). I haven't ran the test to verify but I believe this is
> the issue.

I filed bug 901766 about that specific failure, and it looks like lucasr already made a fix in there.
Depends on: 876715
Attached patch MasterPasswordSplinter Review
This patch updates the test using some new methods included in base-test. It should help reducing intermittent fails by better managing the waiting periods.
Looks good on try server.
https://tbpl.mozilla.org/?tree=Try&rev=d368e456278f&jobname=Android%204.0%20Panda%20try%20opt%20test%20robocop-2
Attachment #789438 - Flags: review?(jmaher)
Attachment #789438 - Flags: review?(jmaher)
Sorry wrong bug, this was intended for Bug 878587
These failures seem to stop around the time testMasterPassword.java.in was updated in bug 905591.
(In reply to Geoff Brown [:gbrown] from comment #2)
> Although bug 867360 is resolved, the watcher still has not been deployed --
> just waiting on watcher deployment to resolve this bug.

The new watcher is now deployed.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.