Closed Bug 1088007 Opened 11 years ago Closed 11 years ago

Enhance utils.getProperty to accept multiple properties files

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect, P2)

defect

Tracking

(firefox33 fixed, firefox34 fixed, firefox35 fixed, firefox36 fixed, firefox-esr31 fixed)

RESOLVED FIXED
Tracking Status
firefox33 --- fixed
firefox34 --- fixed
firefox35 --- fixed
firefox36 --- fixed
firefox-esr31 --- fixed

People

(Reporter: danisielm, Assigned: danisielm)

References

Details

Attachments

(3 files, 4 obsolete files)

As we discussed in bug 1084333 we should update utils.getProperty() method to be similar as utils.getEntity and accept an array of URLs.
Blocks: 1088041
Attached patch v1.patch (obsolete) — Splinter Review
This is the fix. In the future we need to only accept array as parameter and update all the tests. Filed bug 1088041 for that.
Attachment #8510315 - Flags: review?(andrei.eftimie)
Attachment #8510315 - Flags: review?(andreea.matei)
Attached patch v1.1.patch (obsolete) — Splinter Review
Small updates to the test function.
Attachment #8510315 - Attachment is obsolete: true
Attachment #8510315 - Flags: review?(andrei.eftimie)
Attachment #8510315 - Flags: review?(andreea.matei)
Attachment #8510319 - Flags: review?(andrei.eftimie)
Attachment #8510319 - Flags: review?(andreea.matei)
Comment on attachment 8510319 [details] [diff] [review] v1.1.patch Review of attachment 8510319 [details] [diff] [review]: ----------------------------------------------------------------- Small change. ::: lib/tests/testUtils.js @@ +19,5 @@ > +function testUtils() { > + TEST_DATA.properties.forEach(aProp => { > + var prop = utils.getProperty(TEST_DATA.urls, aProp); > + > + expect.ok((typeof prop === "string" && prop.length > 0), "Property was recieved"); nit: received
Attachment #8510319 - Flags: review?(andrei.eftimie)
Attachment #8510319 - Flags: review?(andreea.matei)
Attachment #8510319 - Flags: review+
Attached patch v1.2.patch (obsolete) — Splinter Review
Attachment #8510319 - Attachment is obsolete: true
Attachment #8510851 - Flags: review?(hskupin)
Comment on attachment 8510851 [details] [diff] [review] v1.2.patch Review of attachment 8510851 [details] [diff] [review]: ----------------------------------------------------------------- ::: lib/tests/testUtils.js @@ +9,5 @@ > + > +const TEST_DATA = { > + urls: ["chrome://browser/locale/pageInfo.properties", > + "chrome://browser/locale/browser.properties", > + "chrome://global/locale/search/search.properties"], Wrong indentation. Please see the coding styles. @@ +20,5 @@ > + TEST_DATA.properties.forEach(aProp => { > + var prop = utils.getProperty(TEST_DATA.urls, aProp); > + > + expect.ok((typeof prop === "string" && prop.length > 0), > + "Property was received"); Not sure why we have to test this. I think its enough to check if it returns or asserts. Also we don't test an invalid property. ::: lib/utils.js @@ +335,5 @@ > + * > + * @returns {string} The value of the requested property > + */ > +function getProperty(aUrls, aPrefName) { > + aUrls = (typeof aUrls === "string") ? [aUrls] : aUrls; Do not re-assign a new value to a parameter. Also personally I would have simply updated all the tests, which make use of the method already. That way we would not have to carry around the old behavior. @@ +337,5 @@ > + */ > +function getProperty(aUrls, aPrefName) { > + aUrls = (typeof aUrls === "string") ? [aUrls] : aUrls; > + > + var property = null; nit: no need for the above blank line. @@ +348,5 @@ > + } > + catch (ex) { } > + }); > + > + if (found) { Why not checking for `if (property == null)` and raising the exception? No need for the else case then. Also I don't see the need for `found`.
Attachment #8510851 - Flags: review?(hskupin) → review-
Attached patch v2.patch (obsolete) — Splinter Review
Update patch based on review notes. ----------------------------------------------------------------- (In reply to Henrik Skupin (:whimboo) from comment #5) > Comment on attachment 8510851 [details] [diff] [review] > v1.2.patch > > Review of attachment 8510851 [details] [diff] [review]: > ----------------------------------------------------------------- > ::: lib/utils.js > @@ +335,5 @@ > > + * > > + * @returns {string} The value of the requested property > > + */ > > +function getProperty(aUrls, aPrefName) { > > + aUrls = (typeof aUrls === "string") ? [aUrls] : aUrls; > > Do not re-assign a new value to a parameter. > > Also personally I would have simply updated all the tests, which make use of > the method already. That way we would not have to carry around the old > behavior. > I already filed bug 1084333 for this so we are unblocked and we can do this sperately.
Attachment #8510851 - Attachment is obsolete: true
Attachment #8510973 - Flags: review?(andrei.eftimie)
Attachment #8510973 - Flags: review?(andreea.matei)
Summary: Ehance utils.getProperty to accept multiple properties files → Enhance utils.getProperty to accept multiple properties files
Comment on attachment 8510973 [details] [diff] [review] v2.patch Review of attachment 8510973 [details] [diff] [review]: ----------------------------------------------------------------- All changes requested were addressed.
Attachment #8510973 - Flags: review?(hskupin)
Attachment #8510973 - Flags: review?(andrei.eftimie)
Attachment #8510973 - Flags: review?(andreea.matei)
Attachment #8510973 - Flags: review+
Comment on attachment 8510973 [details] [diff] [review] v2.patch Review of attachment 8510973 [details] [diff] [review]: ----------------------------------------------------------------- Please fix the two remaining items and ask for review from Andreea or Andrei again. With that done r=me. ::: lib/tests/testUtils.js @@ +23,5 @@ > + > +function testUtils() { > + TEST_DATA.properties.forEach(aProp => { > + var prop = utils.getProperty(TEST_DATA.urls, aProp); > + expect.ok(prop, "Property was received"); nit: Property has been found. @@ +35,5 @@ > + finally { > + if (!exceptionRaised) { > + assert.fail("Invalid property has not raised an exception"); > + } > + } This code has to use expect.throws(). ::: lib/utils.js @@ +333,1 @@ > * @param {string} aPrefName Please rename it to aPropertyName
Attachment #8510973 - Flags: review?(hskupin) → review+
Attached patch v3.patchSplinter Review
Thanks!
Attachment #8510973 - Attachment is obsolete: true
Attachment #8512572 - Flags: review?(andrei.eftimie)
Attachment #8512572 - Flags: review?(andreea.matei)
Attachment #8512572 - Flags: checkin?
Comment on attachment 8512572 [details] [diff] [review] v3.patch Review of attachment 8512572 [details] [diff] [review]: ----------------------------------------------------------------- http://hg.mozilla.org/qa/mozmill-tests/rev/f8193ec21381 (default) Please check backporting.
Attachment #8512572 - Flags: review?(andrei.eftimie)
Attachment #8512572 - Flags: review?(andreea.matei)
Attachment #8512572 - Flags: review+
Attachment #8512572 - Flags: checkin?
Attachment #8512572 - Flags: checkin+
Attached patch release.patchSplinter Review
Attachment #8512682 - Flags: checkin?(andreea.matei)
Comment on attachment 8512572 [details] [diff] [review] v3.patch Applies cleanly on aurora and beta.
Attachment #8512572 - Flags: checkin+ → checkin?
Attached patch esr31.patchSplinter Review
Attachment #8512690 - Flags: checkin?(andreea.matei)
Transplanted to Aurora: https://hg.mozilla.org/qa/mozmill-tests/rev/32ad22f933a2 (mozilla-aurora) I'd leave this for at least a day on Aurora to make sure nothing regressed. Most libs/tests make use of this particular method.
Comment on attachment 8512572 [details] [diff] [review] v3.patch Aurora has been really stable the last days. Transplanted: http://hg.mozilla.org/qa/mozmill-tests/rev/152cab4d6827 (mozilla-beta)
Attachment #8512572 - Flags: checkin? → checkin+
Comment on attachment 8512682 [details] [diff] [review] release.patch Review of attachment 8512682 [details] [diff] [review]: ----------------------------------------------------------------- Everything looks fine on release as well: https://hg.mozilla.org/qa/mozmill-tests/rev/0b714227fcc6 (mozilla-release)
Attachment #8512682 - Flags: review+
Attachment #8512682 - Flags: checkin?(andreea.matei)
Attachment #8512682 - Flags: checkin+
Comment on attachment 8512690 [details] [diff] [review] esr31.patch Review of attachment 8512690 [details] [diff] [review]: ----------------------------------------------------------------- And ESR31 is also green for me. https://hg.mozilla.org/qa/mozmill-tests/rev/adee13108b46 (mozilla-esr31)
Attachment #8512690 - Flags: review+
Attachment #8512690 - Flags: checkin?(andreea.matei)
Attachment #8512690 - Flags: checkin+
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Product: Mozilla QA → Mozilla QA Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: