Closed Bug 1286168 Opened 3 years ago Closed 3 years ago

Add a RAII class to initialize ImageLib services in GTests

Categories

(Core :: ImageLib, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla50
Tracking Status
firefox50 --- fixed

People

(Reporter: seth, Assigned: seth)

References

Details

Attachments

(1 file)

There are many ImageLib features that implicitly depend on the ImageLib being initialized. We've been taking care of that by creating an imgITools instance in the various GTest files which need this. However, it's not ideal to do this in the SetUpTestCase() method that GTest provides, because in some cases (which don't exist yet, but they will) we need to make sure that ImageLib is initialized before initializing certain *member variables of the test fixture*. Given that requirement, the best bet here to to create a RAII class that takes care of the problem.
Here's the patch. I went ahead and switched existing GTests over to use the new RAII class.
Attachment #8770033 - Flags: review?(n.nethercote)
Comment on attachment 8770033 [details] [diff] [review]
Add a RAII class to initialize ImageLib services in GTests.

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

Hooray for less code duplication.
Attachment #8770033 - Flags: review?(n.nethercote) → review+
Pushed by mfowler@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a5c17d3e26c6
Add a RAII class to initialize ImageLib services in GTests. r=njn
https://hg.mozilla.org/mozilla-central/rev/a5c17d3e26c6
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla50
You need to log in before you can comment on or make changes to this bug.