Bug 527444 - Use "do_register_cleanup(...)" calls instead of "tail_*.js" files in xpcshell, Core, and Toolkit. f=sgautherie, r=jdm

This commit is contained in:
Akshendra Pratap 2014-12-12 07:23:00 -05:00
parent 1030aade65
commit bd110a6e2b
21 changed files with 48 additions and 73 deletions

View File

@ -44,3 +44,13 @@ if (tmpFile.exists())
tmpFile.remove(true);
var zipW = new ZipWriter();
do_register_cleanup(function tail_zipwriter() {
try {
zipW.close();
} catch (e) {
// Just ignore a failure here and attempt to delete the file anyway.
}
if (tmpFile.exists())
tmpFile.remove(true);
});

View File

@ -1,14 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*/
try {
zipW.close();
}
catch (e) {
// Just ignore a failure here and attempt to delete the file anyway.
}
if (tmpFile.exists())
tmpFile.remove(true);

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_zipwriter.js
tail = tail_zipwriter.js
skip-if = toolkit == 'gonk'
support-files =
data/test_bug446708/thumbs/st14-1.tiff

View File

@ -164,3 +164,7 @@ if (!inChildProcess()) {
prefBranch.setBoolPref("browser.preferences.content.log", true);
}
do_register_cleanup(function tail_contentPrefs() {
ContentPrefTest.deleteDatabase();
ContentPrefTest.__dirSvc = null;
});

View File

@ -1,6 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
ContentPrefTest.deleteDatabase();
ContentPrefTest.__dirSvc = null;

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_contentPrefs.js
tail = tail_contentPrefs.js
skip-if = toolkit == 'gonk'
[test_bug248970.js]

View File

@ -231,3 +231,13 @@ function oldDownloadManagerDisabled() {
}
return false;
}
do_register_cleanup(function tail_download_manager() {
add_task(function test_common_terminate() {
// Stop the HTTP server. We must do this inside a task in "tail.js" until the
// xpcshell testing framework supports asynchronous termination functions.
let deferred = Promise.defer();
gHttpServer.stop(deferred.resolve);
yield deferred.promise;
});
});

View File

@ -1,24 +0,0 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
/**
* Provides infrastructure for automated download components tests.
*/
"use strict";
////////////////////////////////////////////////////////////////////////////////
//// Termination functions common to all tests
add_task(function test_common_terminate()
{
// Stop the HTTP server. We must do this inside a task in "tail.js" until the
// xpcshell testing framework supports asynchronous termination functions.
let deferred = Promise.defer();
gHttpServer.stop(deferred.resolve);
yield deferred.promise;
});

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_download_manager.js
tail = tail_download_manager.js
firefox-appdir = browser
skip-if = toolkit == 'android' || toolkit == 'gonk'
support-files =

View File

@ -367,3 +367,7 @@ LFSRgenerator.prototype = {
};
cleanUp();
do_register_cleanup(function tail_ulrclassifier() {
cleanUp();
});

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_urlclassifier.js
tail = tail_urlclassifier.js
skip-if = toolkit == 'android' || toolkit == 'gonk'
support-files =
data/digest1.chunk

View File

@ -129,4 +129,11 @@ function do_get_webappsdir() {
Services.dirsvc.QueryInterface(Ci.nsIDirectoryService).registerProvider(provider);
}
do_register_cleanup(function tail_apps() {
if (gClient) {
// Close the test remote connection before leaving this test.
gClient.close(function tail_apps_close() {
run_next_test();
});
}
});

View File

@ -1,6 +0,0 @@
if (gClient) {
// Close the test remote connection before leaving this test
gClient.close(function () {
run_next_test();
});
}

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_apps.js
tail = tail_apps.js
skip-if = toolkit == 'android'
support-files =
data/app.zip

View File

@ -253,4 +253,11 @@ do_register_cleanup(function() {
Services.prefs.setBoolPref("identity.fxaccounts.enabled", initialPrefFXAValue);
});
do_register_cleanup(function tail_identity() {
// Pre-emptively shut down to clear resources.
if (typeof IdentityService !== "undefined") {
IdentityService.shutdown();
} else if (typeof IDService !== "undefined") {
IDService.shutdown();
}
});

View File

@ -1,8 +0,0 @@
// pre-emptively shut down to clear resources
if (typeof IdentityService !== "undefined") {
IdentityService.shutdown();
} else if (typeof IDService !== "undefined") {
IDService.shutdown();
}

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_identity.js
tail = tail_identity.js
skip-if = toolkit == 'gonk'
support-files =
data/idp_1/.well-known/browserid

View File

@ -161,3 +161,7 @@ var HandlerServiceTest = {
};
HandlerServiceTest.init();
do_register_cleanup(function tail_handleService() {
HandlerServiceTest.destroy();
});

View File

@ -1,5 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/. */
HandlerServiceTest.destroy();

View File

@ -1,6 +1,5 @@
[DEFAULT]
head = head_handlerService.js
tail = tail_handlerService.js
skip-if = toolkit == 'gonk'
run-sequentially = Bug 912235 - Intermittent failures