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
Родитель 57f881022c
Коммит d58a9abd2e
2 изменённых файлов: 15 добавлений и 2 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -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));
});
/**