Closed Bug 1185035 Opened 9 years ago Closed 9 years ago

Clean up TaskManager tests to avoid shared state between suites and tests

Categories

(Firefox OS Graveyard :: Gaia::System::Task Manager, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
FxOS-S3 (24Jul)

People

(Reporter: sfoster, Assigned: sfoster)

References

Details

(Whiteboard: [systemsfe])

Attachments

(1 file)

Although TaskManager is (mostly) instantiable, its tests reuse a single instance, making it hard to test different initialization conditions, and making tests prone to side-effects of previous tests.
Assignee: nobody → sfoster
Target Milestone: --- → FxOS-S3 (24Jul)
Comment on attachment 8635457 [details] [review]
[gaia] sfoster:taskmanager-tests-bug-1185035 > mozilla-b2g:master

This PR extracts the TaskManager unit test changes from the patch on bug 1169012, and applies them to the existing TaskManager. I rolled in the settings changes, and state initialization in the constructor. I've kept the properties on the prototype mostly for the jsdocs. Any other changes are to address instantiability issues - particularly if an instance is started but never shown, or not hidden as expected. 

In the tests themselves, we create a clean instance and set of app fixtures for each test.
Attachment #8635457 - Flags: review?(etienne)
Comment on attachment 8635457 [details] [review]
[gaia] sfoster:taskmanager-tests-bug-1185035 > mozilla-b2g:master

Thanks! Much easier to pay attention to the changes.
And consequently, lots of comments on github :)
Attachment #8635457 - Flags: review?(etienne)
Comment on attachment 8635457 [details] [review]
[gaia] sfoster:taskmanager-tests-bug-1185035 > mozilla-b2g:master

round 2, I fixed the nits, moved the cleanup to a global teardown. In the global setup I do create a new TaskManager instance and start() it - that seems reasonable as its setup that is normally performed outside task_manager.js.

I did a little more test refactoring - mostly making some of the async tests sync. Some of this was in the course of troubleshooting a bug I introduced that I eventually spotted - but I think its all better than it was. Hopefully you agree :)
Attachment #8635457 - Flags: review?(etienne)
Comment on attachment 8635457 [details] [review]
[gaia] sfoster:taskmanager-tests-bug-1185035 > mozilla-b2g:master

Perfect!
Thanks for sticking with it :)
Attachment #8635457 - Flags: review?(etienne) → review+
Merged to master: https://github.com/mozilla-b2g/gaia/commit/eaff79aa68e12d533aa1a24ef169b97fe7df2887
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: