Closed Bug 715369 Opened 8 years ago Closed 8 years ago

Robocop: FennecNativeElement uses getCurrentActivity


(Testing :: General, defect)

Not set


(Not tracked)



(Reporter: gbrown, Assigned: gbrown)



(Whiteboard: not-fennec-11)


(1 file)

FennecNativeElement uses the Robotium Solo.getCurrentActivity function. :kats reports that getCurrentActivity provides the wrong activity in his tests on a Galaxy Tab. 

There are reports that getCurrentActivity is not reliable and provides unpredictable results on Honeycomb and ICS. A "workaround" is discussed here:
So I tried the workaround, along with a dozen other things, and none of them worked. The robotium library uses the android Instrumentation.ActivityMonitor under the hood, and for some reason it doesn't always give the expected activity as the last activity seen. I think there's either a bug in the android code (haven't looked at the source for that yet) or somehow fennec is sending an intent to the awesomebar activity, which confuses the ActivityMonitor and makes it think it's on top again. I had an idea that we could change the FennecNativeDriver's findElement function to require an activity to be passed in, rather than trying to find the current activity. However, the problem is that we still need a handle to the activity which may be troublesome to always track. I have a couple more ideas I can try tomorrow.
Tried some more things, and none of them worked. I can't find any reliable method to get a hold of the Activity objects.
I have tried some (obvious) things too, but none of them worked.
Ok, so this seems to work, mostly. It still reports some of the tests as failing (in logcat), I think because it's not starting with a clean profile or something and so there's accumulated tabs. But at least it's not crashing, and the views are being found ok.
Attachment #586217 - Flags: review?(jmaher)
Comment on attachment 586217 [details] [diff] [review]
Bind activity to Element and stop relying on currentActivity

Review of attachment 586217 [details] [diff] [review]:

Thanks.  This is getting a bit more complicated, but I would rather go for stability than simple!
Attachment #586217 - Flags: review?(jmaher) → review+
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
Whiteboard: not-fennec-11
You need to log in before you can comment on or make changes to this bug.