Closed Bug 545457 Opened 14 years ago Closed 8 years ago

Get http-state tests running as unit tests


(Core :: Networking: Cookies, defect)

Not set





(Reporter: dwitte, Unassigned)



(1 file)

+++ This bug was initially created as a clone of Bug #542974 +++

See Many of the http-state tests require testing from a given domain. The http-state tests achieve this by having entries in /etc/hosts; since we clearly can't do that, the next best thing is to run them as mochitests with appropriate servers for each test. This will let us test arbitrary origins separately in each test; see for details.

I'll post a patch to show the general idea.
Actually, meh. Mochitests are a bit overcomplicated for this. Let's just do it with xpcshell tests, using the nsICookieService interface directly. This doesn't quite get us end-to-end testing, but it's pretty damn close.

Here are the two sample tests - pretty easy to generate with a little python script. The 'uri' variable can obviously be adjusted depending on what kind of subdomain tests you want; making an 'https' URI will similarly allow testing of the 'secure' attribute; calling {set,get}CookieString instead of {set,get}CookieStringFromHttp will allow testing of 'document.cookie'-ish behavior wrt 'httpOnly'.

If you want more detailed poking at the internal cookie structures than getCookieString{FromHttp} can provide, this can easily be accomplished using the nsICookieManager{2} interface.
Closed: 8 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.