Bug 899571, DownloadIntegration testMode doesn't reset cached directory, r=paolo

This commit is contained in:
Neil Deakin 2013-08-02 11:42:50 -04:00
parent 243c5a081d
commit db2d018cb8
2 changed files with 15 additions and 2 deletions

View File

@ -73,7 +73,7 @@ XPCOMUtils.defineLazyGetter(this, "gStringBundle", function() {
*/
this.DownloadIntegration = {
// For testing only
testMode: false,
_testMode: false,
dontLoad: false,
dontCheckParentalControls: false,
shouldBlockInTest: false,
@ -88,6 +88,15 @@ this.DownloadIntegration = {
*/
_store: null,
/**
* Gets and sets test mode
*/
get testMode() this._testMode,
set testMode(mode) {
this._downloadsDirectory = null;
return (this._testMode = mode);
},
/**
* Performs initialization of the list of persistent downloads, before its
* first use by the host application. This function may be called only once

View File

@ -21,7 +21,7 @@ XPCOMUtils.defineLazyGetter(this, "gStringBundle", function() {
*/
add_task(function test_getSystemDownloadsDirectory()
{
// Enable test mode for the getSystemDownloadsDirectoy method to return
// Enable test mode for the getSystemDownloadsDirectory method to return
// temp directory instead so we can check whether the desired directory
// is created or not.
DownloadIntegration.testMode = true;
@ -59,7 +59,11 @@ add_task(function test_getSystemDownloadsDirectory()
do_check_true(info.isDir);
yield OS.File.removeEmptyDir(targetPath);
}
let downloadDirBefore = yield DownloadIntegration.getSystemDownloadsDirectory();
cleanup();
let downloadDirAfter = yield DownloadIntegration.getSystemDownloadsDirectory();
do_check_false(downloadDirBefore.equals(downloadDirAfter));
});
/**