Bug 790181: Skip private browsing test for gecko applications that don't support private browsing. r=ehsan, a=lsblakk
authorMark Banner <bugzilla@standard8.plus.com>
Thu, 13 Sep 2012 11:41:09 -0400
changeset 106844 7bc4205a51c4ec1b06beb7ba5943cff30fa03a17
parent 106843 6fb8111f50cb42828370431fe3d1929865ecaef4
child 106845 d648d93f9d76e8567a0c1e3025637ff245cec3bd
push id2082
push userireid@mozilla.com
push dateThu, 13 Sep 2012 15:42:40 +0000
treeherdermozilla-aurora@7bc4205a51c4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, lsblakk
bugs790181
milestone17.0a2
Bug 790181: Skip private browsing test for gecko applications that don't support private browsing. r=ehsan, a=lsblakk
netwerk/test/unit/test_bug248970_cache.js
--- a/netwerk/test/unit/test_bug248970_cache.js
+++ b/netwerk/test/unit/test_bug248970_cache.js
@@ -224,37 +224,40 @@ function run_test2() {
   check_devices_available([kMemoryDevice, kDiskDevice, kOfflineDevice]);
 
   // Check if cache-A, cache-A2, cache-B and cache-C are available
   check_entries(run_test3, false);
 }
 
 function run_test3() {
   var pb = get_privatebrowsing_service();
-  if (pb) { // Private Browsing might not be available
-    var prefBranch = Cc["@mozilla.org/preferences-service;1"].
-                     getService(Ci.nsIPrefBranch);
-    prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
+  if (!pb) { // Private Browsing might not be available
+    do_test_finished();
+    return;
+  }
 
-    // Enter private browsing mode
-    pb.privateBrowsingEnabled = true;
+  var prefBranch = Cc["@mozilla.org/preferences-service;1"].
+                   getService(Ci.nsIPrefBranch);
+  prefBranch.setBoolPref("browser.privatebrowsing.keep_current_session", true);
 
-    // Make sure only the memory device is available
-    check_devices_available([kMemoryDevice]);
+  // Enter private browsing mode
+  pb.privateBrowsingEnabled = true;
 
-    // Make sure the memory device is empty
-    do_check_eq(get_device_entry_count(kMemoryDevice), 0);
+  // Make sure only the memory device is available
+  check_devices_available([kMemoryDevice]);
 
-    // Exit private browsing mode
-    pb.privateBrowsingEnabled = false;
+  // Make sure the memory device is empty
+  do_check_eq(get_device_entry_count(kMemoryDevice), 0);
 
-    // Make sure all three cache devices are available after leaving the private mode
-    check_devices_available([kMemoryDevice, kDiskDevice, kOfflineDevice]);
+  // Exit private browsing mode
+  pb.privateBrowsingEnabled = false;
+
+  // Make sure all three cache devices are available after leaving the private mode
+  check_devices_available([kMemoryDevice, kDiskDevice, kOfflineDevice]);
 
-    // Make sure the memory device is empty
-    do_check_eq(get_device_entry_count(kMemoryDevice), 0);
+  // Make sure the memory device is empty
+  do_check_eq(get_device_entry_count(kMemoryDevice), 0);
 
-    // Check if cache-A is gone, and cache-B and cache-C are still available
-    check_entries(do_test_finished, true);
+  // Check if cache-A is gone, and cache-B and cache-C are still available
+  check_entries(do_test_finished, true);
     
-    prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
-  }
+  prefBranch.clearUserPref("browser.privatebrowsing.keep_current_session");
 }