Bug 722995 - Part 5: Make the tests compatible to the code changes, r=ehsan

This commit is contained in:
Saurabh Anand 2012-07-21 11:24:41 +05:30
parent c04ff46abb
commit 2351cc3afd
4 changed files with 12 additions and 8 deletions

View File

@ -3,10 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Cu.import("resource://gre/modules/DownloadLastDir.jsm");
let downloadModule = {};
Cu.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule);
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
let gDownloadLastDir = new downloadModule.DownloadLastDir(window);
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
@ -216,6 +218,5 @@ function test() {
Services.prefs.clearUserPref("browser.download.lastDir");
gDownloadLastDir.cleanupPrivateFile();
delete FileUtils;
delete gDownloadLastDir;
}
}

View File

@ -3,9 +3,10 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
let downloadModule = {};
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/DownloadLastDir.jsm");
Cu.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule);
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://mochikit/MockFilePicker.jsm");
@ -14,6 +15,7 @@ let launcher = {
};
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let gDownloadLastDir = new downloadModule.DownloadLastDir(window);
MockFilePicker.init();
MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
@ -52,7 +54,6 @@ function test() {
MockFilePicker.cleanup();
gDownloadLastDir.cleanupPrivateFile();
delete FileUtils;
delete gDownloadLastDir;
});
let context = gBrowser.selectedBrowser.contentWindow;

View File

@ -3,13 +3,15 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Cu.import("resource://gre/modules/DownloadLastDir.jsm");
let downloadModule = {};
Cu.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule);
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://mochikit/MockFilePicker.jsm");
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
let gDownloadLastDir = new downloadModule.DownloadLastDir(window);
MockFilePicker.init();
MockFilePicker.returnValue = Ci.nsIFilePicker.returnOK;
@ -52,7 +54,6 @@ function test() {
validateFileName = validateFileNameToRestore;
gDownloadLastDir.cleanupPrivateFile();
delete FileUtils;
delete gDownloadLastDir;
});
// Overwrite stringBundle to return an object masquerading as a string bundle

View File

@ -3,10 +3,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Cu.import("resource://gre/modules/DownloadLastDir.jsm");
let downloadModule = {};
Cu.import("resource://gre/modules/DownloadLastDir.jsm", downloadModule);
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
let gDownloadLastDir = new downloadModule.DownloadLastDir(window);
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
@ -27,7 +29,6 @@ function test() {
newDir.remove(true);
gDownloadLastDir.cleanupPrivateFile();
delete FileUtils;
delete gDownloadLastDir;
});
newDir.append("testdir");