Closed Bug 443017 Opened 15 years ago Closed 14 years ago
Create tests for new application cache stuff
New tests for: - opportunistic caching - whitelisting - foreign marking - fallbacks We will need to find out how to modify manifest files to test updates and swapCache. Also I am not sure how to do testing of fallback for images, probably introduce a kind of reftesting to mochitest or wait for bug 430652 to land.
Tests for: - opportunistic caching - opportunistic caching propagation (among different caches) - whitelisting + check we load from network - foreign marking - fallbacks - complex test for cache update
Assignee: nobody → honzab
Attachment #327668 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Test for opportunistic caching propagation changed to 'todo'. After bug 444807 gets fixed the test will be reintroduced.
same as v2, cache update test enhanced of dynamic entries carry check.
fixed cache discard in opportunistic propagation test and added new test for behavior in offline mode.
Comment on attachment 330196 [details] [diff] [review] Complete test, v4 >- applicationCache.swapCache(); >+ // XXX: @666 Why is swapCache() call here? there is not an update >+ // nor a newer cache and swapCache() therefor throws an exception >+ // according to the spec what breaks the test. >+ //applicationCache.swapCache(); The swapCache() call was there because we need 442812 before the cache is assoicated by default. So there is a newer cache available. Rather than commenting it out, this should be changed to a test - make sure that the exception IS thrown (and if the tests land before 442812, this can be a todo() test).
This bug introduces a bunch of tests for all the offline cache stuff.
Some new tests, addressed comments.
- changed blocking to false in waitForAdd because I almost every time experience deadlock in this method; that is more a quick workaround then real fix, see bug 445733 - updated the way of on-server data override management; bug 443610 has been landed
These are tests fixed to work with new nsIApplicationCacheNamespace interface. There are TODOs for new implicit (master) entries caching and for opportunistic cache propagation (autocaching). After bug 443023 and bug 461327 are both landed we can land these tests.
Hrm, can we remove the opportunistic tests, since we're about to remove that functionality anyway?
Er... we are? Why did we implement it, then?
It was removed from the spec recently after some argument that it's not a particularly useful feature (there was some significant overlap with implicitly-cached entries). Tracked in bug 460327.
Includes simplified test set (no opportunistic caching).
Comment on attachment 345627 [details] [diff] [review] ng 1 OK, now test_foreign.html: >diff --git a/dom/tests/mochitest/ajax/offline/test_foreign.html b/dom/tests/mochitest/ajax/offline/test_foreign.html >new file mode 100644 >+/** >+ * This test loads a manifest that contains as an explicit entry >+ * foreign2.html page. After manifest is cached and presence of the >+ * foreign2.html page is checked we redirect to foreign2.html >+ * page. Then the test continues inside that page as follows: >+ * On load of foreign2.html we check there is no associated cache with it just "no associated cache" >+ * because the foreign2.html page was marked as FOREIGN in foreign1 cache. >+ * After the foreign2 manifest is updated we check foreign2 cache is >+ * choosed by foreign.html page. s/choosed/chosen/ here and elsewhere.
Comment on attachment 345627 [details] [diff] [review] ng 1 OK a few at once here... test_offlineMode.html looks fine... offlineTests.js looks fine... >diff --git a/dom/tests/mochitest/ajax/offline/opportunisticPropagation2.html b/dom/tests/mochitest/ajax/offline/opportunisticPropagation2.html >diff --git a/dom/tests/mochitest/ajax/offline/test_opportunisticCaching.html b/dom/tests/mochitest/ajax/offline/test_opportunisticCaching.html >diff --git a/dom/tests/mochitest/ajax/offline/test_opportunisticPropagation.html b/dom/tests/mochitest/ajax/offline/test_opportunisticPropagation.html We should completely remove the opportunistic tests. >diff --git a/dom/tests/mochitest/ajax/offline/test_updatingManifest.html b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html >new file mode 100644 >--- /dev/null >+++ b/dom/tests/mochitest/ajax/offline/test_updatingManifest.html >+ >+const NAMESPACE_BYPASS = Components.interfaces.nsIApplicationCacheNamespace.NAMESPACE_BYPASS; >+const NAMESPACE_FALLBACK = Components.interfaces.nsIApplicationCacheNamespace.NAMESPACE_FALLBACK; >+const NAMESPACE_OPPORTUNISTIC = Components.interfaces.nsIApplicationCacheNamespace.NAMESPACE_OPPORTUNISTIC; We should probably remove/rename references to opportunistic cache in this file (there are a few places). >+ >+var manifestVersion2Content = >+ "CACHE MANIFEST\n" + >+ "# v2\n" + >+ "\n" + >+ "http://localhost:8888/tests/SimpleTest/SimpleTest.js\n" + >+ "http://localhost:8888/MochiKit/packed.js\n" + >+ "http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + >+ "http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/updatingIFrame.html" + >+ "\n" + >+ "FALLBACK:\n" + >+ "namespace1/ fallback.html\n" + >+ "namespace1/sub/ fallback2.html\n"; >+ >+var manifestVersion3Content = >+ "CACHE MANIFEST\n" + >+ "# v3\n" + >+ "\n" + >+ "http://localhost:8888/MochiKit/packed.js\n" + >+ "http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/offlineTests.js\n" + >+ "http://localhost:8888/tests/dom/tests/mochitest/ajax/offline/updatingIFrame.html" + >+ "\n" + >+ "FALLBACK:\n" + >+ "namespace1/sub fallback2.html\n" + >+ "\n" + >+ "NETWORK:\n" + >+ "onwhitelist.html\n"; >+ Just out of curiosity, have you ever run into race conditions or other problems here with the manifests being cached by the http cache? I had some trouble with that, I wonder if we should add support to the PUT command in the test server for setting Cache-Control headers? >diff --git a/dom/tests/mochitest/ajax/offline/test_whitelisting.html b/dom/tests/mochitest/ajax/offline/test_whitelisting.html >new file mode 100644 >--- /dev/null >+++ b/dom/tests/mochitest/ajax/offline/test_whitelisting.html This test is fine for this implementation, and is presumably changed in the patch to have a cache-per-iframe...
OK, I think that should be everything. Mostly just nits.
Completely removed tests for opportunistic caching + few nits.
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Any ideas why a couple of the tests added here are failing with the HTML5 parser? See bug 541079.
You need to log in before you can comment on or make changes to this bug.