toolkit/forgetaboutsite/test/unit/head_forgetaboutsite.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/forgetaboutsite/test/unit/head_forgetaboutsite.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,43 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +const Cc = Components.classes;
     1.9 +const Ci = Components.interfaces;
    1.10 +const Cu = Components.utils;
    1.11 +
    1.12 +var dirSvc = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties);
    1.13 +var profileDir = do_get_profile();
    1.14 +
    1.15 +/**
    1.16 + * Removes any files that could make our tests fail.
    1.17 + */
    1.18 +function cleanUp()
    1.19 +{
    1.20 +  let files = [
    1.21 +    "downloads.sqlite",
    1.22 +    "places.sqlite",
    1.23 +    "cookies.sqlite",
    1.24 +    "signons.sqlite",
    1.25 +    "permissions.sqlite"
    1.26 +  ];
    1.27 +
    1.28 +  for (let i = 0; i < files.length; i++) {
    1.29 +    let file = dirSvc.get("ProfD", Ci.nsIFile);
    1.30 +    file.append(files[i]);
    1.31 +    if (file.exists())
    1.32 +      file.remove(false);
    1.33 +  }
    1.34 +}
    1.35 +cleanUp();
    1.36 +
    1.37 +function oldDownloadManagerDisabled()
    1.38 +{
    1.39 +  try {
    1.40 +    // This method throws an exception if the old Download Manager is disabled.
    1.41 +    Services.downloads.activeDownloadCount;
    1.42 +  } catch (ex) {
    1.43 +    return true;
    1.44 +  }
    1.45 +  return false;
    1.46 +}

mercurial