From e1bc602f21cfc276108b1e17fbb44568156f9675 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 12 Dec 2014 12:57:14 -0800 Subject: [PATCH] Backed out changeset 96a5b2854978 (bug 527444) for android xpcshell bustage on a CLOSED TREE --- .../zipwriter/test/unit/head_zipwriter.js | 10 -------- .../zipwriter/test/unit/tail_zipwriter.js | 14 +++++++++++ .../libjar/zipwriter/test/unit/xpcshell.ini | 1 + .../tests/unit/head_contentPrefs.js | 4 ---- .../tests/unit/tail_contentPrefs.js | 6 +++++ .../contentprefs/tests/unit/xpcshell.ini | 1 + .../test/unit/head_download_manager.js | 10 -------- .../test/unit/tail_download_manager.js | 24 +++++++++++++++++++ .../downloads/test/unit/xpcshell.ini | 1 + .../tests/unit/head_urlclassifier.js | 4 ---- .../tests/unit/tail_urlclassifier.js | 1 + .../url-classifier/tests/unit/xpcshell.ini | 1 + toolkit/devtools/apps/tests/unit/head_apps.js | 9 +------ toolkit/devtools/apps/tests/unit/tail_apps.js | 6 +++++ toolkit/devtools/apps/tests/unit/xpcshell.ini | 1 + toolkit/identity/tests/unit/head_identity.js | 9 +------ toolkit/identity/tests/unit/tail_identity.js | 8 +++++++ toolkit/identity/tests/unit/xpcshell.ini | 1 + .../tests/unit/head_handlerService.js | 4 ---- .../tests/unit/tail_handlerService.js | 5 ++++ uriloader/exthandler/tests/unit/xpcshell.ini | 1 + 21 files changed, 73 insertions(+), 48 deletions(-) create mode 100644 modules/libjar/zipwriter/test/unit/tail_zipwriter.js create mode 100644 toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js create mode 100644 toolkit/components/downloads/test/unit/tail_download_manager.js create mode 100644 toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js create mode 100644 toolkit/devtools/apps/tests/unit/tail_apps.js create mode 100644 toolkit/identity/tests/unit/tail_identity.js create mode 100644 uriloader/exthandler/tests/unit/tail_handlerService.js diff --git a/modules/libjar/zipwriter/test/unit/head_zipwriter.js b/modules/libjar/zipwriter/test/unit/head_zipwriter.js index fbc5b4d7717..f7b8c7e8368 100644 --- a/modules/libjar/zipwriter/test/unit/head_zipwriter.js +++ b/modules/libjar/zipwriter/test/unit/head_zipwriter.js @@ -44,13 +44,3 @@ 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); -}); diff --git a/modules/libjar/zipwriter/test/unit/tail_zipwriter.js b/modules/libjar/zipwriter/test/unit/tail_zipwriter.js new file mode 100644 index 00000000000..033cc23c296 --- /dev/null +++ b/modules/libjar/zipwriter/test/unit/tail_zipwriter.js @@ -0,0 +1,14 @@ +/* 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); diff --git a/modules/libjar/zipwriter/test/unit/xpcshell.ini b/modules/libjar/zipwriter/test/unit/xpcshell.ini index e2d84b949c7..353e4ccaba1 100644 --- a/modules/libjar/zipwriter/test/unit/xpcshell.ini +++ b/modules/libjar/zipwriter/test/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_zipwriter.js +tail = tail_zipwriter.js skip-if = toolkit == 'gonk' support-files = data/test_bug446708/thumbs/st14-1.tiff diff --git a/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js b/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js index b8b8aa62b2b..4e4c5df8c01 100644 --- a/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js +++ b/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js @@ -164,7 +164,3 @@ if (!inChildProcess()) { prefBranch.setBoolPref("browser.preferences.content.log", true); } -do_register_cleanup(function tail_contentPrefs() { - ContentPrefTest.deleteDatabase(); - ContentPrefTest.__dirSvc = null; -}); diff --git a/toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js b/toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js new file mode 100644 index 00000000000..f3c95dac893 --- /dev/null +++ b/toolkit/components/contentprefs/tests/unit/tail_contentPrefs.js @@ -0,0 +1,6 @@ +/* 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; diff --git a/toolkit/components/contentprefs/tests/unit/xpcshell.ini b/toolkit/components/contentprefs/tests/unit/xpcshell.ini index 6bb2374d543..a183ea3cf69 100644 --- a/toolkit/components/contentprefs/tests/unit/xpcshell.ini +++ b/toolkit/components/contentprefs/tests/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_contentPrefs.js +tail = tail_contentPrefs.js skip-if = toolkit == 'gonk' [test_bug248970.js] diff --git a/toolkit/components/downloads/test/unit/head_download_manager.js b/toolkit/components/downloads/test/unit/head_download_manager.js index d524550ae6c..b8610897cee 100644 --- a/toolkit/components/downloads/test/unit/head_download_manager.js +++ b/toolkit/components/downloads/test/unit/head_download_manager.js @@ -231,13 +231,3 @@ 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; - }); -}); diff --git a/toolkit/components/downloads/test/unit/tail_download_manager.js b/toolkit/components/downloads/test/unit/tail_download_manager.js new file mode 100644 index 00000000000..721d0784c5b --- /dev/null +++ b/toolkit/components/downloads/test/unit/tail_download_manager.js @@ -0,0 +1,24 @@ +/* -*- 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; +}); + diff --git a/toolkit/components/downloads/test/unit/xpcshell.ini b/toolkit/components/downloads/test/unit/xpcshell.ini index 0c798476757..02c3432a690 100644 --- a/toolkit/components/downloads/test/unit/xpcshell.ini +++ b/toolkit/components/downloads/test/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_download_manager.js +tail = tail_download_manager.js firefox-appdir = browser skip-if = toolkit == 'android' || toolkit == 'gonk' support-files = diff --git a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js index 329178e93b5..69c249640be 100644 --- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js +++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js @@ -367,7 +367,3 @@ LFSRgenerator.prototype = { }; cleanUp(); - -do_register_cleanup(function tail_ulrclassifier() { - cleanUp(); -}); diff --git a/toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js b/toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js new file mode 100644 index 00000000000..37f39d1a8db --- /dev/null +++ b/toolkit/components/url-classifier/tests/unit/tail_urlclassifier.js @@ -0,0 +1 @@ +cleanUp(); diff --git a/toolkit/components/url-classifier/tests/unit/xpcshell.ini b/toolkit/components/url-classifier/tests/unit/xpcshell.ini index 7973334aaab..1c923b277a4 100644 --- a/toolkit/components/url-classifier/tests/unit/xpcshell.ini +++ b/toolkit/components/url-classifier/tests/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_urlclassifier.js +tail = tail_urlclassifier.js skip-if = toolkit == 'android' || toolkit == 'gonk' support-files = data/digest1.chunk diff --git a/toolkit/devtools/apps/tests/unit/head_apps.js b/toolkit/devtools/apps/tests/unit/head_apps.js index 27c8854d82b..b726224b15c 100644 --- a/toolkit/devtools/apps/tests/unit/head_apps.js +++ b/toolkit/devtools/apps/tests/unit/head_apps.js @@ -129,11 +129,4 @@ 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(); - }); - } -}); + diff --git a/toolkit/devtools/apps/tests/unit/tail_apps.js b/toolkit/devtools/apps/tests/unit/tail_apps.js new file mode 100644 index 00000000000..0a5fb4b50d9 --- /dev/null +++ b/toolkit/devtools/apps/tests/unit/tail_apps.js @@ -0,0 +1,6 @@ +if (gClient) { + // Close the test remote connection before leaving this test + gClient.close(function () { + run_next_test(); + }); +} diff --git a/toolkit/devtools/apps/tests/unit/xpcshell.ini b/toolkit/devtools/apps/tests/unit/xpcshell.ini index cc05266ec13..1cc8ee198ef 100644 --- a/toolkit/devtools/apps/tests/unit/xpcshell.ini +++ b/toolkit/devtools/apps/tests/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_apps.js +tail = tail_apps.js skip-if = toolkit == 'android' support-files = data/app.zip diff --git a/toolkit/identity/tests/unit/head_identity.js b/toolkit/identity/tests/unit/head_identity.js index 69cac8047f3..0244de5af6b 100644 --- a/toolkit/identity/tests/unit/head_identity.js +++ b/toolkit/identity/tests/unit/head_identity.js @@ -253,11 +253,4 @@ 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(); - } -}); + diff --git a/toolkit/identity/tests/unit/tail_identity.js b/toolkit/identity/tests/unit/tail_identity.js new file mode 100644 index 00000000000..c263f8369da --- /dev/null +++ b/toolkit/identity/tests/unit/tail_identity.js @@ -0,0 +1,8 @@ + +// pre-emptively shut down to clear resources +if (typeof IdentityService !== "undefined") { + IdentityService.shutdown(); +} else if (typeof IDService !== "undefined") { + IDService.shutdown(); +} + diff --git a/toolkit/identity/tests/unit/xpcshell.ini b/toolkit/identity/tests/unit/xpcshell.ini index 4f385a20b7e..0355d765a07 100644 --- a/toolkit/identity/tests/unit/xpcshell.ini +++ b/toolkit/identity/tests/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_identity.js +tail = tail_identity.js skip-if = toolkit == 'gonk' support-files = data/idp_1/.well-known/browserid diff --git a/uriloader/exthandler/tests/unit/head_handlerService.js b/uriloader/exthandler/tests/unit/head_handlerService.js index a0a5d5bd0b7..34630d0470f 100644 --- a/uriloader/exthandler/tests/unit/head_handlerService.js +++ b/uriloader/exthandler/tests/unit/head_handlerService.js @@ -161,7 +161,3 @@ var HandlerServiceTest = { }; HandlerServiceTest.init(); - -do_register_cleanup(function tail_handleService() { - HandlerServiceTest.destroy(); -}); diff --git a/uriloader/exthandler/tests/unit/tail_handlerService.js b/uriloader/exthandler/tests/unit/tail_handlerService.js new file mode 100644 index 00000000000..1d1989127ec --- /dev/null +++ b/uriloader/exthandler/tests/unit/tail_handlerService.js @@ -0,0 +1,5 @@ +/* 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(); diff --git a/uriloader/exthandler/tests/unit/xpcshell.ini b/uriloader/exthandler/tests/unit/xpcshell.ini index aeb57aa721a..1874c2f7b97 100644 --- a/uriloader/exthandler/tests/unit/xpcshell.ini +++ b/uriloader/exthandler/tests/unit/xpcshell.ini @@ -1,5 +1,6 @@ [DEFAULT] head = head_handlerService.js +tail = tail_handlerService.js skip-if = toolkit == 'gonk' run-sequentially = Bug 912235 - Intermittent failures