Last Comment Bug 880621 - Create a test that checks about:cache after private browsing
: Create a test that checks about:cache after private browsing
Status: RESOLVED FIXED
:
Product: Firefox
Classification: Client Software
Component: Private Browsing (show other bugs)
: unspecified
: All All
: -- normal (vote)
: Firefox 25
Assigned To: Manuela Muntean [Away]
:
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-07 02:07 PDT by Manuela Muntean [Away]
Modified: 2013-07-17 06:06 PDT (History)
7 users (show)
ryanvm: in‑testsuite+
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Create a browser chrome test that checks about:cache after private browsing (4.51 KB, patch)
2013-07-03 07:36 PDT, Manuela Muntean [Away]
ehsan: feedback-
Details | Diff | Review
second version of the test (4.93 KB, patch)
2013-07-16 04:27 PDT, Manuela Muntean [Away]
ehsan: review+
Details | Diff | Review

Description Manuela Muntean [Away] 2013-06-07 02:07:06 PDT
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.
Comment 1 Manuela Muntean [Away] 2013-06-07 02:39:49 PDT
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!
Comment 2 :Ehsan Akhgari (busy, don't ask for review please) 2013-06-07 07:17:01 PDT
(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!
Comment 3 :Ehsan Akhgari (busy, don't ask for review please) 2013-06-07 07:17:28 PDT
Sorry, :jdm, not :jsm!
Comment 4 Josh Matthews [:jdm] 2013-06-07 07:39:09 PDT
I found nothing.
Comment 5 Honza Bambas (:mayhemer) 2013-06-11 07:19:58 PDT
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
Comment 6 Manuela Muntean [Away] 2013-07-03 07:36:44 PDT
Created attachment 770796 [details] [diff] [review]
Create a browser chrome test that checks about:cache after private browsing

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!
Comment 7 :Ehsan Akhgari (busy, don't ask for review please) 2013-07-03 10:16:33 PDT
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?
Comment 8 Manuela Muntean [Away] 2013-07-15 05:40:03 PDT
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
Comment 9 :Ehsan Akhgari (busy, don't ask for review please) 2013-07-15 10:27:23 PDT
(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?
Comment 10 Manuela Muntean [Away] 2013-07-16 04:24:19 PDT
> > > @@ +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
Comment 11 Manuela Muntean [Away] 2013-07-16 04:27:15 PDT
Created attachment 776325 [details] [diff] [review]
second version of the test

The test passes both on Ubuntu and Mac machines.
Comment 12 Ryan VanderMeulen [:RyanVM] 2013-07-16 08:22:54 PDT
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.
Comment 13 Ryan VanderMeulen [:RyanVM] 2013-07-16 13:28:18 PDT
https://hg.mozilla.org/mozilla-central/rev/269b7a2b7310
Comment 14 Honza Bambas (:mayhemer) 2013-07-17 05:53:10 PDT
Note: this will break after new cache backend lands.
Comment 15 Honza Bambas (:mayhemer) 2013-07-17 06:06:12 PDT
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 ;)

Note You need to log in before you can comment on or make changes to this bug.