Closed Bug 613444 Opened 9 years ago Closed 9 years ago

Refactor nsIPrompt tests

Categories

(Toolkit :: General, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla2.0b8

People

(Reporter: Dolske, Assigned: Dolske)

References

Details

Attachments

(1 file)

Attached patch Patch v.1Splinter Review
Currently the nsIPrompt mochitests (in /toolkit/components/prompts/tests/) only test functionality via nsIPromptService, and the single test is checking both the APIs implemented by commonDialog.xul and selectDialog.xul.

This needs to change a bit to make it easy to test the tab-modal prompts being added by bug 59314. Specifically:

* Split the select() tests into a separate file (which is otherwise unchanged, since tab-modal prompts don't implement this yet).

* Move test body into a runTest() function which can be called repeatedly, in different configurations.

* Add the ability to test either via nsIPromptService or via an nsIPrompt instance (obtained via nsIPromptFactory). Tab modal prompts require obtaining a nsIPrompt instance, and although there's not much difference between the two cases for window-modal prompts, it might be nice to test both anyway. (The two APIs only differ how you provide a |window| argument).

* Use the |Dialog.ui| object on the prompt (added in bug 575485 part 3) instead of getElementById().

Note that although this is shuffling a bunch of code around, it's not removing anything that was previously tested, nor changing any existing test conditions.

Also, this patch currently works both with and without the tab-modal support added in bug 59314; I intend to land this patch before that bug lands.
Asked gavin if he wanted to bother reviewing this: answer was no. :)

Pushed http://hg.mozilla.org/mozilla-central/rev/9f934ed430c3
Status: NEW → RESOLVED
Closed: 9 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b8
You need to log in before you can comment on or make changes to this bug.