Closed Bug 715444 Opened 12 years ago Closed 12 years ago

Robotium tests sometimes miss DOMContentLoaded and hang forever

Categories

(Testing :: General, defect)

x86
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla12

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: not-fennec-11)

Attachments

(1 file)

If the page loads fast enough, it is possible for the DOMContentLoaded to be fired between calling click() on the awesome screen and calling waitForGeckoEvent. In this scenario, the listener is registered after the event fires, and then robotium blocks forever waiting for the event. Attached patch fixes the problem.
Attachment #586000 - Flags: review?(jmaher)
Comment on attachment 586000 [details] [diff] [review]
Add the EventExpecter to prevent missing events

Review of attachment 586000 [details] [diff] [review]:
-----------------------------------------------------------------

::: build/mobile/robocop/FennecNativeActions.java.in
@@ +167,5 @@
> +    }
> +
> +    void notifyOfEvent() {
> +      try {
> +        unregisterGEL.invoke(null, mRegistrationParams);

is notifyOfEvent() always called?  I just want to make sure we are always unregisterGEL() when we have a registerGEL() call prior.
Attachment #586000 - Flags: review?(jmaher) → review+
If we receive the event, then yes, notifyOfEvent should always be called. If we don't receive the event then this blocks forever, same as the old version.
Actually, to clarify: "this blocks forever" refers to the code that would call blockForEvent(). If there's a test that just polls using eventReceived(), and the event never arrives, then we won't unregister. If that's an issue I can stick unregistration code in the finalize() method as well.
https://hg.mozilla.org/mozilla-central/rev/aae720a32088
Status: NEW → RESOLVED
Closed: 12 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.

Attachment

General

Created:
Updated:
Size: