Closed Bug 1144797 Opened 9 years ago Closed 9 years ago

Add a utility jsm into the scope of ContentTasks

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal
Points:
1

Tracking

(e10s+, firefox40 fixed)

RESOLVED FIXED
mozilla40
Iteration:
40.1 - 13 Apr
Tracking Status
e10s + ---
firefox40 --- fixed

People

(Reporter: smacleod, Assigned: mconley, Mentored)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

It would be great to have a common JSM loaded into the scope of any spawned ContentTasks where common utility methods could live. I'm thinking something like BrowserTestUtils introduced in Bug 1093566.
Flags: firefox-backlog+
Mentor: smacleod
/r/6227 - Bug 1144797 - Add setInterval and clearInterval to Timer.jsm. r=?
/r/6229 - Bug 1144797 - Add ContentTestUtils.jsm into ContentTask scope. r=?

Pull down these commits:

hg pull review -r 90967c8b6dc47f638d3dcc5eb073f304639f8c65
Blocks: 1110887
Comment on attachment 8584859 [details]
MozReview Request: bz://1144797/mconley

/r/6227 - Bug 1144797 - Add setInterval and clearInterval to Timer.jsm. r=?
/r/6229 - Bug 1144797 - Add ContentTestUtils.jsm into ContentTask scope. r=?

Pull down these commits:

hg pull review -r 90967c8b6dc47f638d3dcc5eb073f304639f8c65
Attachment #8584859 - Flags: review?(smacleod)
https://reviewboard.mozilla.org/r/6227/#review5297

::: toolkit/modules/tests/xpcshell/test_timer.js
(Diff revision 1)
> -function run_test(browser, tab, document) {
> -  do_test_pending();
> +function run_test() {
> +  run_next_test();
> +}

You should be able to remove this since you're using add_task, no?
https://reviewboard.mozilla.org/r/6229/#review5295

::: testing/mochitest/BrowserTestUtils/moz.build
(Diff revision 1)
> +    'ContentTestUtils.jsm',

ContentTasks are used in tests only - so instead of including "test" in the name I think I'd prefer "ContentTaskUtils".

::: testing/mochitest/BrowserTestUtils/ContentTestUtils.jsm
(Diff revision 1)
> +  promiseCondition(condition, msg, interval=100, maxTries=50) {

With the other new unified test modules BrowserTestUtils and TestUtils we're avoiding the "promise<blah>" names and prefering "<thing><verbed>" or "waitFor<thing>" since everything returns a promise.

How about "conditionMet" or "waitForCondition"?

::: testing/mochitest/BrowserTestUtils/ContentTestUtils.jsm
(Diff revision 1)
> +const { utils: Cu } = Components;

Lets go ahead and bring them all in:
    const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Comment on attachment 8584859 [details]
MozReview Request: bz://1144797/mconley

https://reviewboard.mozilla.org/r/6225/#review5299

Fix it, then ship-it!
Attachment #8584859 - Flags: review?(smacleod) → review+
https://reviewboard.mozilla.org/r/6227/#review5301

> You should be able to remove this since you're using add_task, no?

That's what I thought too - but apparently, xpcshell tests are special. :/

https://developer.mozilla.org/en-US/docs/Mozilla/QA/Writing_xpcshell-based_unit_tests#XPCShell_test_utility_functions
Whiteboard: [fixed-in-fx-team]
https://hg.mozilla.org/mozilla-central/rev/c56d6f0226f2
https://hg.mozilla.org/mozilla-central/rev/41038ff05418
Assignee: nobody → mconley
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla40
Iteration: --- → 40.1 - 13 Apr
Attachment #8584859 - Attachment is obsolete: true
Attachment #8619801 - Flags: review+
Attachment #8619802 - Flags: review+
Component: BrowserTest → Mochitest
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: