Bug 1221758 - don't run cache2 tests when cache2 isn't used. r=michal.novotny
Was causing test failures for Thunderbird where cache2 isn't in use yet.
--- a/netwerk/test/unit/test_cache2-30a-entry-pinning.js
+++ b/netwerk/test/unit/test_cache2-30a-entry-pinning.js
@@ -1,11 +1,15 @@
function run_test()
{
do_get_profile();
+ if (!newCacheBackEndUsed()) {
+ do_check_true(true, "This test checks only cache2 specific behavior.");
+ return;
+ }
// Open for write, write
asyncOpenCacheEntry("http://a/", "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, LoadContextInfo.default,
new OpenCallback(NEW|WAITFORWRITE, "a1m", "a1d", function(entry) {
// Open for read and check
asyncOpenCacheEntry("http://a/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, LoadContextInfo.default,
new OpenCallback(NORMAL, "a1m", "a1d", function(entry) {
--- a/netwerk/test/unit/test_cache2-30b-pinning-storage-clear.js
+++ b/netwerk/test/unit/test_cache2-30b-pinning-storage-clear.js
@@ -1,11 +1,15 @@
function run_test()
{
do_get_profile();
+ if (!newCacheBackEndUsed()) {
+ do_check_true(true, "This test checks only cache2 specific behavior.");
+ return;
+ }
var lci = LoadContextInfo.default;
// Open a pinned entry for write, write
asyncOpenCacheEntry("http://a/", "pin", Ci.nsICacheStorage.OPEN_TRUNCATE, lci,
new OpenCallback(NEW|WAITFORWRITE, "a1m", "a1d", function(entry) {
// Now clear the disk storage, that should leave the pinned entry in the cache
var diskStorage = getCacheStorage("disk", lci);
--- a/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js
+++ b/netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js
@@ -21,16 +21,21 @@ This is a complex test checking the inte
const kENTRYCOUNT = 10;
function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
function run_test()
{
do_get_profile();
+ if (!newCacheBackEndUsed()) {
+ do_check_true(true, "This test checks only cache2 specific behavior.");
+ return;
+ }
+
var lci = LoadContextInfo.default;
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);
do_check_true(testingInterface);
var mc = new MultipleCallbacks(1, function() {
// (2)
mc = new MultipleCallbacks(1, finish_cache2_test);
--- a/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js
+++ b/netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js
@@ -17,16 +17,20 @@ This test exercises the CacheFileContext
const kENTRYCOUNT = 10;
function log_(msg) { if (true) dump(">>>>>>>>>>>>> " + msg + "\n"); }
function run_test()
{
do_get_profile();
+ if (!newCacheBackEndUsed()) {
+ do_check_true(true, "This test checks only cache2 specific behavior.");
+ return;
+ }
var lci = LoadContextInfo.default;
var testingInterface = get_cache_service().QueryInterface(Ci.nsICacheTesting);
do_check_true(testingInterface);
var mc = new MultipleCallbacks(1, function() {
// (2)
mc = new MultipleCallbacks(1, finish_cache2_test);
--- a/netwerk/test/unit/test_cache_jar.js
+++ b/netwerk/test/unit/test_cache_jar.js
@@ -84,16 +84,20 @@ function run_all_tests() {
chan.asyncOpen(new ChannelListener(doneFirstLoad, test[2]), null);
yield undefined;
}
}
var gTests;
function run_test() {
do_get_profile();
+ if (!newCacheBackEndUsed()) {
+ do_check_true(true, "This test checks only cache2 specific behavior.");
+ return;
+ }
do_test_pending();
httpserv = new HttpServer();
httpserv.registerPathHandler("/cached", cached_handler);
httpserv.start(-1);
gTests = run_all_tests();
gTests.next();
}