Bug 1221758 - don't run cache2 tests when cache2 isn't used. r=michal.novotny
☠☠ backed out by fc9023a0d761 ☠ ☠
authorMagnus Melin <mkmelin+mozilla@iki.fi>
Fri, 13 Nov 2015 08:12:30 +0200
changeset 308680 80a79987da8b7d11e63c40c1cdd7da63297d0782
parent 308679 09dc1434c390cf5843e7c30f95e8b1abe20b9fb2
child 308681 88025b4a432b703e3dc1b3c6874d2d0b5c435b6a
push id7513
push useratolfsen@mozilla.com
push dateFri, 13 Nov 2015 14:03:43 +0000
reviewersmichal.novotny
bugs1221758
milestone45.0a1
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.
netwerk/test/unit/test_cache2-30a-entry-pinning.js
netwerk/test/unit/test_cache2-30b-pinning-storage-clear.js
netwerk/test/unit/test_cache2-30c-pinning-deferred-doom.js
netwerk/test/unit/test_cache2-30d-pinning-WasEvicted-API.js
netwerk/test/unit/test_cache_jar.js
--- 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();
 }