Closed Bug 585733 Opened 14 years ago Closed 14 years ago

Make Mozmill-test testDisableCookies local

Categories

(Mozilla QA Graveyard :: Mozmill Tests, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: u279076, Assigned: aaronmt)

References

Details

(Whiteboard: [litmus-data])

Attachments

(3 files, 5 obsolete files)

Module: testCookies/testDisableCookies.js
Test-page: test-files/cookies/cookie_single.html
Blocks: 579965
Attached patch Patch v1 - (default) (obsolete) — Splinter Review
cleanup + converts test to make use of local-data
Assignee: nobody → aaron.train
Status: NEW → ASSIGNED
Attachment #467024 - Flags: review?(anthony.s.hughes)
Comment on attachment 467024 [details] [diff] [review]
Patch v1 - (default)

>+  cm = Cc["@mozilla.org/cookiemanager;1"]
>+          .getService(Ci.nsICookieManager2);
>   cm.removeAll();

Please move the . to the end of the first line and indent getService 2 spaces from Cc.

Adding feedback? for Henrik.  Henrik, I'm thinking we shouldn't have any code like this in tests.  We should move this to an API (testCookiesAPI in this case).  Even if the API file is only a few lines, it can be built out as we go.  I don't think we should burden our community with having to know this stuff. Could/should we add this to the refactor work?
Attachment #467024 - Flags: review?(anthony.s.hughes)
Attachment #467024 - Flags: review-
Attachment #467024 - Flags: feedback?(hskupin)
(In reply to comment #2)
> >+  cm = Cc["@mozilla.org/cookiemanager;1"]
> >+          .getService(Ci.nsICookieManager2);
> >   cm.removeAll();
> 
> Please move the . to the end of the first line and indent getService 2 spaces
> from Cc.

Please don't indent. Should start at the same column.

> Adding feedback? for Henrik.  Henrik, I'm thinking we shouldn't have any code
> like this in tests.  We should move this to an API (testCookiesAPI in this
> case).  Even if the API file is only a few lines, it can be built out as we go.
>  I don't think we should burden our community with having to know this stuff.
> Could/should we add this to the refactor work?

Makes sense. I wouldn't wait for the refactoring but go ahead. File a new bug which adds the CookieAPI and the functions we need. Further all tests which make use of it should be updated too.
Attachment #467024 - Flags: feedback?(hskupin) → feedback+
Attached patch Patch v1.1 - (default) (obsolete) — Splinter Review
fixes indentation

Takes Anthony's comment about the . at the end, and Henrik's about two spaces from the margin. If this is still wrong, you guys need to come to agreement
Attachment #471554 - Flags: review?(anthony.s.hughes)
With no indentation I meant no 2 more blanks. Sorry. See the following code:
http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/XPIProvider.jsm#267
(In reply to comment #5)
> With no indentation I meant no 2 more blanks. Sorry. See the following code:
> http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/extensions/XPIProvider.jsm#267

Yes, Aaron, follow this example.

FYI, if you ever have any formatting questions, always assume the Mozilla Style guidelines.  You can refer to source code on MXR for examples.
Attachment #471554 - Attachment is obsolete: true
Attachment #471554 - Flags: review?(anthony.s.hughes)
Attached patch Patch v1.2 - (default) (obsolete) — Splinter Review
Sold. Using the example.
Attachment #471557 - Flags: review?(anthony.s.hughes)
Attachment #471557 - Flags: review?(hskupin)
Attachment #471557 - Flags: review?(anthony.s.hughes)
Attachment #471557 - Flags: review+
Comment on attachment 471557 [details] [diff] [review]
Patch v1.2 - (default)

This test will always pass due to the missing update of the following line:

 controller.assertJS("subject.cookieCount == 0",
                      {cookieCount : cm.countCookiesFromHost(".mozilla.org")});
Attachment #471557 - Flags: review?(hskupin) → review-
Good catch. The cookie preferences manager for the cookie we create in cookie_single.html, has no specified domain nor a comparable path, i.e., (/Users/Aaron/). Can we use cookieExists to check for a blank domain and none specific path for this local cookie we create?
Scratch that above comment, was thinking locally instead of localhost. 

Patch changes the assert to check the count of the cookies from host localhost
Attachment #467024 - Attachment is obsolete: true
Attachment #471557 - Attachment is obsolete: true
Attachment #474823 - Flags: review?(hskupin)
Comment on attachment 474823 [details] [diff] [review]
Patch v1.3 - [localhost] - (default)

>-  // Search for a cookie from mozilla.org and verify cookies are not saved
>+  // Search for a cookie from localhost and verify cookies are not saved
>   controller.assertJS("subject.cookieCount == 0",
>-                      {cookieCount : cm.countCookiesFromHost(".mozilla.org")});
>+                      {cookieCount : cm.countCookiesFromHost("localhost")});

I don't like that we hard-code the value. Please grab the hostname directly from the url in the locationbar after the test page has been loaded. There is an API function you can use. It's fairly straight forward.
Attachment #474823 - Flags: review?(hskupin) → review-
You talking about nsIURI.host or simply window.content.location.hostname?
Whatever makes it easier.
Attachment #474823 - Attachment is obsolete: true
Attachment #477124 - Flags: review?(hskupin)
Comment on attachment 477124 [details] [diff] [review]
Patch v1.4 - [fix from comment 11] - (default)

Same as for the other cookie test. Please use persisted to store values which are shared between functions.

In the future only update one of the tests which need the same updates. It will lower the amount of review work.
Attachment #477124 - Flags: review?(hskupin) → review-
Attached patch Patch v1.5 - (default) (obsolete) — Splinter Review
Attachment #477499 - Flags: review?(hskupin)
Attachment #477499 - Flags: review?(hskupin)
Attachment #477499 - Attachment is obsolete: true
Please let this be the last one :D
Attachment #477504 - Flags: review?(hskupin)
Comment on attachment 477504 [details] [diff] [review]
Patch v1.5 - (default)

>+  persisted.hostName = {};

The last part you will have to update is that line. Please assign 'undefined' otherwise we have an empty object lingering around for the remaining tests.

With that change r=me.
Attachment #477504 - Flags: review?(hskupin) → review+
Keywords: checkin-needed
(In reply to comment #19)
> Created attachment 477953 [details] [diff] [review]
> Patch v1.5 - (default + teardown change)

Landed:
http://hg.mozilla.org/qa/mozmill-tests/rev/9a2c4c472264 [default]
http://hg.mozilla.org/qa/mozmill-tests/rev/d1e39d7472f8 [mozilla1.9.2]
http://hg.mozilla.org/qa/mozmill-tests/rev/c1f94b26ce1c [mozilla1.9.1]
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Move of Mozmill Test related project bugs to newly created components. You can
filter out those emails by using "Mozmill-Tests-to-MozillaQA" as criteria.
Product: Testing → Mozilla QA
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: