Closed Bug 880621 Opened 11 years ago Closed 11 years ago

Create a test that checks about:cache after private browsing

Categories

(Firefox :: Private Browsing, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
Firefox 25

People

(Reporter: manuela.muntean, Assigned: manuela.muntean)

Details

Attachments

(2 files)

This test should cover MozTrap test 6047.

STR:
1. Clear cache through Tools > Clear Recent History
2. Open about:cache
3. Go to the File main menu and select "New Private Window" (or press Ctrl+Shift+P / Cmd+Shift+P).
4. Navigate to www.craigslist.org
5. Open about:cache and click "List cache entries" under Memory Cache
6. Close the private window
7. Check about:cache

Expected Results:
Step 2: Disk cache should report 0KB and have no entries.
Step 5: You should see some entries from the craigslist domain.
Step 7: Disk cache should report no "craigslist" entries.
Assignee: nobody → manuela.muntean
Status: NEW → ASSIGNED
Version: Trunk → unspecified
Ehsan, I looked through mxr and didn't find an existing test for this. Please let me know if there is one and I just didn't find it. Thanks!
Flags: needinfo?(ehsan)
(In reply to Manuela Muntean [:Manuela] [QA] from comment #1)
> Ehsan, I looked through mxr and didn't find an existing test for this.
> Please let me know if there is one and I just didn't find it. Thanks!

I don't think we have a test for this, but let's give Josh a chance to prove me wrong!
Flags: needinfo?(ehsan) → needinfo?(jsmith)
Sorry, :jdm, not :jsm!
Flags: needinfo?(jsmith) → needinfo?(josh)
I found nothing.
Flags: needinfo?(josh)
To note: about:cache will be broken after the new cache code will land on m-c.  There will be apis to walk private browsing cache content, it will probably be better to use in tests.  Those apis are planned to be used for any newer generations of about:cache anyway.  See [1], [2] and [3] for more info.

[1] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/base/public/nsILoadContextInfo.idl
[2] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/cache2/nsICacheStorageService.idl
[3] https://hg.mozilla.org/projects/gum/file/b52f1831a9e8/netwerk/cache2/nsICacheStorage.idl
The test passes on Mac OSX, but has one fail on Ubuntu, when checking the number of entries under Memory cache, in the private window.

I don't know what could be the problem on Ubuntu. Ehsan, could you please help me with some feedback? Thanks in advance!
Attachment #770796 - Flags: feedback?(ehsan)
Comment on attachment 770796 [details] [diff] [review]
Create a browser chrome test that checks about:cache after private browsing

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

::: browser/components/privatebrowsing/test/browser/browser_privatebrowsing_cache.js
@@ +39,5 @@
> +  prefs.setBoolPref("formdata", false);
> +  prefs.setBoolPref("offlineApps", false);
> +  prefs.setBoolPref("passwords", false);
> +  prefs.setBoolPref("sessions", false);
> +  prefs.setBoolPref("siteSettings", false);

You need to use clearUserPref when your test is done to make sure that you're not affecting tests run after this one.

@@ +79,5 @@
> +    executeSoon(function() {
> +
> +      ok(true, "The private window got loaded");
> +
> +      let tab = win.gBrowser.addTab("http://example.iana.org/");

Use example.com.  Our tests are not supposed to access external resources.

@@ +89,5 @@
> +
> +        executeSoon(function() {
> +
> +          let nrEntriesP = get_device_entry_count("memory");
> +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");

What does the test failure here look like?
Attachment #770796 - Flags: feedback?(ehsan) → feedback-
Sorry for this late reply, but I was on PTO. Thanks for the prompt review! :)

> @@ +79,5 @@
> > +    executeSoon(function() {
> > +
> > +      ok(true, "The private window got loaded");
> > +
> > +      let tab = win.gBrowser.addTab("http://example.iana.org/");
> 
> Use example.com.  Our tests are not supposed to access external resources.

I used "example.iana.org" because I observed that both when running the automated test and performing it manually, after typing "example.com" in the adress bar, it redirects me to "example.iana.org". Also, when manually checking the number of entries under Memory cache, in "about:cache" from the private window, I get these 3 entries:

http://example.iana.org/

http://example.iana.org/favicon.ico

http://example.com/


I assume I only need to take into account "http://example.com/", so I'm checking to see if there is this particularly one entry, right?

 
> @@ +89,5 @@
> > +
> > +        executeSoon(function() {
> > +
> > +          let nrEntriesP = get_device_entry_count("memory");
> > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> 
> What does the test failure here look like?

This is the fail that I get on Ubuntu (when testing with both "example.iana.org" and "example.com"): Memory cache reports some entries from example.com domain - Got -1, expected 1
Flags: needinfo?(ehsan)
(In reply to Manuela Muntean [:Manuela] [QA] from comment #8)
> Sorry for this late reply, but I was on PTO. Thanks for the prompt review! :)
> 
> > @@ +79,5 @@
> > > +    executeSoon(function() {
> > > +
> > > +      ok(true, "The private window got loaded");
> > > +
> > > +      let tab = win.gBrowser.addTab("http://example.iana.org/");
> > 
> > Use example.com.  Our tests are not supposed to access external resources.
> 
> I used "example.iana.org" because I observed that both when running the
> automated test and performing it manually, after typing "example.com" in the
> adress bar, it redirects me to "example.iana.org". Also, when manually
> checking the number of entries under Memory cache, in "about:cache" from the
> private window, I get these 3 entries:
> 
> http://example.iana.org/
> 
> http://example.iana.org/favicon.ico
> 
> http://example.com/
> 
> 
> I assume I only need to take into account "http://example.com/", so I'm
> checking to see if there is this particularly one entry, right?

Sorry, I should have said example.org.  example.org is redirected to a local web server which runs the mochitests.

> > @@ +89,5 @@
> > > +
> > > +        executeSoon(function() {
> > > +
> > > +          let nrEntriesP = get_device_entry_count("memory");
> > > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> > 
> > What does the test failure here look like?
> 
> This is the fail that I get on Ubuntu (when testing with both
> "example.iana.org" and "example.com"): Memory cache reports some entries
> from example.com domain - Got -1, expected 1

If you open about:cache after the test has run, do you see a memory cache entry for this site?
Flags: needinfo?(ehsan)
> > > @@ +89,5 @@
> > > > +
> > > > +        executeSoon(function() {
> > > > +
> > > > +          let nrEntriesP = get_device_entry_count("memory");
> > > > +          is (nrEntriesP, 1, "Memory cache reports some entries from example.iana.org domain");
> > > 
> > > What does the test failure here look like?
> > 
> > This is the fail that I get on Ubuntu (when testing with both
> > "example.iana.org" and "example.com"): Memory cache reports some entries
> > from example.com domain - Got -1, expected 1
> 
> If you open about:cache after the test has run, do you see a memory cache
> entry for this site?

Yes
The test passes both on Ubuntu and Mac machines.
Attachment #776325 - Flags: review?(ehsan)
Attachment #776325 - Flags: review?(ehsan) → review+
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/269b7a2b7310

Please make sure that future patches have a commit message that summarizes what the patch is doing before requesting checkin.
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/269b7a2b7310
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Note: this will break after new cache backend lands.
Better note: this *might* break after new cache lands.  However, we will turn all test to green before it should go to the tree.  However, one of ways to make the tree green is to disable this test.  We will see, maybe I just speak to soon ;)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: