Closed Bug 533306 Opened 15 years ago Closed 10 years ago

Move mochitest-plain tests that use UniversalXPConnect to mochitest-chrome

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(e10s+)

RESOLVED WORKSFORME
Tracking Status
e10s + ---

People

(Reporter: jgriffin, Unassigned)

References

Details

Attachments

(2 files)

In order to support execution on e10s, we're going to move mochitest-plain tests that use UniversalXPConnect to mochitest-chrome.  Many of these tests use UniversalXPConnect for setting preferences, and preferences will be read-only in content processes under e10s.  Most of the remaining tests use UniversalXPConnect to initiate mouse/key events with nsIDomWindowUtils, and it isn't clear whether this will still work in content processes in e10s.  To make things simple, we're just going to move all such tests to mochitest-chrome.  There are roughly 370 affected tests.
It turns out that doing this is not always as straightforward as I thought.  Although some tests can just be moved to mochi-chrome, with some url adjustments, others do not work with this simple treatment.  There are a class of tests, including geolocation and localstorage, for example, that require test logic to reside in a content file served from an http:// url, but which need some chrome privileges, e.g., to set preferences at multiple points during a test.

To support moving this kind of test to mochi-chrome, I've created a new "sub-framework".  This framework allows a test author to split test functionality into chrome and content parts, and allows test control to flow between the two easily.  Code on each side of the test can invoke methods on the other side, with optional callbacks.  This is done by passing custom Message Events back and forth between the two sides of the test.  The framework takes care of all the details, so test logic is minimally changed.

I've already converted many tests using this framework and it seems to be an easy approach.  Once this code is approved and checked in, I'll submit patches for all the tests that I've refactored using this mechanism.  Meanwhile, I'm attaching an example as a before/after illustration.
Attachment #423630 - Flags: review?(ted.mielczarek)
Attached file testcase before and after refactoring (deleted) —
Depends on: 542660
Depends on: 542665
Depends on: 542669
Depends on: 542678
Depends on: 542830
Depends on: 542925
Depends on: 544147
Depends on: 544522
Blocks: 462483
I don't know that I really like the complexity this entails. Do you think we can just wait and see if bug 523896 pans out in a reasonable time frame?
No longer blocks: 462483
Comment on attachment 423630 [details] [diff] [review]
chrome-content subframework v0.1

Clearing review. If the extension approach doesn't pan out (but I think it will!) we can revisit this.
Attachment #423630 - Flags: review?(ted.mielczarek)
Assignee: jgriffin → nobody
Mass tracking-e10s flag change. Filter bugmail on "2be0fcce-e36a-4e2c-aa80-0e3d33eb5406".
tracking-e10s: --- → +
This bug is obsolete; we've addressed most of these concerns with SpecialPowers.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: