Closed Bug 877441 Opened 13 years ago Closed 13 years ago

make head.js file to reduce copy-paste in psm unit tests

Categories

(Core :: Security: PSM, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla24

People

(Reporter: cviecco, Assigned: cviecco)

Details

Attachments

(1 file, 4 obsolete files)

No description provided.
Attached patch unit-psm-head (v1) (obsolete) — — Splinter Review
version 1 only common stuff. Wished more could get in.
Attachment #755655 - Flags: feedback?(dkeeler)
try push (all platforms, only xpcshell tests) https://tbpl.mozilla.org/?tree=Try&rev=8c8fa0549d0
Comment on attachment 755655 [details] [diff] [review] unit-psm-head (v1) Review of attachment 755655 [details] [diff] [review]: ----------------------------------------------------------------- Looks great. How about an addCertFromFile function like this: function addCertFromFile(filename, trustString) { let certdb = Cc["@mozilla.org/security/x509certdb;1"] .getService(Ci.nsIX509CertDB); let certFile = do_get_file(filename, false); let der = readFile(certFile); certdb.addCert(der, trustString, null); } ::: security/manager/ssl/tests/unit/head.js @@ +6,5 @@ > +const { 'classes': Cc, 'interfaces': Ci, 'utils': Cu, 'results': Cr } = Components; > + > +let tempScope = {}; > +Cu.import("resource://gre/modules/NetUtil.jsm", tempScope); > +let NetUtil = tempScope.NetUtil; In terms of temporary scope, this is what I've been doing: let { NetUtil } = Cu.import("resource://gre/modules/NetUtil.jsm", {}); ::: security/manager/ssl/tests/unit/test_datasignatureverifier.js @@ +1,2 @@ > +//const Cc = Components.classes; > +//const Ci = Components.interfaces; Just remove these entirely? ::: security/manager/ssl/tests/unit/xpcshell.ini @@ +3,1 @@ > tail = these lines look like they already had a trailing space - I would say go ahead an remove them (the spaces)
Attachment #755655 - Flags: feedback?(dkeeler) → feedback+
Attached patch unit-psm-head (v2) (obsolete) — — Splinter Review
Attachment #755655 - Attachment is obsolete: true
Attached patch unit-psm-head (v2.1) (obsolete) — — Splinter Review
removal of comment change from v2
Attachment #755678 - Attachment is obsolete: true
Attachment #755679 - Flags: review?(bsmith)
Comment on attachment 755679 [details] [diff] [review] unit-psm-head (v2.1) Review of attachment 755679 [details] [diff] [review]: ----------------------------------------------------------------- Nit: IMO, "head_psm.js" is a better name because it is easier to distinguish from other "head.js" files open in other editor tabs/buffers. ::: security/manager/ssl/tests/unit/head.js @@ +1,3 @@ > +/* > + Some license here (or not, bsmith?) > +*/ I guess just use the standard MPL block and mode line (adjusted C++ -> JS): https://developer.mozilla.org/en-US/docs/Developer_Guide/Coding_Style#Mode_Line
Attachment #755679 - Flags: review?(bsmith) → review+
Attached patch unit-psm-head (v3) (obsolete) — — Splinter Review
Attachment #755679 - Attachment is obsolete: true
Attachment #756135 - Flags: review+
keeping r+ from bsmith
Attachment #756135 - Attachment is obsolete: true
Attachment #756139 - Flags: review+
Assignee: nobody → cviecco
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: