diff --git a/testing/marionette/client/marionette/tests/update-tests.ini b/testing/marionette/client/marionette/tests/update-tests.ini index 0c162caaa3ba..5056cf721003 100644 --- a/testing/marionette/client/marionette/tests/update-tests.ini +++ b/testing/marionette/client/marionette/tests/update-tests.ini @@ -15,4 +15,4 @@ skip = false smoketest = false ; AUS tests -[include:../../../../../toolkit/mozapps/update/test/marionette/update-tests.ini] +[include:../../../../../toolkit/mozapps/update/tests/marionette/update-tests.ini] diff --git a/testing/xpcshell/xpcshell_b2g.ini b/testing/xpcshell/xpcshell_b2g.ini index 45f06aaa8ba4..f9e0c2eb7da2 100644 --- a/testing/xpcshell/xpcshell_b2g.ini +++ b/testing/xpcshell/xpcshell_b2g.ini @@ -9,9 +9,8 @@ [include:toolkit/devtools/debugger/tests/unit/xpcshell.ini] [include:toolkit/devtools/sourcemap/tests/unit/xpcshell.ini] [include:toolkit/mozapps/downloads/tests/unit/xpcshell.ini] -[include:toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini] -[include:toolkit/mozapps/update/test_svc/unit/xpcshell.ini] -[include:toolkit/mozapps/update/test/unit/xpcshell.ini] -[include:toolkit/mozapps/shared/test/unit/xpcshell.ini] +[include:toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini] +[include:toolkit/mozapps/update/test/unit_base_updater/xpcshell.ini] +[include:toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini] [include:ipc/testshell/tests/xpcshell.ini] [include:b2g/components/test/unit/xpcshell.ini] diff --git a/toolkit/mozapps/update/moz.build b/toolkit/mozapps/update/moz.build index d0242c4c3295..1f3c99c7dff0 100644 --- a/toolkit/mozapps/update/moz.build +++ b/toolkit/mozapps/update/moz.build @@ -14,36 +14,30 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': # which the maintenance service uses. DIRS += ['common'] -TEST_DIRS += ['test_timermanager'] +MODULE = 'update' + +XPCSHELL_TESTS_MANIFESTS += ['tests/unit_timermanager/xpcshell.ini'] XPIDL_SOURCES += [ 'nsIUpdateTimerManager.idl', ] -# Update tests require the updater binary -if CONFIG['MOZ_UPDATER']: - TEST_DIRS += ['test'] - - if CONFIG['MOZ_MAINTENANCE_SERVICE']: - TEST_DIRS += ['test_svc'] - - XPIDL_SOURCES += [ - 'nsIUpdateService.idl', - ] - -MODULE = 'update' - EXTRA_COMPONENTS += [ 'nsUpdateTimerManager.js', 'nsUpdateTimerManager.manifest', ] if CONFIG['MOZ_UPDATER']: + TEST_DIRS += ['tests'] + + XPIDL_SOURCES += [ + 'nsIUpdateService.idl', + ] + EXTRA_COMPONENTS += [ 'nsUpdateService.manifest', ] -if CONFIG['MOZ_UPDATER']: EXTRA_PP_COMPONENTS += [ 'nsUpdateService.js', 'nsUpdateServiceStub.js', diff --git a/toolkit/mozapps/update/test/Makefile.in b/toolkit/mozapps/update/test/Makefile.in deleted file mode 100644 index 3734b5cca4b6..000000000000 --- a/toolkit/mozapps/update/test/Makefile.in +++ /dev/null @@ -1,73 +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/. - -TESTROOT = $(abspath $(DEPTH))/_tests/xpcshell/$(relativesrcdir) - -DEFINES += \ - -DAB_CD=$(AB_CD) \ - -DMOZ_APP_NAME=$(MOZ_APP_NAME) \ - -DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \ - -DBIN_SUFFIX=$(BIN_SUFFIX) \ - -DNS_NO_XPCOM \ - -DMOZ_DEBUG=$(MOZ_DEBUG) \ - $(NULL) - -ifdef MOZ_MAINTENANCE_SERVICE -DEFINES += -DMOZ_MAINTENANCE_SERVICE=$(MOZ_MAINTENANCE_SERVICE) -endif - -ifneq (android,$(MOZ_WIDGET_TOOLKIT)) -INI_TEST_FILES = \ - TestAUSReadStrings1.ini \ - TestAUSReadStrings2.ini \ - TestAUSReadStrings3.ini \ - $(NULL) - -LOCAL_INCLUDES += \ - -I$(srcdir) \ - -I$(topsrcdir)/toolkit/mozapps/update \ - -I$(topsrcdir)/toolkit/mozapps/update/common \ - $(NULL) - -MOZ_WINCONSOLE = 1 - -LIBS += \ - ../common/$(LIB_PREFIX)updatecommon.$(LIB_SUFFIX) \ - $(NULL) - -ifeq ($(OS_ARCH),WINNT) -USE_STATIC_LIBS = 1 -DEFINES += -DUNICODE -D_UNICODE -endif -endif # Not Android - -include $(topsrcdir)/config/rules.mk - -ifneq (android,$(MOZ_WIDGET_TOOLKIT)) -# TestAUSReadStrings runs during check in the following directory with a Unicode -# char in order to test bug 473417 on Windows. -ifeq ($(OS_ARCH),WINNT) -bug473417dir = test_bug473417-ó -else -bug473417dir = test_bug473417 -endif - -check:: - $(RM) -rf $(DEPTH)/_tests/updater/ && $(NSINSTALL) -D $(DEPTH)/_tests/updater/$(bug473417dir)/ - for i in $(INI_TEST_FILES); do \ - $(INSTALL) $(srcdir)/$$i $(DEPTH)/_tests/updater/$(bug473417dir)/; \ - done - $(INSTALL) $(FINAL_TARGET)/TestAUSReadStrings$(BIN_SUFFIX) $(DEPTH)/_tests/updater/$(bug473417dir)/ - @$(RUN_TEST_PROGRAM) $(DEPTH)/_tests/updater/$(bug473417dir)/TestAUSReadStrings$(BIN_SUFFIX) -endif # Not Android - -libs:: unit/head_update.js.in - $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $^ > $(TESTROOT)/unit/head_update.js - -ifneq (android,$(MOZ_WIDGET_TOOLKIT)) -ifndef MOZ_PROFILE_GENERATE -libs:: - $(INSTALL) TestAUSHelper$(BIN_SUFFIX) $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit -endif -endif diff --git a/toolkit/mozapps/update/test/chrome/Makefile.in b/toolkit/mozapps/update/test/chrome/Makefile.in deleted file mode 100644 index db5856a61e92..000000000000 --- a/toolkit/mozapps/update/test/chrome/Makefile.in +++ /dev/null @@ -1,16 +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/. - -MOCHITEST_CHROME_FILES := \ - ../unit/data/simple.mar \ - ../unit/data/simple_no_pib.mar \ - $(NULL) - -include $(topsrcdir)/config/rules.mk - -libs:: - $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(srcdir)/utils.js > \ - $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)/utils.js - $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $(srcdir)/update.sjs > \ - $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)/update.sjs diff --git a/toolkit/mozapps/update/test/chrome/moz.build b/toolkit/mozapps/update/test/chrome/moz.build deleted file mode 100644 index 87c88dfddbc5..000000000000 --- a/toolkit/mozapps/update/test/chrome/moz.build +++ /dev/null @@ -1,8 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -MOCHITEST_CHROME_MANIFESTS += ['chrome.ini'] - diff --git a/toolkit/mozapps/update/test/unit/xpcshell.ini b/toolkit/mozapps/update/test/unit/xpcshell.ini deleted file mode 100644 index 68ab970f3a9b..000000000000 --- a/toolkit/mozapps/update/test/unit/xpcshell.ini +++ /dev/null @@ -1,40 +0,0 @@ -[DEFAULT] -head = head_update.js -tail = -generated-files = head_update.js -support-files = - data/** - xpcshell_updater.ini - -[test_0010_general.js] -[test_0020_general.js] -[test_0030_general.js] -[test_0040_general.js] -[test_0050_general.js] -[test_0060_manager.js] -[test_0061_manager.js] -[test_0062_manager.js] -[test_0063_manager.js] -[test_0064_manager.js] -[test_0070_update_dir_cleanup.js] -[test_0071_update_dir_cleanup.js] -[test_0072_update_dir_cleanup.js] -[test_0073_update_dir_cleanup.js] -[test_0080_prompt_silent.js] -[test_0081_prompt_uiAlreadyOpen.js] -skip-if = toolkit == 'gonk' -reason = custom nsIUpdatePrompt -[test_0082_prompt_unsupportAlreadyNotified.js] -skip-if = toolkit == 'gonk' -reason = custom nsIUpdatePrompt - -; Tests that require the updater binary. Conditions for the included ini file -; aren't used due to cascading of the conditions (see bug 676876). -[include:xpcshell_updater.ini] - -[test_bug595059.js] -skip-if = toolkit == 'gonk' -reason = custom nsIUpdatePrompt -[test_bug794211.js] -[test_bug833708.js] -run-if = toolkit == 'gonk' diff --git a/toolkit/mozapps/update/test/unit/xpcshell_updater.ini b/toolkit/mozapps/update/test/unit/xpcshell_updater.ini deleted file mode 100644 index b528a575c1d6..000000000000 --- a/toolkit/mozapps/update/test/unit/xpcshell_updater.ini +++ /dev/null @@ -1,89 +0,0 @@ -; Tests that require the updater binary. These tests should never run on android. - -[test_0110_general.js] -skip-if = os == 'android' -[test_0111_general.js] -skip-if = os == 'android' -[test_0112_general.js] -skip-if = os == 'android' -[test_0113_general.js] -skip-if = os == 'mac' || toolkit == 'gonk' || os == 'android' -reason = bug 820380 -[test_0113_versionDowngradeCheck.js] -run-sequentially = Need to investigate. -run-if = os == 'win' -[test_0114_general.js] -skip-if = os == 'mac' || os == 'android' -[test_0114_productChannelCheck.js] -run-if = os == 'win' -[test_0115_general.js] -skip-if = os == 'android' -[test_0150_appBinReplaced_xp_win_complete.js] -run-if = os == 'win' -[test_0151_appBinPatched_xp_win_partial.js] -run-if = os == 'win' -[test_0152_appBinReplaced_xp_win_complete.js] -run-if = os == 'win' -[test_0153_appBinPatched_xp_win_partial.js] -run-if = os == 'win' -[test_0160_appInUse_complete.js] -run-if = os == 'linux' || os == 'mac' || os == 'sunos' || os == 'win' -[test_0161_appInUse_xp_unix_complete.js] -run-if = os == 'linux' || os == 'sunos' -[test_0161_appInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0162_appInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0170_fileLocked_xp_win_complete.js] -run-if = os == 'win' -[test_0171_fileLocked_xp_win_partial.js] -run-if = os == 'win' -[test_0172_fileLocked_xp_win_complete.js] -run-if = os == 'win' -[test_0173_fileLocked_xp_win_partial.js] -run-if = os == 'win' -[test_0174_fileLocked_xp_win_complete.js] -run-if = os == 'win' -[test_0175_fileLocked_xp_win_partial.js] -run-if = os == 'win' -[test_0180_fileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0181_fileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0182_rmrfdirFileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0183_rmrfdirFileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0184_fileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0185_fileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0186_rmrfdirFileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0187_rmrfdirFileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0188_fileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0189_fileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0190_rmrfdirFileInUse_xp_win_complete.js] -run-if = os == 'win' -[test_0191_rmrfdirFileInUse_xp_win_partial.js] -run-if = os == 'win' -[test_0200_app_launch_apply_update.js] -run-sequentially = Launches application. -skip-if = toolkit == 'gonk' || os == 'android' -reason = bug 820380 -[test_0201_app_launch_apply_update.js] -run-sequentially = Launches application. -skip-if = toolkit == 'gonk' || os == 'android' -reason = bug 820380 -[test_0202_app_launch_apply_update_dirlocked.js] -run-sequentially = Launches application. -run-if = os == 'win' -[test_0203_app_launch_apply_update.js] -run-sequentially = Launches application. -run-if = os == 'win' -[test_0300_update_root_dir_migration.js] -run-sequentially = Launches application. -run-if = os == 'win' diff --git a/toolkit/mozapps/update/test_svc/Makefile.in b/toolkit/mozapps/update/test_svc/Makefile.in deleted file mode 100644 index e40bd71c1250..000000000000 --- a/toolkit/mozapps/update/test_svc/Makefile.in +++ /dev/null @@ -1,31 +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/. - -TESTROOT = $(abspath $(DEPTH))/_tests/xpcshell/$(relativesrcdir) - -DEFINES += \ - -DAB_CD=$(AB_CD) \ - -DMOZ_APP_NAME=$(MOZ_APP_NAME) \ - -DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \ - -DBIN_SUFFIX=$(BIN_SUFFIX) \ - -DNS_NO_XPCOM \ - -DMOZ_DEBUG=$(MOZ_DEBUG) \ - $(NULL) - -# For debugging purposes only -#DEFINES += -DDISABLE_UPDATER_AUTHENTICODE_CHECK - -include $(topsrcdir)/config/rules.mk - -libs:: ../test/unit/head_update.js.in - $(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py -Fsubstitution $(DEFINES) $(ACDEFINES) $^ > $(TESTROOT)/unit/head_update.js - -ifneq ($(OS_TARGET),Android) -ifndef MOZ_PROFILE_GENERATE -libs:: - $(INSTALL) ../test/TestAUSHelper$(BIN_SUFFIX) $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit - $(INSTALL) -D $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/data - $(INSTALL) $(topsrcdir)/$(relativesrcdir)/../test/unit/data/* $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/data -endif -endif # Not Android diff --git a/toolkit/mozapps/update/test_svc/moz.build b/toolkit/mozapps/update/test_svc/moz.build deleted file mode 100644 index 191c90f0b92d..000000000000 --- a/toolkit/mozapps/update/test_svc/moz.build +++ /dev/null @@ -1,7 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] diff --git a/toolkit/mozapps/update/test_timermanager/moz.build b/toolkit/mozapps/update/test_timermanager/moz.build deleted file mode 100644 index bb1ee4234669..000000000000 --- a/toolkit/mozapps/update/test_timermanager/moz.build +++ /dev/null @@ -1,9 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- -# vim: set filetype=python: -# 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/. - -MODULE = 'test_timermanager' - -XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] diff --git a/toolkit/mozapps/update/tests/Makefile.in b/toolkit/mozapps/update/tests/Makefile.in new file mode 100644 index 000000000000..6b3a43264567 --- /dev/null +++ b/toolkit/mozapps/update/tests/Makefile.in @@ -0,0 +1,112 @@ +# 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/. + +XPCSHELLTESTROOT = $(abspath $(DEPTH))/_tests/xpcshell/$(relativesrcdir) +CHROMETESTROOT = $(abspath $(DEPTH))/_tests/testing/mochitest/chrome/$(relativesrcdir) + +DEFINES += \ + -DAB_CD=$(AB_CD) \ + -DMOZ_APP_NAME=$(MOZ_APP_NAME) \ + -DMOZ_APP_DISPLAYNAME="$(MOZ_APP_DISPLAYNAME)" \ + -DBIN_SUFFIX=$(BIN_SUFFIX) \ + -DNS_NO_XPCOM \ + -DMOZ_DEBUG=$(MOZ_DEBUG) \ + $(NULL) + +ifdef MOZ_MAINTENANCE_SERVICE +DEFINES += -DMOZ_MAINTENANCE_SERVICE=$(MOZ_MAINTENANCE_SERVICE) +endif + +# For debugging purposes only +#DEFINES += -DDISABLE_UPDATER_AUTHENTICODE_CHECK + +PP_TARGETS += aus-update-head +aus-update-head_FLAGS := -Fsubstitution $(DEFINES) $(ACDEFINES) +aus-update-head := $(srcdir)/unit_aus_update/head_update.js +aus-update-head_PATH := $(XPCSHELLTESTROOT)/unit_aus_update + +INSTALL_TARGETS += xpcshell-data +xpcshell-data_TARGET := libs +xpcshell-data_DEST := $(XPCSHELLTESTROOT)/data +xpcshell-data_FILES := $(wildcard $(srcdir)/data/*) + +# Android doesn't use the Mozilla updater or the toolkit update UI +ifneq (android,$(MOZ_WIDGET_TOOLKIT)) +INSTALL_TARGETS += base-updater-head +base-updater-head_TARGET := libs +base-updater-head_DEST := $(XPCSHELLTESTROOT)/unit_base_updater +base-updater-head_FILES := $(XPCSHELLTESTROOT)/unit_aus_update/head_update.js + +INSTALL_TARGETS += service-updater-head +service-updater-head_TARGET := libs +service-updater-head_DEST := $(XPCSHELLTESTROOT)/unit_service_updater +service-updater-head_FILES := $(XPCSHELLTESTROOT)/unit_aus_update/head_update.js + +ifndef MOZ_PROFILE_GENERATE +INSTALL_TARGETS += xpcshell-test-helper +xpcshell-test-helper_TARGET := libs +xpcshell-test-helper_DEST := $(XPCSHELLTESTROOT)/data +xpcshell-test-helper_FILES := $(DIST)/bin/TestAUSHelper$(BIN_SUFFIX) +endif # Not MOZ_PROFILE_GENERATE + +_CHROME_SHARED := \ + update.sjs \ + utils.js \ + $(NULL) +PP_TARGETS += chrome-shared +chrome-shared := $(addprefix $(srcdir)/chrome/,$(_CHROME_SHARED)) +chrome-shared_PATH := $(CHROMETESTROOT)/chrome + +_CHROME_DATA := \ + simple.mar \ + simple_no_pib.mar \ + $(NULL) +INSTALL_TARGETS += chrome-data +chrome-data_TARGET := libs +chrome-data_DEST := $(CHROMETESTROOT)/data +chrome-data_FILES := $(addprefix $(srcdir)/data/,$(_CHROME_DATA)) + +INI_TEST_FILES = \ + TestAUSReadStrings1.ini \ + TestAUSReadStrings2.ini \ + TestAUSReadStrings3.ini \ + $(NULL) + +LOCAL_INCLUDES += \ + -I$(srcdir) \ + -I$(topsrcdir)/toolkit/mozapps/update \ + -I$(topsrcdir)/toolkit/mozapps/update/common \ + $(NULL) + +MOZ_WINCONSOLE = 1 + +LIBS += \ + ../common/$(LIB_PREFIX)updatecommon.$(LIB_SUFFIX) \ + $(NULL) + +ifeq ($(OS_ARCH),WINNT) +USE_STATIC_LIBS = 1 +DEFINES += -DUNICODE -D_UNICODE +endif # WINNT +endif # Not Android + +include $(topsrcdir)/config/rules.mk + +ifneq (android,$(MOZ_WIDGET_TOOLKIT)) +# TestAUSReadStrings runs during check in the following directory with a Unicode +# char in order to test bug 473417 on Windows. +ifeq ($(OS_ARCH),WINNT) +bug473417dir = test_bug473417-ó +else +bug473417dir = test_bug473417 +endif + +check:: + $(RM) -rf $(DEPTH)/_tests/updater/ && $(NSINSTALL) -D $(DEPTH)/_tests/updater/$(bug473417dir)/ + for i in $(INI_TEST_FILES); do \ + $(INSTALL) $(srcdir)/$$i $(DEPTH)/_tests/updater/$(bug473417dir)/; \ + done + $(INSTALL) $(FINAL_TARGET)/TestAUSReadStrings$(BIN_SUFFIX) $(DEPTH)/_tests/updater/$(bug473417dir)/ + @$(RUN_TEST_PROGRAM) $(DEPTH)/_tests/updater/$(bug473417dir)/TestAUSReadStrings$(BIN_SUFFIX) +endif # Not Android diff --git a/toolkit/mozapps/update/test/TestAUSHelper.cpp b/toolkit/mozapps/update/tests/TestAUSHelper.cpp similarity index 100% rename from toolkit/mozapps/update/test/TestAUSHelper.cpp rename to toolkit/mozapps/update/tests/TestAUSHelper.cpp diff --git a/toolkit/mozapps/update/test/TestAUSReadStrings.cpp b/toolkit/mozapps/update/tests/TestAUSReadStrings.cpp similarity index 100% rename from toolkit/mozapps/update/test/TestAUSReadStrings.cpp rename to toolkit/mozapps/update/tests/TestAUSReadStrings.cpp diff --git a/toolkit/mozapps/update/test/TestAUSReadStrings1.ini b/toolkit/mozapps/update/tests/TestAUSReadStrings1.ini similarity index 100% rename from toolkit/mozapps/update/test/TestAUSReadStrings1.ini rename to toolkit/mozapps/update/tests/TestAUSReadStrings1.ini diff --git a/toolkit/mozapps/update/test/TestAUSReadStrings2.ini b/toolkit/mozapps/update/tests/TestAUSReadStrings2.ini similarity index 100% rename from toolkit/mozapps/update/test/TestAUSReadStrings2.ini rename to toolkit/mozapps/update/tests/TestAUSReadStrings2.ini diff --git a/toolkit/mozapps/update/test/TestAUSReadStrings3.ini b/toolkit/mozapps/update/tests/TestAUSReadStrings3.ini similarity index 100% rename from toolkit/mozapps/update/test/TestAUSReadStrings3.ini rename to toolkit/mozapps/update/tests/TestAUSReadStrings3.ini diff --git a/toolkit/mozapps/update/test/chrome/chrome.ini b/toolkit/mozapps/update/tests/chrome/chrome.ini similarity index 88% rename from toolkit/mozapps/update/test/chrome/chrome.ini rename to toolkit/mozapps/update/tests/chrome/chrome.ini index 9d28cbf90cbe..f6b20996d0f4 100644 --- a/toolkit/mozapps/update/test/chrome/chrome.ini +++ b/toolkit/mozapps/update/tests/chrome/chrome.ini @@ -1,8 +1,17 @@ +; 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/. + [DEFAULT] support-files = - ../unit/data/simple.mar - ../unit/data/simple_no_pib.mar + utils.js + update.sjs +generated-files = + utils.js + update.sjs +; mochitest-chrome tests must start with "test_" and are executed in sorted +; order and not in the order specified in the manifest. [test_0011_check_basic.xul] [test_0012_check_basic_license.xul] [test_0013_check_incompat_basic.xul] diff --git a/toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0011_check_basic.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0011_check_basic.xul index e7a1f4ea6a24..d74d7048501f 100644 --- a/toolkit/mozapps/update/test/chrome/test_0011_check_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0011_check_basic.xul @@ -34,7 +34,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0012_check_basic_license.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0012_check_basic_license.xul index fd100cd60d16..983c0f1b30b8 100644 --- a/toolkit/mozapps/update/test/chrome/test_0012_check_basic_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0012_check_basic_license.xul @@ -74,7 +74,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1" + + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul index 1a6743d42d40..92164a787a43 100644 --- a/toolkit/mozapps/update/test/chrome/test_0013_check_incompat_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0013_check_incompat_basic.xul @@ -38,7 +38,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul index 23ad3ea302ea..a0c92e60e09b 100644 --- a/toolkit/mozapps/update/test/chrome/test_0014_check_incompat_basic_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0014_check_incompat_basic_license.xul @@ -78,7 +78,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul index 9d82d4fc8b8b..c60a0238ce5d 100644 --- a/toolkit/mozapps/update/test/chrome/test_0015_check_incompat_basic_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0015_check_incompat_basic_addons.xul @@ -47,7 +47,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul index 6cb3b78e54fe..e78323870f19 100644 --- a/toolkit/mozapps/update/test/chrome/test_0016_check_incompat_basic_license_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0016_check_incompat_basic_license_addons.xul @@ -87,7 +87,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0017_check_staging_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0017_check_staging_basic.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0017_check_staging_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0017_check_staging_basic.xul index 0badb0a66976..74d3049bf003 100644 --- a/toolkit/mozapps/update/test/chrome/test_0017_check_staging_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0017_check_staging_basic.xul @@ -36,7 +36,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true); - let url = URL_UPDATE + "?showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(); setUpdateURLOverride(url); setupTimer(180000); // 180 seconds diff --git a/toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0021_check_billboard.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul rename to toolkit/mozapps/update/tests/chrome/test_0021_check_billboard.xul index 0506d04fbbe6..5188bda46763 100644 --- a/toolkit/mozapps/update/test/chrome/test_0021_check_billboard.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0021_check_billboard.xul @@ -41,7 +41,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0022_check_billboard_license.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0022_check_billboard_license.xul index 1ec7be52bcd0..8f2cffaa6808 100644 --- a/toolkit/mozapps/update/test/chrome/test_0022_check_billboard_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0022_check_billboard_license.xul @@ -83,8 +83,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" + - getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1" + + "&showDetails=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul rename to toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul index e30bb8b9f2bc..024231aab914 100644 --- a/toolkit/mozapps/update/test/chrome/test_0023_check_incompat_billboard.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0023_check_incompat_billboard.xul @@ -45,7 +45,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul index fd9028cf3ff3..45297a4b90f5 100644 --- a/toolkit/mozapps/update/test/chrome/test_0024_check_incompat_billboard_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0024_check_incompat_billboard_license.xul @@ -87,7 +87,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul index c05d1367d3a1..6e05c0a60e44 100644 --- a/toolkit/mozapps/update/test/chrome/test_0025_check_incompat_billboard_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0025_check_incompat_billboard_addons.xul @@ -56,7 +56,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul index 3c9ce0e9ad2b..b3d011901125 100644 --- a/toolkit/mozapps/update/test/chrome/test_0026_check_incompat_billboard_license_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0026_check_incompat_billboard_license_addons.xul @@ -96,7 +96,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0031_available_basic.xul similarity index 92% rename from toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0031_available_basic.xul index 79de422d8382..9080a65dcd70 100644 --- a/toolkit/mozapps/update/test/chrome/test_0031_available_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0031_available_basic.xul @@ -32,7 +32,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" + + getVersionParams(); setUpdateURLOverride(url); gAUS.checkForBackgroundUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0032_available_basic_license.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0032_available_basic_license.xul index b489768b4067..8dd74dfbd1bc 100644 --- a/toolkit/mozapps/update/test/chrome/test_0032_available_basic_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0032_available_basic_license.xul @@ -72,7 +72,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1&showPrompt=1" + getVersionParams(); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul index 34bc09b67414..1e938e0a7b5d 100644 --- a/toolkit/mozapps/update/test/chrome/test_0033_available_incompat_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0033_available_incompat_basic.xul @@ -36,7 +36,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul b/toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul index c3690129b907..5b80697bcc69 100644 --- a/toolkit/mozapps/update/test/chrome/test_0034_available_incompat_basic_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0034_available_incompat_basic_license.xul @@ -76,7 +76,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul index 29c848aa4f10..3a7b89b87e4f 100644 --- a/toolkit/mozapps/update/test/chrome/test_0035_available_incompat_basic_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0035_available_incompat_basic_addons.xul @@ -45,7 +45,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul similarity index 97% rename from toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul index 4f8bb966446c..c1cf4b3137c2 100644 --- a/toolkit/mozapps/update/test/chrome/test_0036_available_incompat_basic_license_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0036_available_incompat_basic_license_addons.xul @@ -85,7 +85,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showLicense=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showLicense=1&showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0041_available_billboard.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul rename to toolkit/mozapps/update/tests/chrome/test_0041_available_billboard.xul index 7c0a00edc652..498119af76db 100644 --- a/toolkit/mozapps/update/test/chrome/test_0041_available_billboard.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0041_available_billboard.xul @@ -39,7 +39,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1&showPrompt=1" + getVersionParams(); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0042_available_billboard_license.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0042_available_billboard_license.xul index 0b2f5f18cdf5..e22ebf8a26d6 100644 --- a/toolkit/mozapps/update/test/chrome/test_0042_available_billboard_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0042_available_billboard_license.xul @@ -81,8 +81,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1" + - "&showPrompt=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1" + + "&showDetails=1&showPrompt=1" + getVersionParams(); setUpdateURLOverride(url); gAUS.notify(null); diff --git a/toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul rename to toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul index d480c812424c..236f860c9142 100644 --- a/toolkit/mozapps/update/test/chrome/test_0043_available_incompat_billboard.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0043_available_incompat_billboard.xul @@ -43,7 +43,7 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showPrompt=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showPrompt=1&showDetails=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul b/toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul rename to toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul index ddc2cb7d7df2..10722a15d9a8 100644 --- a/toolkit/mozapps/update/test/chrome/test_0044_available_incompat_billboard_license.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0044_available_incompat_billboard_license.xul @@ -85,7 +85,8 @@ gDisableNoUpdateAddon = true; function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1" + + "&showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul index 8810fb2cc25b..c82e91e95ba9 100644 --- a/toolkit/mozapps/update/test/chrome/test_0045_available_incompat_billboard_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0045_available_incompat_billboard_addons.xul @@ -54,7 +54,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul b/toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul rename to toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul index 1d648d5b0e41..90e280a9f027 100644 --- a/toolkit/mozapps/update/test/chrome/test_0046_available_incompat_billboard_license_addons.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0046_available_incompat_billboard_license_addons.xul @@ -94,7 +94,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&showDetails=1&showPrompt=1" + + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1" + + "&showDetails=1&showPrompt=1" + getVersionParams(getNewerAppVersion(), getNewerPlatformVersion()); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul b/toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul rename to toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul index 2537dde0985f..cbecffe5272d 100644 --- a/toolkit/mozapps/update/test/chrome/test_0051_check_error_xml_malformed.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0051_check_error_xml_malformed.xul @@ -29,7 +29,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?xmlMalformed=1"; + let url = URL_HTTP_UPDATE_XML + "?xmlMalformed=1"; setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul b/toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul rename to toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul index d102e14699b8..49a1381dd3af 100644 --- a/toolkit/mozapps/update/test/chrome/test_0052_check_no_updates.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0052_check_no_updates.xul @@ -29,7 +29,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?noUpdates=1"; + let url = URL_HTTP_UPDATE_XML + "?noUpdates=1"; setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul b/toolkit/mozapps/update/tests/chrome/test_0053_check_billboard_license_noAttr.xul similarity index 91% rename from toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul rename to toolkit/mozapps/update/tests/chrome/test_0053_check_billboard_license_noAttr.xul index 5d50ffd65ec9..e657daef24c0 100644 --- a/toolkit/mozapps/update/test/chrome/test_0053_check_billboard_license_noAttr.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0053_check_billboard_license_noAttr.xul @@ -40,8 +40,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showLicense=1&remoteNoTypeAttr=1" + - "&showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showLicense=1" + + "&remoteNoTypeAttr=1&showDetails=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul b/toolkit/mozapps/update/tests/chrome/test_0054_check_billboard_license_404.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul rename to toolkit/mozapps/update/tests/chrome/test_0054_check_billboard_license_404.xul index 33f2f931a432..f5327fb21634 100644 --- a/toolkit/mozapps/update/test/chrome/test_0054_check_billboard_license_404.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0054_check_billboard_license_404.xul @@ -40,7 +40,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?billboard404=1&license404=1&showDetails=1" + + let url = URL_HTTP_UPDATE_XML + "?billboard404=1&license404=1&showDetails=1" + getVersionParams(); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0061_check_verifyFailPartial_noComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0061_check_verifyFailPartial_noComplete.xul similarity index 90% rename from toolkit/mozapps/update/test/chrome/test_0061_check_verifyFailPartial_noComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0061_check_verifyFailPartial_noComplete.xul index 9c25ed3d48a3..fe877ee0ef3f 100644 --- a/toolkit/mozapps/update/test/chrome/test_0061_check_verifyFailPartial_noComplete.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0061_check_verifyFailPartial_noComplete.xul @@ -34,8 +34,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&partialPatchOnly=1&invalidPartialHash=1" + - getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&partialPatchOnly=1" + + "&invalidPartialHash=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0062_check_verifyFailComplete_noPartial.xul b/toolkit/mozapps/update/tests/chrome/test_0062_check_verifyFailComplete_noPartial.xul similarity index 90% rename from toolkit/mozapps/update/test/chrome/test_0062_check_verifyFailComplete_noPartial.xul rename to toolkit/mozapps/update/tests/chrome/test_0062_check_verifyFailComplete_noPartial.xul index d2595527ce4e..39c63c6e1f9e 100644 --- a/toolkit/mozapps/update/test/chrome/test_0062_check_verifyFailComplete_noPartial.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0062_check_verifyFailComplete_noPartial.xul @@ -34,8 +34,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&completePatchOnly=1&invalidCompleteHash=1" + - getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&completePatchOnly=1" + + "&invalidCompleteHash=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0063_check_verifyFailPartialComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0063_check_verifyFailPartialComplete.xul similarity index 90% rename from toolkit/mozapps/update/test/chrome/test_0063_check_verifyFailPartialComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0063_check_verifyFailPartialComplete.xul index 943125f6304f..16ec70995e7a 100644 --- a/toolkit/mozapps/update/test/chrome/test_0063_check_verifyFailPartialComplete.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0063_check_verifyFailPartialComplete.xul @@ -34,8 +34,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&invalidPartialHash=1&invalidCompleteHash=1" + - getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialHash=1" + + "&invalidCompleteHash=1" + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0064_check_verifyFailPartial_successComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0064_check_verifyFailPartial_successComplete.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0064_check_verifyFailPartial_successComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0064_check_verifyFailPartial_successComplete.xul index 89dea601f31d..73b9351b42a8 100644 --- a/toolkit/mozapps/update/test/chrome/test_0064_check_verifyFailPartial_successComplete.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0064_check_verifyFailPartial_successComplete.xul @@ -34,7 +34,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&invalidPartialHash=1" + + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&invalidPartialHash=1" + getVersionParams(); setUpdateURLOverride(url); diff --git a/toolkit/mozapps/update/test/chrome/test_0071_notify_verifyFailPartial_noComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0071_notify_verifyFailPartial_noComplete.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0071_notify_verifyFailPartial_noComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0071_notify_verifyFailPartial_noComplete.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0072_notify_verifyFailComplete_noPartial.xul b/toolkit/mozapps/update/tests/chrome/test_0072_notify_verifyFailComplete_noPartial.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0072_notify_verifyFailComplete_noPartial.xul rename to toolkit/mozapps/update/tests/chrome/test_0072_notify_verifyFailComplete_noPartial.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0073_notify_verifyFailPartialComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0073_notify_verifyFailPartialComplete.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0073_notify_verifyFailPartialComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0073_notify_verifyFailPartialComplete.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0074_notify_verifyFailPartial_successComplete.xul b/toolkit/mozapps/update/tests/chrome/test_0074_notify_verifyFailPartial_successComplete.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0074_notify_verifyFailPartial_successComplete.xul rename to toolkit/mozapps/update/tests/chrome/test_0074_notify_verifyFailPartial_successComplete.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul b/toolkit/mozapps/update/tests/chrome/test_0081_error_patchApplyFailure_partial_only.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0081_error_patchApplyFailure_partial_only.xul rename to toolkit/mozapps/update/tests/chrome/test_0081_error_patchApplyFailure_partial_only.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul b/toolkit/mozapps/update/tests/chrome/test_0082_error_patchApplyFailure_complete_only.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0082_error_patchApplyFailure_complete_only.xul rename to toolkit/mozapps/update/tests/chrome/test_0082_error_patchApplyFailure_complete_only.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul b/toolkit/mozapps/update/tests/chrome/test_0083_error_patchApplyFailure_partial_complete.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul rename to toolkit/mozapps/update/tests/chrome/test_0083_error_patchApplyFailure_partial_complete.xul index 7fa365b9670f..365610e9de51 100644 --- a/toolkit/mozapps/update/test/chrome/test_0083_error_patchApplyFailure_partial_complete.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0083_error_patchApplyFailure_partial_complete.xul @@ -34,7 +34,7 @@ function runTest() { // Specify the url to update.sjs with a slowDownloadMar param so the ui can // load before the download completes. - let slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1"; + let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1"; let patches = getLocalPatchString("partial", null, null, null, null, null, STATE_PENDING) + getLocalPatchString("complete", slowDownloadURL, null, null, diff --git a/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul b/toolkit/mozapps/update/tests/chrome/test_0084_error_patchApplyFailure_verify_failed.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul rename to toolkit/mozapps/update/tests/chrome/test_0084_error_patchApplyFailure_verify_failed.xul index dbb7d01f87b2..2b9f3826c3be 100644 --- a/toolkit/mozapps/update/test/chrome/test_0084_error_patchApplyFailure_verify_failed.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0084_error_patchApplyFailure_verify_failed.xul @@ -34,7 +34,7 @@ function runTest() { // Specify the url to update.sjs with a slowDownloadMar param so the ui can // load before the download completes. - let slowDownloadURL = URL_UPDATE + "?slowDownloadMar=1"; + let slowDownloadURL = URL_HTTP_UPDATE_XML + "?slowDownloadMar=1"; let patches = getLocalPatchString("partial", null, null, null, null, null, STATE_PENDING) + getLocalPatchString("complete", slowDownloadURL, "MD5", diff --git a/toolkit/mozapps/update/test/chrome/test_0091_installed.xul b/toolkit/mozapps/update/tests/chrome/test_0091_installed.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0091_installed.xul rename to toolkit/mozapps/update/tests/chrome/test_0091_installed.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul b/toolkit/mozapps/update/tests/chrome/test_0092_finishedBackground.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0092_finishedBackground.xul rename to toolkit/mozapps/update/tests/chrome/test_0092_finishedBackground.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0093_restartNotification.xul b/toolkit/mozapps/update/tests/chrome/test_0093_restartNotification.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0093_restartNotification.xul rename to toolkit/mozapps/update/tests/chrome/test_0093_restartNotification.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0094_restartNotification_remote.xul b/toolkit/mozapps/update/tests/chrome/test_0094_restartNotification_remote.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0094_restartNotification_remote.xul rename to toolkit/mozapps/update/tests/chrome/test_0094_restartNotification_remote.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0095_restartNotification_remoteInvalidNumber.xul b/toolkit/mozapps/update/tests/chrome/test_0095_restartNotification_remoteInvalidNumber.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0095_restartNotification_remoteInvalidNumber.xul rename to toolkit/mozapps/update/tests/chrome/test_0095_restartNotification_remoteInvalidNumber.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0096_restartNotification_stagedBackground.xul b/toolkit/mozapps/update/tests/chrome/test_0096_restartNotification_stagedBackground.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0096_restartNotification_stagedBackground.xul rename to toolkit/mozapps/update/tests/chrome/test_0096_restartNotification_stagedBackground.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0097_restartNotification_stagedServiceBackground.xul b/toolkit/mozapps/update/tests/chrome/test_0097_restartNotification_stagedServiceBackground.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_0097_restartNotification_stagedServiceBackground.xul rename to toolkit/mozapps/update/tests/chrome/test_0097_restartNotification_stagedServiceBackground.xul diff --git a/toolkit/mozapps/update/test/chrome/test_0101_background_restartNotification.xul b/toolkit/mozapps/update/tests/chrome/test_0101_background_restartNotification.xul similarity index 93% rename from toolkit/mozapps/update/test/chrome/test_0101_background_restartNotification.xul rename to toolkit/mozapps/update/tests/chrome/test_0101_background_restartNotification.xul index 2ed24c02e286..42dd42728040 100644 --- a/toolkit/mozapps/update/test/chrome/test_0101_background_restartNotification.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0101_background_restartNotification.xul @@ -29,7 +29,7 @@ function runTest() { Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1); - let url = URL_UPDATE + "?showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(); setUpdateURLOverride(url); gAUS.notify(null); diff --git a/toolkit/mozapps/update/test/chrome/test_0102_background_restartNotification_staging.xul b/toolkit/mozapps/update/tests/chrome/test_0102_background_restartNotification_staging.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0102_background_restartNotification_staging.xul rename to toolkit/mozapps/update/tests/chrome/test_0102_background_restartNotification_staging.xul index 443af81f8806..cf4edbdc36c3 100644 --- a/toolkit/mozapps/update/test/chrome/test_0102_background_restartNotification_staging.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0102_background_restartNotification_staging.xul @@ -30,7 +30,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, true); Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1); - let url = URL_UPDATE + "?showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(); setUpdateURLOverride(url); setupTimer(180000); // 180 seconds diff --git a/toolkit/mozapps/update/test/chrome/test_0103_background_restartNotification_stagingService.xul b/toolkit/mozapps/update/tests/chrome/test_0103_background_restartNotification_stagingService.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0103_background_restartNotification_stagingService.xul rename to toolkit/mozapps/update/tests/chrome/test_0103_background_restartNotification_stagingService.xul index bbd282ccc130..11bfcf17673b 100644 --- a/toolkit/mozapps/update/test/chrome/test_0103_background_restartNotification_stagingService.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0103_background_restartNotification_stagingService.xul @@ -31,7 +31,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true); Services.prefs.setIntPref(PREF_APP_UPDATE_PROMPTWAITTIME, 1); - let url = URL_UPDATE + "?showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1" + getVersionParams(); setUpdateURLOverride(url); setupTimer(180000); // 180 seconds diff --git a/toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul b/toolkit/mozapps/update/tests/chrome/test_0111_neverButton_basic.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul rename to toolkit/mozapps/update/tests/chrome/test_0111_neverButton_basic.xul index 27b601973e5a..c3b2fdfa8250 100644 --- a/toolkit/mozapps/update/test/chrome/test_0111_neverButton_basic.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0111_neverButton_basic.xul @@ -34,7 +34,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showNever=1&showDetails=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showNever=1&showDetails=1" + + getVersionParams(); setUpdateURLOverride(url); // add the never preference for this version to verify that checking for diff --git a/toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul b/toolkit/mozapps/update/tests/chrome/test_0112_neverButton_billboard.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul rename to toolkit/mozapps/update/tests/chrome/test_0112_neverButton_billboard.xul index e46a79ecfcbc..e5c4184fd9b8 100644 --- a/toolkit/mozapps/update/test/chrome/test_0112_neverButton_billboard.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0112_neverButton_billboard.xul @@ -42,7 +42,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showBillboard=1&showNever=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showBillboard=1&showNever=1" + + getVersionParams(); setUpdateURLOverride(url); // add the never preference for this version to verify that checking for diff --git a/toolkit/mozapps/update/test/chrome/test_0113_showNeverForVersionRemovedWithPref.xul b/toolkit/mozapps/update/tests/chrome/test_0113_showNeverForVersionRemovedWithPref.xul similarity index 93% rename from toolkit/mozapps/update/test/chrome/test_0113_showNeverForVersionRemovedWithPref.xul rename to toolkit/mozapps/update/tests/chrome/test_0113_showNeverForVersionRemovedWithPref.xul index 8ee08425dcfd..d641c9c3eb1d 100644 --- a/toolkit/mozapps/update/test/chrome/test_0113_showNeverForVersionRemovedWithPref.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0113_showNeverForVersionRemovedWithPref.xul @@ -31,7 +31,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?showDetails=1&showPrompt=1" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?showDetails=1&showPrompt=1" + + getVersionParams(); setUpdateURLOverride(url); // add the never preference for this version to verify that checking for diff --git a/toolkit/mozapps/update/test/chrome/test_0121_check_requireBuiltinCert.xul b/toolkit/mozapps/update/tests/chrome/test_0121_check_requireBuiltinCert.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0121_check_requireBuiltinCert.xul rename to toolkit/mozapps/update/tests/chrome/test_0121_check_requireBuiltinCert.xul index 3b0aabfe80fe..dd2eecef91c1 100644 --- a/toolkit/mozapps/update/test/chrome/test_0121_check_requireBuiltinCert.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0121_check_requireBuiltinCert.xul @@ -84,8 +84,7 @@ function testXHRLoad(aEvent) { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, true); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, false); - let url = "https://example.com/" + URL_PATH + "/update.sjs?showDetails=1" + - getVersionParams(); + let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams(); gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul b/toolkit/mozapps/update/tests/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul rename to toolkit/mozapps/update/tests/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul index 8c56898b1105..c3042d492ae3 100644 --- a/toolkit/mozapps/update/test/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0122_check_allowNonBuiltinCert_validCertAttrs.xul @@ -84,8 +84,7 @@ function testXHRLoad(aEvent) { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true); - let url = "https://example.com/" + URL_PATH + "/update.sjs?showDetails=1" + - getVersionParams(); + let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams(); gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul b/toolkit/mozapps/update/tests/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul similarity index 93% rename from toolkit/mozapps/update/test/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul rename to toolkit/mozapps/update/tests/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul index e8744530ff4f..908c3ed0a3fa 100644 --- a/toolkit/mozapps/update/test/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0123_check_allowNonBuiltinCert_noCertAttrsCheck.xul @@ -37,8 +37,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, false); - let url = "https://example.com/" + URL_PATH + "/update.sjs?showDetails=1" + - getVersionParams(); + let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams(); gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); @@ -46,7 +45,6 @@ function runTest() { gUP.checkForUpdates(); } - ]]> diff --git a/toolkit/mozapps/update/test/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul b/toolkit/mozapps/update/tests/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul rename to toolkit/mozapps/update/tests/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul index 1da1d6d98a0a..42830783055b 100644 --- a/toolkit/mozapps/update/test/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0131_check_invalidCertAttrs_noUpdate.xul @@ -38,7 +38,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true); - let url = "https://example.com/" + URL_PATH + "/update.sjs?noUpdates=1"; + let url = URL_HTTPS_UPDATE_XML + "?noUpdates=1"; gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul b/toolkit/mozapps/update/tests/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul rename to toolkit/mozapps/update/tests/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul index 6089cf69c439..c70f588afd51 100644 --- a/toolkit/mozapps/update/test/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0132_check_invalidCertAttrs_hasUpdate.xul @@ -38,8 +38,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true); - let url = "https://example.com/" + URL_PATH + "/update.sjs?showDetails=1" + - getVersionParams(); + let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams(); gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul b/toolkit/mozapps/update/tests/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul rename to toolkit/mozapps/update/tests/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul index c69b703569ae..b8ce97e2d3cf 100644 --- a/toolkit/mozapps/update/test/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0141_notify_invalidCertAttrs_noUpdate.xul @@ -35,7 +35,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true); - let url = "https://example.com/" + URL_PATH + "/update.sjs?noUpdates=1"; + let url = URL_HTTPS_UPDATE_XML + "?noUpdates=1"; gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul b/toolkit/mozapps/update/tests/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul similarity index 94% rename from toolkit/mozapps/update/test/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul rename to toolkit/mozapps/update/tests/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul index c296c8f1be43..6fa4f5565ec3 100644 --- a/toolkit/mozapps/update/test/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0142_notify_invalidCertAttrs_hasUpdate.xul @@ -35,8 +35,7 @@ function runTest() { Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_REQUIREBUILTIN, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_CERT_CHECKATTRS, true); - let url = "https://example.com/" + URL_PATH + "/update.sjs?showDetails=1" + - getVersionParams(); + let url = URL_HTTPS_UPDATE_XML + "?showDetails=1" + getVersionParams(); gAppUpdateURLDefault = gDefaultPrefBranch.getCharPref(PREF_APP_UPDATE_URL); debugDump("setting default pref " + PREF_APP_UPDATE_URL + " to " + url); gDefaultPrefBranch.setCharPref(PREF_APP_UPDATE_URL, url); diff --git a/toolkit/mozapps/update/test/chrome/test_0151_notify_backgroundCheckError.xul b/toolkit/mozapps/update/tests/chrome/test_0151_notify_backgroundCheckError.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0151_notify_backgroundCheckError.xul rename to toolkit/mozapps/update/tests/chrome/test_0151_notify_backgroundCheckError.xul index 0bde1329d23c..47b818eb99bb 100644 --- a/toolkit/mozapps/update/test/chrome/test_0151_notify_backgroundCheckError.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0151_notify_backgroundCheckError.xul @@ -30,7 +30,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?xmlMalformed=1"; + let url = URL_HTTP_UPDATE_XML + "?xmlMalformed=1"; setUpdateURLOverride(url); errorsPrefObserver.init(PREF_APP_UPDATE_BACKGROUNDERRORS, diff --git a/toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul b/toolkit/mozapps/update/tests/chrome/test_0161_check_unsupported.xul similarity index 96% rename from toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul rename to toolkit/mozapps/update/tests/chrome/test_0161_check_unsupported.xul index 7ae5dcdf3fdb..fd9b8775e362 100644 --- a/toolkit/mozapps/update/test/chrome/test_0161_check_unsupported.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0161_check_unsupported.xul @@ -33,7 +33,7 @@ function runTest() { // it was shown previously. Services.prefs.setBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, true); - let url = URL_UPDATE + "?unsupported=1"; + let url = URL_HTTP_UPDATE_XML + "?unsupported=1"; setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul b/toolkit/mozapps/update/tests/chrome/test_0162_notify_unsupported.xul similarity index 95% rename from toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul rename to toolkit/mozapps/update/tests/chrome/test_0162_notify_unsupported.xul index a0d344eac065..ec26b8f6d308 100644 --- a/toolkit/mozapps/update/test/chrome/test_0162_notify_unsupported.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0162_notify_unsupported.xul @@ -27,7 +27,7 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?unsupported=1"; + let url = URL_HTTP_UPDATE_XML + "?unsupported=1"; setUpdateURLOverride(url); gAUS.notify(null); diff --git a/toolkit/mozapps/update/test/chrome/test_0900_deprecatedUpdateFormat_minor.xul b/toolkit/mozapps/update/tests/chrome/test_0900_deprecatedUpdateFormat_minor.xul similarity index 92% rename from toolkit/mozapps/update/test/chrome/test_0900_deprecatedUpdateFormat_minor.xul rename to toolkit/mozapps/update/tests/chrome/test_0900_deprecatedUpdateFormat_minor.xul index bf7157d04a9b..b07782d640fb 100644 --- a/toolkit/mozapps/update/test/chrome/test_0900_deprecatedUpdateFormat_minor.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0900_deprecatedUpdateFormat_minor.xul @@ -29,7 +29,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?oldFormat=1&type=minor" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?oldFormat=1&type=minor" + + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_0901_deprecatedUpdateFormat_major.xul b/toolkit/mozapps/update/tests/chrome/test_0901_deprecatedUpdateFormat_major.xul similarity index 93% rename from toolkit/mozapps/update/test/chrome/test_0901_deprecatedUpdateFormat_major.xul rename to toolkit/mozapps/update/tests/chrome/test_0901_deprecatedUpdateFormat_major.xul index 84b7992c7d6e..8e65136b598a 100644 --- a/toolkit/mozapps/update/test/chrome/test_0901_deprecatedUpdateFormat_major.xul +++ b/toolkit/mozapps/update/tests/chrome/test_0901_deprecatedUpdateFormat_major.xul @@ -38,7 +38,8 @@ const TESTS = [ { function runTest() { debugDump("entering"); - let url = URL_UPDATE + "?oldFormat=1&type=major" + getVersionParams(); + let url = URL_HTTP_UPDATE_XML + "?oldFormat=1&type=major" + + getVersionParams(); setUpdateURLOverride(url); gUP.checkForUpdates(); diff --git a/toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul b/toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul similarity index 100% rename from toolkit/mozapps/update/test/chrome/test_9999_cleanup.xul rename to toolkit/mozapps/update/tests/chrome/test_9999_cleanup.xul diff --git a/toolkit/mozapps/update/test/chrome/update.sjs b/toolkit/mozapps/update/tests/chrome/update.sjs similarity index 91% rename from toolkit/mozapps/update/test/chrome/update.sjs rename to toolkit/mozapps/update/tests/chrome/update.sjs index 118f56a44864..f242dc97b10b 100644 --- a/toolkit/mozapps/update/test/chrome/update.sjs +++ b/toolkit/mozapps/update/tests/chrome/update.sjs @@ -14,10 +14,11 @@ const AUS_Ci = Components.interfaces; #include ../sharedUpdateXML.js -const URL_HOST = "http://example.com/"; -const URL_PATH = "chrome/toolkit/mozapps/update/test/chrome/"; -const URL_UPDATE = URL_HOST + URL_PATH + "update.sjs"; -const SERVICE_URL = URL_HOST + URL_PATH + FILE_SIMPLE_MAR; +const URL_HOST = "http://example.com"; +const URL_PATH_UPDATE_XML = "/chrome/toolkit/mozapps/update/tests/chrome/update.sjs"; +const URL_HTTP_UPDATE_SJS = URL_HOST + URL_PATH_UPDATE_XML; +const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data/"; +const SERVICE_URL = URL_HOST + "/" + REL_PATH_DATA + FILE_SIMPLE_MAR; const SLOW_MAR_DOWNLOAD_INTERVAL = 100; var gTimer; @@ -49,7 +50,7 @@ function handleRequest(aRequest, aResponse) { var marFile = AUS_Cc["@mozilla.org/file/directory_service;1"]. getService(AUS_Ci.nsIProperties). get("CurWorkD", AUS_Ci.nsILocalFile); - var path = URL_PATH + FILE_SIMPLE_MAR; + var path = REL_PATH_DATA + FILE_SIMPLE_MAR; var pathParts = path.split("/"); for(var i = 0; i < pathParts.length; ++i) marFile.append(pathParts[i]); @@ -117,18 +118,18 @@ function handleRequest(aRequest, aResponse) { var platformVersion = params.platformVersion ? params.platformVersion : "99.8"; var buildID = params.buildID ? params.buildID : "01234567890123"; // XXXrstrong - not specifying a detailsURL will cause a leak due to bug 470244 -// var detailsURL = params.showDetails ? URL_UPDATE + "?uiURL=DETAILS" : null; - var detailsURL = URL_UPDATE + "?uiURL=DETAILS"; - var billboardURL = params.showBillboard ? URL_UPDATE + "?uiURL=BILLBOARD" : null; +// var detailsURL = params.showDetails ? URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS" : null; + var detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=DETAILS"; + var billboardURL = params.showBillboard ? URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD" : null; if (billboardURL && params.remoteNoTypeAttr) billboardURL += "&remoteNoTypeAttr=1"; if (params.billboard404) - billboardURL = URL_HOST + URL_PATH + "missing.html"; - var licenseURL = params.showLicense ? URL_UPDATE + "?uiURL=LICENSE" : null; + billboardURL = URL_HOST + "/missing.html"; + var licenseURL = params.showLicense ? URL_HTTP_UPDATE_SJS + "?uiURL=LICENSE" : null; if (licenseURL && params.remoteNoTypeAttr) licenseURL += "&remoteNoTypeAttr=1"; if (params.license404) - licenseURL = URL_HOST + URL_PATH + "missing.html"; + licenseURL = URL_HOST + "/missing.html"; var showPrompt = params.showPrompt ? "true" : null; var showNever = params.showNever ? "true" : null; var promptWaitTime = params.promptWaitTime ? params.promptWaitTime : null; @@ -142,7 +143,7 @@ function handleRequest(aRequest, aResponse) { showPrompt = null; showNever = null; showSurvey = null; - detailsURL = URL_UPDATE + "?uiURL=BILLBOARD"; + detailsURL = URL_HTTP_UPDATE_SJS + "?uiURL=BILLBOARD"; if (params.remoteNoTypeAttr) detailsURL += "&remoteNoTypeAttr=1"; var extensionVersion = params.appVersion ? params.appVersion : "99.9"; @@ -234,7 +235,7 @@ function getUpdateRDF(aParams) { " toolkit@mozilla.org\n" + " 0\n" + " " + maxVersion + "\n" + - " " + URL_HOST + URL_PATH + "\n" + + " " + URL_HTTP_UPDATE_SJS + "\n" + " sha256:0\n" + " \n" + " \n" + diff --git a/toolkit/mozapps/update/test/chrome/utils.js b/toolkit/mozapps/update/tests/chrome/utils.js similarity index 98% rename from toolkit/mozapps/update/test/chrome/utils.js rename to toolkit/mozapps/update/tests/chrome/utils.js index 99c29fdd3868..0f1d39a451bf 100644 --- a/toolkit/mozapps/update/test/chrome/utils.js +++ b/toolkit/mozapps/update/tests/chrome/utils.js @@ -139,9 +139,12 @@ const PAGEID_INSTALLED = "installed"; // Done const UPDATE_WINDOW_NAME = "Update:Wizard"; -const URL_HOST = "http://example.com"; -const URL_PATH = "chrome/toolkit/mozapps/update/test/chrome"; -const URL_UPDATE = URL_HOST + "/" + URL_PATH + "/update.sjs"; +const URL_HOST = "http://example.com"; +const URL_PATH_UPDATE_XML = "/chrome/toolkit/mozapps/update/tests/chrome/update.sjs"; +const REL_PATH_DATA = "chrome/toolkit/mozapps/update/tests/data"; + +const URL_HTTP_UPDATE_XML = URL_HOST + URL_PATH_UPDATE_XML; +const URL_HTTPS_UPDATE_XML = "https://example.com" + URL_PATH_UPDATE_XML; const URI_UPDATE_PROMPT_DIALOG = "chrome://mozapps/content/update/updates.xul"; @@ -158,6 +161,8 @@ const TEST_ADDONS = [ "appdisabled_1", "appdisabled_2", "updateversion_1", "updateversion_2", "userdisabled_1", "userdisabled_2", "hotfix" ]; +var gURLData = URL_HOST + "/" + REL_PATH_DATA + "/"; + var gTestTimeout = 45000; // 45 seconds var gTimeoutTimer; @@ -859,8 +864,8 @@ function setupPrefs() { if (Services.prefs.prefHasUserValue(PREF_EXTENSIONS_UPDATE_URL)) { gExtUpdateURL = Services.prefs.getCharPref(PREF_EXTENSIONS_UPDATE_URL); } - let extUpdateUrl = URL_UPDATE + "?addonID=%ITEM_ID%&platformVersion=" + - getNewerPlatformVersion(); + let extUpdateUrl = URL_HTTP_UPDATE_XML + "?addonID=%ITEM_ID%" + + "&platformVersion=" + getNewerPlatformVersion(); Services.prefs.setCharPref(PREF_EXTENSIONS_UPDATE_URL, extUpdateUrl); Services.prefs.setIntPref(PREF_APP_UPDATE_IDLETIME, 0); diff --git a/toolkit/mozapps/update/test/unit/data/complete.mar b/toolkit/mozapps/update/tests/data/complete.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete.mar rename to toolkit/mozapps/update/tests/data/complete.mar diff --git a/toolkit/mozapps/update/test/unit/data/complete.png b/toolkit/mozapps/update/tests/data/complete.png similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete.png rename to toolkit/mozapps/update/tests/data/complete.png diff --git a/toolkit/mozapps/update/test/unit/data/complete_cc_log_switch_success b/toolkit/mozapps/update/tests/data/complete_cc_log_switch_success similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_cc_log_switch_success rename to toolkit/mozapps/update/tests/data/complete_cc_log_switch_success diff --git a/toolkit/mozapps/update/test/unit/data/complete_log_success b/toolkit/mozapps/update/tests/data/complete_log_success similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_log_success rename to toolkit/mozapps/update/tests/data/complete_log_success diff --git a/toolkit/mozapps/update/test/unit/data/complete_log_switch_success b/toolkit/mozapps/update/tests/data/complete_log_switch_success similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_log_switch_success rename to toolkit/mozapps/update/tests/data/complete_log_switch_success diff --git a/toolkit/mozapps/update/test/unit/data/complete_precomplete b/toolkit/mozapps/update/tests/data/complete_precomplete similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_precomplete rename to toolkit/mozapps/update/tests/data/complete_precomplete diff --git a/toolkit/mozapps/update/test/unit/data/complete_removed-files b/toolkit/mozapps/update/tests/data/complete_removed-files similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_removed-files rename to toolkit/mozapps/update/tests/data/complete_removed-files diff --git a/toolkit/mozapps/update/test/unit/data/complete_update_manifest b/toolkit/mozapps/update/tests/data/complete_update_manifest similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_update_manifest rename to toolkit/mozapps/update/tests/data/complete_update_manifest diff --git a/toolkit/mozapps/update/test/unit/data/complete_win.mar b/toolkit/mozapps/update/tests/data/complete_win.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/complete_win.mar rename to toolkit/mozapps/update/tests/data/complete_win.mar diff --git a/toolkit/mozapps/update/test/unit/data/old_version_mar.mar b/toolkit/mozapps/update/tests/data/old_version.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/old_version_mar.mar rename to toolkit/mozapps/update/tests/data/old_version.mar diff --git a/toolkit/mozapps/update/test/unit/data/partial.mar b/toolkit/mozapps/update/tests/data/partial.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial.mar rename to toolkit/mozapps/update/tests/data/partial.mar diff --git a/toolkit/mozapps/update/test/unit/data/partial.png b/toolkit/mozapps/update/tests/data/partial.png similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial.png rename to toolkit/mozapps/update/tests/data/partial.png diff --git a/toolkit/mozapps/update/test/unit/data/partial_in_use_win_after.exe b/toolkit/mozapps/update/tests/data/partial_in_use_win_after.exe similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_in_use_win_after.exe rename to toolkit/mozapps/update/tests/data/partial_in_use_win_after.exe diff --git a/toolkit/mozapps/update/test/unit/data/partial_in_use_win_before.exe b/toolkit/mozapps/update/tests/data/partial_in_use_win_before.exe similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_in_use_win_before.exe rename to toolkit/mozapps/update/tests/data/partial_in_use_win_before.exe diff --git a/toolkit/mozapps/update/test/unit/data/partial_log_failure b/toolkit/mozapps/update/tests/data/partial_log_failure similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_log_failure rename to toolkit/mozapps/update/tests/data/partial_log_failure diff --git a/toolkit/mozapps/update/test/unit/data/partial_log_success b/toolkit/mozapps/update/tests/data/partial_log_success similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_log_success rename to toolkit/mozapps/update/tests/data/partial_log_success diff --git a/toolkit/mozapps/update/test/unit/data/partial_log_switch_success b/toolkit/mozapps/update/tests/data/partial_log_switch_success similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_log_switch_success rename to toolkit/mozapps/update/tests/data/partial_log_switch_success diff --git a/toolkit/mozapps/update/test/unit/data/partial_precomplete b/toolkit/mozapps/update/tests/data/partial_precomplete similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_precomplete rename to toolkit/mozapps/update/tests/data/partial_precomplete diff --git a/toolkit/mozapps/update/test/unit/data/partial_removed-files b/toolkit/mozapps/update/tests/data/partial_removed-files similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_removed-files rename to toolkit/mozapps/update/tests/data/partial_removed-files diff --git a/toolkit/mozapps/update/test/unit/data/partial_update_manifest b/toolkit/mozapps/update/tests/data/partial_update_manifest similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_update_manifest rename to toolkit/mozapps/update/tests/data/partial_update_manifest diff --git a/toolkit/mozapps/update/test/unit/data/partial_win.mar b/toolkit/mozapps/update/tests/data/partial_win.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/partial_win.mar rename to toolkit/mozapps/update/tests/data/partial_win.mar diff --git a/toolkit/mozapps/update/test/unit/data/simple.mar b/toolkit/mozapps/update/tests/data/simple.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/simple.mar rename to toolkit/mozapps/update/tests/data/simple.mar diff --git a/toolkit/mozapps/update/test/unit/data/simple_no_pib.mar b/toolkit/mozapps/update/tests/data/simple_no_pib.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/simple_no_pib.mar rename to toolkit/mozapps/update/tests/data/simple_no_pib.mar diff --git a/toolkit/mozapps/update/test/unit/data/wrong_product_channel_mar.mar b/toolkit/mozapps/update/tests/data/wrong_product_channel.mar similarity index 100% rename from toolkit/mozapps/update/test/unit/data/wrong_product_channel_mar.mar rename to toolkit/mozapps/update/tests/data/wrong_product_channel.mar diff --git a/toolkit/mozapps/update/test/marionette/data/bad.xml b/toolkit/mozapps/update/tests/marionette/data/bad.xml similarity index 100% rename from toolkit/mozapps/update/test/marionette/data/bad.xml rename to toolkit/mozapps/update/tests/marionette/data/bad.xml diff --git a/toolkit/mozapps/update/test/marionette/data/err.cgi b/toolkit/mozapps/update/tests/marionette/data/err.cgi similarity index 100% rename from toolkit/mozapps/update/test/marionette/data/err.cgi rename to toolkit/mozapps/update/tests/marionette/data/err.cgi diff --git a/toolkit/mozapps/update/test/marionette/update-smoketests.ini b/toolkit/mozapps/update/tests/marionette/update-smoketests.ini similarity index 100% rename from toolkit/mozapps/update/test/marionette/update-smoketests.ini rename to toolkit/mozapps/update/tests/marionette/update-smoketests.ini diff --git a/toolkit/mozapps/update/test/marionette/update-tests.ini b/toolkit/mozapps/update/tests/marionette/update-tests.ini similarity index 100% rename from toolkit/mozapps/update/test/marionette/update-tests.ini rename to toolkit/mozapps/update/tests/marionette/update-tests.ini diff --git a/toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js b/toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.js similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.js rename to toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.js diff --git a/toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.py b/toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.py similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_smoketest_ota_same_version.py rename to toolkit/mozapps/update/tests/marionette/update_smoketest_ota_same_version.py diff --git a/toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.js b/toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.js similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.js rename to toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.js diff --git a/toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.py b/toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.py similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_smoketest_ota_simple.py rename to toolkit/mozapps/update/tests/marionette/update_smoketest_ota_simple.py diff --git a/toolkit/mozapps/update/test/marionette/update_test_ota_simple.js b/toolkit/mozapps/update/tests/marionette/update_test_ota_simple.js similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_test_ota_simple.js rename to toolkit/mozapps/update/tests/marionette/update_test_ota_simple.js diff --git a/toolkit/mozapps/update/test/marionette/update_test_ota_simple.py b/toolkit/mozapps/update/tests/marionette/update_test_ota_simple.py similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_test_ota_simple.py rename to toolkit/mozapps/update/tests/marionette/update_test_ota_simple.py diff --git a/toolkit/mozapps/update/test/marionette/update_test_status.js b/toolkit/mozapps/update/tests/marionette/update_test_status.js similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_test_status.js rename to toolkit/mozapps/update/tests/marionette/update_test_status.js diff --git a/toolkit/mozapps/update/test/marionette/update_test_status.py b/toolkit/mozapps/update/tests/marionette/update_test_status.py similarity index 100% rename from toolkit/mozapps/update/test/marionette/update_test_status.py rename to toolkit/mozapps/update/tests/marionette/update_test_status.py diff --git a/toolkit/mozapps/update/test/moz.build b/toolkit/mozapps/update/tests/moz.build similarity index 67% rename from toolkit/mozapps/update/test/moz.build rename to toolkit/mozapps/update/tests/moz.build index bfb31ff2be9e..629ddf6b2d9c 100644 --- a/toolkit/mozapps/update/test/moz.build +++ b/toolkit/mozapps/update/tests/moz.build @@ -4,8 +4,14 @@ # 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/. +XPCSHELL_TESTS_MANIFESTS += ['unit_aus_update/xpcshell.ini'] + if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': - DIRS += ['chrome'] + MOCHITEST_CHROME_MANIFESTS += ['chrome/chrome.ini'] + XPCSHELL_TESTS_MANIFESTS += ['unit_base_updater/xpcshell.ini'] + + if CONFIG['MOZ_MAINTENANCE_SERVICE']: + XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini'] sources = [ 'TestAUSHelper', @@ -20,5 +26,3 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android': SIMPLE_PROGRAMS += [ '%s%s' % (s, bin_suffix) for s in sources ] - -XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] diff --git a/toolkit/mozapps/update/test/shared.js b/toolkit/mozapps/update/tests/shared.js similarity index 100% rename from toolkit/mozapps/update/test/shared.js rename to toolkit/mozapps/update/tests/shared.js diff --git a/toolkit/mozapps/update/test/sharedUpdateXML.js b/toolkit/mozapps/update/tests/sharedUpdateXML.js similarity index 97% rename from toolkit/mozapps/update/test/sharedUpdateXML.js rename to toolkit/mozapps/update/tests/sharedUpdateXML.js index f28988cd0c80..f4e333b77907 100644 --- a/toolkit/mozapps/update/test/sharedUpdateXML.js +++ b/toolkit/mozapps/update/tests/sharedUpdateXML.js @@ -50,8 +50,6 @@ const STATE_SUCCEEDED = "succeeded"; const STATE_DOWNLOAD_FAILED = "download-failed"; const STATE_FAILED = "failed"; -var gTestserverPort; - /** * Constructs a string representing a remote update xml file. * @@ -306,8 +304,7 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion, let detailsURL = "detailsURL=\"" + (aDetailsURL ? aDetailsURL : "http://test_details/") + "\" "; - let billboardURL = aBillboardURL ? "billboardURL=\"" + - aBillboardURL + "\" " + let billboardURL = aBillboardURL ? "billboardURL=\"" + aBillboardURL + "\" " : ""; let licenseURL = aLicenseURL ? "licenseURL=\"" + aLicenseURL + "\" " : ""; let showPrompt = aShowPrompt ? "showPrompt=\"" + aShowPrompt + "\" " : ""; @@ -346,8 +343,7 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion, * @param aURL (optional) * The patch's url to the mar file. * If not specified it will default to the value of: - * URL_HOST + (gTestserverPort ? ":" + gTestserverPort : "") + "/" + - * URL_PATH + "/" + FILE_SIMPLE_MAR + * gURLData + FILE_SIMPLE_MAR * @param aHashFunction (optional) * The patch's hash function used to verify the mar file. * If not specified it will default to 'MD5'. @@ -363,9 +359,7 @@ function getUpdateString(aType, aName, aDisplayVersion, aAppVersion, */ function getPatchString(aType, aURL, aHashFunction, aHashValue, aSize) { let type = aType ? aType : "complete"; - let url = aURL ? aURL : URL_HOST + - (gTestserverPort ? ":" + gTestserverPort : "") + - "/" + URL_PATH + "/" + FILE_SIMPLE_MAR; + let url = aURL ? aURL : gURLData + FILE_SIMPLE_MAR; let hashFunction = aHashFunction ? aHashFunction : "MD5"; let hashValue = aHashValue ? aHashValue : MD5_HASH_SIMPLE_MAR; let size = aSize ? aSize : SIZE_SIMPLE_MAR; diff --git a/toolkit/mozapps/update/test/unit/test_0010_general.js b/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js similarity index 81% rename from toolkit/mozapps/update/test/unit/test_0010_general.js rename to toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js index 8bb3b3a102b2..e44d4a7674eb 100644 --- a/toolkit/mozapps/update/test/unit/test_0010_general.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/canCheckForAndCanApplyUpdates.js @@ -3,19 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Service Tests */ - -const TEST_ID = "0010"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); // Verify write access to the custom app dir logTestInfo("testing write access to the application directory"); - removeUpdateDirsAndFiles(); var testFile = getCurrentProcessDir(); testFile.append("update_write_access_test"); testFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, 0644); @@ -31,10 +23,9 @@ function run_test() { // Check if updates can be applied logTestInfo("testing nsIApplicationUpdateService:canApplyUpdates"); do_check_true(gAUS.canApplyUpdates); - do_test_finished(); } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0063_manager.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js similarity index 86% rename from toolkit/mozapps/update/test/unit/test_0063_manager.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js index 99e547e8dbea..4bc89c307ab1 100644 --- a/toolkit/mozapps/update/test/unit/test_0063_manager.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForDifferentChannel.js @@ -5,20 +5,13 @@ /* General Update Manager Tests */ -const TEST_ID = "0063"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing removal of an active update for a channel that is not" + - "valid due to switching channels (bug 486275)"); - removeUpdateDirsAndFiles(); + "valid due to switching channels (Bug 486275)."); var patches, updates, update; - patches = getLocalPatchString(null, null, null, null, null, null, STATE_DOWNLOADING); updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0"); @@ -51,5 +44,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0061_manager.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js similarity index 75% rename from toolkit/mozapps/update/test/unit/test_0061_manager.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js index 17806c166055..f06fad8e9395 100644 --- a/toolkit/mozapps/update/test/unit/test_0061_manager.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForOlderAppVersion.js @@ -3,19 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Manager Tests */ - -const TEST_ID = "0061"; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - logTestInfo("testing removal of an update download in progress for an " + - "older version of the application on startup (bug 485624)"); - removeUpdateDirsAndFiles(); + logTestInfo("testing cleanup of an update download in progress for an " + + "older version of the application on startup (Bug 485624)"); var patches, updates; @@ -43,5 +36,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0064_manager.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js similarity index 82% rename from toolkit/mozapps/update/test/unit/test_0064_manager.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js index 5b45e45b52cc..e460dfb86e50 100644 --- a/toolkit/mozapps/update/test/unit/test_0064_manager.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingForSameVersionAndBuildID.js @@ -3,20 +3,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Manager Tests */ - -const TEST_ID = "0064"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing removal of an update download in progress for the " + "same version of the application with the same application " + - "build id on startup (bug 536547)"); - removeUpdateDirsAndFiles(); + "build id on startup (Bug 536547)"); var patches, updates; @@ -45,5 +37,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js similarity index 73% rename from toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js index 73b8b43941dd..22deffaa0358 100644 --- a/toolkit/mozapps/update/test/unit/test_0072_update_dir_cleanup.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupDownloadingIncorrectStatus.js @@ -2,17 +2,12 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* General Update Directory Cleanup Tests - Bug 539717 */ - -const TEST_ID = "0072"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); + logTestInfo("testing update cleanup when reading the status file returns " + + "STATUS_NONE and the update xml has an update with " + + "STATE_DOWNLOADING (Bug 539717)."); writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); var patches = getLocalPatchString(null, null, null, null, null, null, @@ -33,12 +28,14 @@ function run_test() { logTestInfo("testing " + statusFile.path + " should not exist"); do_check_false(statusFile.exists()); + logTestInfo("testing activeUpdate == null"); do_check_eq(gUpdateManager.activeUpdate, null); + logTestInfo("testing updateCount == 0"); do_check_eq(gUpdateManager.updateCount, 0); do_test_finished(); } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0073_update_dir_cleanup.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js similarity index 70% rename from toolkit/mozapps/update/test/unit/test_0073_update_dir_cleanup.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js index a464107a19d2..3ffb35902a5b 100644 --- a/toolkit/mozapps/update/test/unit/test_0073_update_dir_cleanup.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupPendingVersionFileIncorrectStatus.js @@ -2,17 +2,12 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* General Update Directory Cleanup Tests - Bug 601701 */ - -const TEST_ID = "0073"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); + logTestInfo("testing update cleanup when reading the status file returns " + + "STATUS_NONE, the version file is for a newer version, and the " + + "update xml has an update with STATE_PENDING (Bug 601701)."); writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); var patches = getLocalPatchString(null, null, null, null, null, null, @@ -24,8 +19,10 @@ function run_test() { standardInit(); // Check that there is no activeUpdate first so the updates directory is - // cleaned before the remaining tests. + // cleaned up by the UpdateManager before the remaining tests. + logTestInfo("testing activeUpdate == null"); do_check_eq(gUpdateManager.activeUpdate, null); + logTestInfo("testing updateCount == 0"); do_check_eq(gUpdateManager.updateCount, 0); var dir = getUpdatesDir(); @@ -42,5 +39,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js index 4f7d8d26e2c2..e5daecc236e6 100644 --- a/toolkit/mozapps/update/test/unit/test_0070_update_dir_cleanup.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogMove.js @@ -3,17 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Directory Cleanup Tests */ - -const TEST_ID = "0070"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); + logTestInfo("testing that the update.log is moved after a successful update"); writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); var patches = getLocalPatchString(null, null, null, null, null, null, @@ -54,5 +47,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0071_update_dir_cleanup.js b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0071_update_dir_cleanup.js rename to toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js index 5350da62d992..2e25bcae7ec0 100644 --- a/toolkit/mozapps/update/test/unit/test_0071_update_dir_cleanup.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/cleanupSuccessLogsFIFO.js @@ -3,17 +3,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Directory Cleanup Tests */ - -const TEST_ID = "0071"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); + logTestInfo("testing update logs are first in first out deleted"); writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); var patches = getLocalPatchString(null, null, null, null, null, null, @@ -65,5 +58,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_bug595059.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js similarity index 78% rename from toolkit/mozapps/update/test/unit/test_bug595059.js rename to toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js index 68ffcfe19224..c525439de9dc 100644 --- a/toolkit/mozapps/update/test/unit/test_bug595059.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadCompleteAfterPartialFailure.js @@ -2,25 +2,14 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/** - * Bug 595059 - begin download of a complete update after a failure applying a - * partial update. - */ - -const TEST_ID = "bug595059"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - logTestInfo("testing Bug 595059 - calling nsIUpdatePrompt::showUpdateError " + - "should call getNewPrompter and alert on the object returned " + - "by getNewPrompter when the update.state = " + STATE_FAILED + - " and the update.errorCode = " + WRITE_ERROR); - - removeUpdateDirsAndFiles(); + logTestInfo("testing download a complete on partial failure. Calling " + + "nsIUpdatePrompt::showUpdateError should call getNewPrompter " + + "and alert on the object returned by getNewPrompter when the " + + "update.state == " + STATE_FAILED + " and the update.errorCode " + + "== " + WRITE_ERROR + " (Bug 595059)."); let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar); registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), @@ -31,7 +20,7 @@ function run_test() { standardInit(); writeUpdatesToXMLFile(getLocalUpdatesXMLString(""), false); - let url = URL_HOST + URL_PATH + "/complete.mar"; + let url = URL_HOST + "/" + FILE_COMPLETE_MAR; let patches = getLocalPatchString("complete", url, null, null, null, null, STATE_FAILED); let updates = getLocalUpdateString(patches, null, null, "version 1.0", "1.0", @@ -52,7 +41,7 @@ function end_test() { let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar); registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), WindowWatcherFactory); - cleanUp(); + cleanupTestCommon(); } var WindowWatcher = { diff --git a/toolkit/mozapps/update/test/unit/test_bug833708.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js similarity index 88% rename from toolkit/mozapps/update/test/unit/test_bug833708.js rename to toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js index 4f68c62fb6b7..0358a91c7010 100644 --- a/toolkit/mozapps/update/test/unit/test_bug833708.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadFileTooBig_gonk.js @@ -3,9 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -AUS_Cu.import("resource://gre/modules/FileUtils.jsm"); - -const TEST_ID = "bug794211"; const KEY_UPDATE_ARCHIVE_DIR = "UpdArchD" let gActiveUpdate = null; @@ -26,19 +23,14 @@ FakeDirProvider.prototype = { }; function run_test() { - do_test_pending(); - DEBUG_AUS_TEST = true; + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); setUpdateURLOverride(); overrideXHR(xhr_pt1); standardInit(); logTestInfo("testing that error codes set from a directory provider propagate" + - "up to AUS.downloadUpdate() correctly"); + "up to AUS.downloadUpdate() correctly (Bug 794211)."); gDirProvider = new FakeDirProvider(); gOldProvider = AUS_Cc["@mozilla.org/browser/directory-provider;1"] @@ -100,5 +92,5 @@ function end_test() { gDirService = null; gDirProvider = null; - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_bug794211.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_bug794211.js rename to toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js index 6fa040fd460b..fc28faf8a08f 100644 --- a/toolkit/mozapps/update/test/unit/test_bug794211.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadInterruptedByOfflineRetry.js @@ -3,23 +3,16 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* Offline retry test (Bug 794211) */ - -const TEST_ID = "bug794211"; - // Needs to be in sync w/ nsUpdateService.js const NETWORK_ERROR_OFFLINE = 111; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + logTestInfo("testing when an update check fails because the network is " + + "offline that we check again when the network comes online " + + "(Bug 794211)."); - logTestInfo("test when an update check fails because the network is " + - "offline that we check again when the network comes online. " + - "(Bug 794211)"); - removeUpdateDirsAndFiles(); setUpdateURLOverride(); Services.prefs.setBoolPref(PREF_APP_UPDATE_AUTO, false); @@ -85,5 +78,5 @@ function check_test_pt2(update) { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0030_general.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadMar.js similarity index 94% rename from toolkit/mozapps/update/test/unit/test_0030_general.js rename to toolkit/mozapps/update/tests/unit_aus_update/downloadMar.js index 17485e7ffd87..777a33000b1a 100644 --- a/toolkit/mozapps/update/test/unit/test_0030_general.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadMar.js @@ -5,12 +5,7 @@ /* General MAR File Download Tests */ -const TEST_ID = "0030"; - const INC_CONTRACT_ID = "@mozilla.org/network/incremental-download;1"; -AUS_Cu.import("resource://gre/modules/FileUtils.jsm"); -AUS_Cu.import("resource://gre/modules/Services.jsm"); -AUS_Cu.import("resource://gre/modules/XPCOMUtils.jsm") var gNextRunFunc; var gStatusResult; @@ -22,16 +17,15 @@ var gIncrementalDownloadClassID, gIncOldFactory; var gIncrementalDownloadErrorType = 0; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + logTestInfo("testing mar downloads, mar hash verification, and " + + "mar download interrupted recovery"); Services.prefs.setBoolPref(PREF_APP_UPDATE_STAGING_ENABLED, false); - removeUpdateDirsAndFiles(); // The HTTP server is only used for the mar file downloads since it is slow - start_httpserver(URL_PATH); - setUpdateURLOverride(URL_HOST + ":" + gTestserverPort + "/update.xml"); + start_httpserver(); + setUpdateURLOverride(gURLData + "update.xml"); // The mock XMLHttpRequest is MUCH faster overrideXHR(callHandleEvent); standardInit(); @@ -45,7 +39,7 @@ function finish_test() { function end_test() { cleanupMockIncrementalDownload(); - cleanUp(); + cleanupTestCommon(); } // Callback function used by the custom XMLHttpRequest implementation to @@ -206,8 +200,7 @@ function run_test_pt10() { // mar download with the mar not found function run_test_pt11() { - var patches = getRemotePatchString(null, URL_HOST + ":" + gTestserverPort + - "/" + URL_PATH + "/missing.mar"); + var patches = getRemotePatchString(null, gURLData + "missing.mar"); var updates = getRemoteUpdateString(patches); gResponseBody = getRemoteUpdatesXMLString(updates); run_test_helper_pt1("mar download with the mar not found", @@ -254,8 +247,6 @@ function initMockIncrementalDownload() { var components = [IncrementalDownload]; registrar.registerFactory(gIncrementalDownloadClassID, "", INC_CONTRACT_ID, newFactory); - gIncOldFactory = AUS_Cm.getClassObject(AUS_Cc[INC_CONTRACT_ID], - AUS_Ci.nsIFactory); } function cleanupMockIncrementalDownload() { @@ -297,7 +288,7 @@ IncrementalDownload.prototype = { this._observer = observer.QueryInterface(AUS_Ci.nsIRequestObserver); this._ctxt = ctxt; this._observer.onStartRequest(this, this.ctxt); - let mar = do_get_file("data/" + FILE_SIMPLE_MAR); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(this._destination.parent, this._destination.leafName); var status = AUS_Cr.NS_OK switch (gIncrementalDownloadErrorType++) { diff --git a/toolkit/mozapps/update/test/unit/test_0062_manager.js b/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js similarity index 78% rename from toolkit/mozapps/update/test/unit/test_0062_manager.js rename to toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js index 56f91aee2e75..03827297bc63 100644 --- a/toolkit/mozapps/update/test/unit/test_0062_manager.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/downloadResumeForSameAppVersion.js @@ -3,19 +3,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Manager Tests */ - -const TEST_ID = "0062"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing resuming an update download in progress for the same " + - "version of the application on startup (bug 485624)"); - removeUpdateDirsAndFiles(); + "version of the application on startup (Bug 485624)"); var patches, updates; @@ -42,5 +34,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/head_update.js.in b/toolkit/mozapps/update/tests/unit_aus_update/head_update.js similarity index 91% rename from toolkit/mozapps/update/test/unit/head_update.js.in rename to toolkit/mozapps/update/tests/unit_aus_update/head_update.js index cd9ead6ec1e3..63ac070ab74d 100644 --- a/toolkit/mozapps/update/test/unit/head_update.js.in +++ b/toolkit/mozapps/update/tests/unit_aus_update/head_update.js @@ -65,32 +65,35 @@ const IS_MAR_CHECKS_ENABLED = false; #endif const URL_HOST = "http://localhost"; -const URL_PATH = "data"; const APPLY_TO_DIR_SUFFIX = "_applyToDir/"; +const UPDATES_DIR_SUFFIX = "_mar"; #ifdef XP_MACOSX const UPDATED_DIR_SUFFIX = "Updated.app/"; #else const UPDATED_DIR_SUFFIX = "updated/"; #endif -const HELPER_BIN_FILE = "TestAUSHelper" + BIN_SUFFIX; -const MAR_COMPLETE_FILE = "data/complete.mar"; -const MAR_PARTIAL_FILE = "data/partial.mar"; -const MAR_OLD_VERSION_FILE = "data/old_version_mar.mar"; -const MAR_WRONG_CHANNEL_FILE = "data/wrong_product_channel_mar.mar"; -const UPDATER_BIN_FILE = "updater" + BIN_SUFFIX; -const MAINTENANCE_SERVICE_BIN_FILE = "maintenanceservice.exe"; -const MAINTENANCE_SERVICE_INSTALLER_BIN_FILE = "maintenanceservice_installer.exe"; -const UPDATES_DIR_SUFFIX = "_mar"; -const LOG_COMPLETE_SUCCESS = "data/complete_log_success"; -const LOG_COMPLETE_SWITCH_SUCCESS = "data/complete_log_switch_success" -const LOG_COMPLETE_CC_SUCCESS = "data/complete_cc_log_success"; -const LOG_COMPLETE_CC_SWITCH_SUCCESS = "data/complete_cc_log_switch_success"; +const FILE_COMPLETE_MAR = "complete.mar"; +const FILE_COMPLETE_WIN_MAR = "complete_win.mar"; +const FILE_HELPER_BIN = "TestAUSHelper" + BIN_SUFFIX; +const FILE_MAINTENANCE_SERVICE_BIN = "maintenanceservice.exe"; +const FILE_MAINTENANCE_SERVICE_INSTALLER_BIN = "maintenanceservice_installer.exe"; +const FILE_OLD_VERSION_MAR = "old_version.mar"; +const FILE_PARTIAL_MAR = "partial.mar"; +const FILE_PARTIAL_WIN_MAR = "partial_win.mar"; +const FILE_UPDATER_BIN = "updater" + BIN_SUFFIX; +const FILE_UPDATER_INI_BAK = "updater.ini.bak"; +const FILE_WRONG_CHANNEL_MAR = "wrong_product_channel.mar"; -const LOG_PARTIAL_SUCCESS = "data/partial_log_success"; -const LOG_PARTIAL_SWITCH_SUCCESS = "data/partial_log_switch_success"; -const LOG_PARTIAL_FAILURE = "data/partial_log_failure"; +const LOG_COMPLETE_SUCCESS = "complete_log_success"; +const LOG_COMPLETE_SWITCH_SUCCESS = "complete_log_switch_success" +const LOG_COMPLETE_CC_SUCCESS = "complete_cc_log_success"; +const LOG_COMPLETE_CC_SWITCH_SUCCESS = "complete_cc_log_switch_success"; + +const LOG_PARTIAL_SUCCESS = "partial_log_success"; +const LOG_PARTIAL_SWITCH_SUCCESS = "partial_log_switch_success"; +const LOG_PARTIAL_FAILURE = "partial_log_failure"; const ERR_CALLBACK_FILE_IN_USE = "NS_main: file in use - failed to " + "exclusively open executable file:" @@ -101,12 +104,10 @@ const ERR_BACKUP_DISCARD = "backup_discard: unable to remove"; const LOG_SVC_SUCCESSFUL_LAUNCH = "Process was started... waiting on result."; -// variables are used instead of contants so tests can override these values -var gCallbackBinFile = "callback_app" + BIN_SUFFIX; -var gCallbackArgs = ["./", "callback.log", "Test Arg 2", "Test Arg 3"]; -var gBackgroundUpdate = false; -var gSwitchApp = false; -var gDisableReplaceFallback = false; +// All we care about is that the last modified time has changed so that Mac OS +// X Launch Services invalidates its cache so the test allows up to one minute +// difference in the last modified time. +const MAC_MAX_TIME_DIFFERENCE = 60000; // Time to wait for the test helper process before continuing the test const TEST_HELPER_TIMEOUT = 100; @@ -117,10 +118,19 @@ const TEST_CHECK_TIMEOUT = 100; // How many of TEST_CHECK_TIMEOUT to wait before we abort the test. const MAX_TIMEOUT_RUNS = 1000; +// Maximum number of milliseconds the process that is launched can run before +// the test will try to kill it. +const APP_TIMER_TIMEOUT = 120000; + // Use a copy of the main application executable for the test to avoid main // executable in use errors. const FILE_WIN_TEST_EXE = "_aus_test_app.exe"; +// This default value will be overridden when using the http server. +var gURLData = URL_HOST + "/"; + +var gTestID; + var gTestserver; var gXHR; @@ -138,6 +148,15 @@ var gUpdates; var gStatusCode; var gStatusText; +// Variables are used instead of contants so tests can override these values +var gCallbackBinFile = "callback_app" + BIN_SUFFIX; +var gCallbackArgs = ["./", "callback.log", "Test Arg 2", "Test Arg 3"]; +var gBackgroundUpdate = false; +var gSwitchApp = false; +var gDisableReplaceFallback = false; + +var gTimeoutRuns = 0; + /** * The mar files used for the updater tests contain the following remove * operations. @@ -320,10 +339,28 @@ if (APP_BIN_NAME == "xulrunner") { } } +function setupTestCommon(aAdjustGeneralPaths) { + do_test_pending(); + + if (gTestID) { + do_throw("should only be called once!"); + } + + let caller = Components.stack.caller; + gTestID = caller.filename.toString().split("/").pop().split(".")[0]; + + if (aAdjustGeneralPaths) { + // adjustGeneralPaths registers a cleanup function that calls end_test. + adjustGeneralPaths(); + } + + removeUpdateDirsAndFiles(); +} + /** * Nulls out the most commonly used global vars used by tests as appropriate. */ -function cleanUp() { +function cleanupTestCommon() { logTestInfo("start - general test cleanup"); removeUpdateDirsAndFiles(); @@ -401,25 +438,48 @@ function pathHandler(metadata, response) { * @return The relative path to the directory where the update will be applied. */ function getApplyDirPath() { - return TEST_ID + APPLY_TO_DIR_SUFFIX + "appdir/"; + return gTestID + APPLY_TO_DIR_SUFFIX + "appdir/"; } /** - * Helper function for getting the nsIFile for the directory where the update - * will be applied. + * Helper function for getting the nsIFile for a file in the directory where the + * update will be applied. * - * The main files in the update are located two directories below the apply to + * The files for the update are located two directories below the apply to * directory since Mac OS X sets the last modified time for the root directory * to the current time and if the update changes any files in the root directory * then it wouldn't be possible to test (bug 600098). * - * @return The nsIFile for the directory where the update will be applied. + * @return The nsIFile for the file in the directory where the update will be + * applied. */ function getApplyDirFile(aRelPath, allowNonexistent) { let relpath = getApplyDirPath() + (aRelPath ? aRelPath : ""); return do_get_file(relpath, allowNonexistent); } +/** + * Helper function for getting the relative path to the directory where the + * test data files are located. + * + * @return The relative path to the directory where the test data files are + * located. + */ +function getTestDirPath() { + return "../data/"; +} + +/** + * Helper function for getting the nsIFile for a file in the test data + * directory. + * + * @return The nsIFile for the file in the test data directory. + */ +function getTestDirFile(aRelPath) { + let relpath = getTestDirPath() + (aRelPath ? aRelPath : ""); + return do_get_file(relpath, false); +} + /** * Helper function for getting the updated directory. */ @@ -506,7 +566,7 @@ function copyMinimumAppFiles(aSrcDir, aDestDir, aDestLeafName) { // Required files for the application or the test that aren't listed in the // dependentlibs.list file. - let fileLeafNames = [APP_BIN_NAME + APP_BIN_SUFFIX, UPDATER_BIN_FILE, + let fileLeafNames = [APP_BIN_NAME + APP_BIN_SUFFIX, FILE_UPDATER_BIN, FILE_UPDATE_SETTINGS_INI, "application.ini", "dependentlibs.list"]; @@ -555,13 +615,13 @@ function runUpdate() { updater.append("updater.app"); if (!updater.exists()) { updater = binDir.clone(); - updater.append(UPDATER_BIN_FILE); + updater.append(FILE_UPDATER_BIN); if (!updater.exists()) { do_throw("Unable to find updater binary!"); } } - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); updater.copyTo(updatesDir, updater.leafName); let updateBin = updatesDir.clone(); updateBin.append(updater.leafName); @@ -679,7 +739,7 @@ function shouldRunServiceTest(aFirstTest) { let binDir = getGREDir(); let updaterBin = binDir.clone(); - updaterBin.append(UPDATER_BIN_FILE); + updaterBin.append(FILE_UPDATER_BIN); if (!updaterBin.exists()) { do_throw("Unable to find updater binary!"); } @@ -690,7 +750,7 @@ function shouldRunServiceTest(aFirstTest) { } // Check to make sure the service is installed - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let args = ["wait-for-service-stop", "MozillaMaintenance", "10"]; let process = AUS_Cc["@mozilla.org/process/util;1"]. createInstance(AUS_Ci.nsIProcess); @@ -726,7 +786,7 @@ function shouldRunServiceTest(aFirstTest) { return true; } logTestInfo("this test can only run on builds with signed binaries. " + - HELPER_BIN_FILE + " returned " + process.exitValue) + FILE_HELPER_BIN + " returned " + process.exitValue) return false; #endif } @@ -768,9 +828,9 @@ function attemptServiceInstall() { let binDir = getGREDir(); let installerFile = binDir.clone(); - installerFile.append(MAINTENANCE_SERVICE_INSTALLER_BIN_FILE); + installerFile.append(FILE_MAINTENANCE_SERVICE_INSTALLER_BIN); if (!installerFile.exists()) { - do_throw(MAINTENANCE_SERVICE_INSTALLER_BIN_FILE + " not found."); + do_throw(FILE_MAINTENANCE_SERVICE_INSTALLER_BIN + " not found."); } let installerProcess = AUS_Cc["@mozilla.org/process/util;1"]. createInstance(AUS_Ci.nsIProcess); @@ -820,7 +880,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, logTestInfo("Waiting for service to stop if necessary..."); // Use the helper bin to ensure the service is stopped. If not // stopped then wait for the service to be stopped (at most 120 seconds) - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperBinArgs = ["wait-for-service-stop", "MozillaMaintenance", "120"]; @@ -850,7 +910,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, "necessary..."); // Use the helper bin to ensure the application is stopped. // If not, then wait for it to be stopped (at most 120 seconds) - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperBinArgs = ["wait-for-application-exit", application, "120"]; @@ -904,7 +964,7 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, let appArgsLogPath = getAppArgsLogPath(); gServiceLaunchedCallbackLog = appArgsLogPath.replace(/^"|"$/g, ""); - let updatesDir = aUpdatesDir || do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = aUpdatesDir || do_get_file(gTestID + UPDATES_DIR_SUFFIX); let file = updatesDir.clone(); file.append(FILE_UPDATE_STATUS); writeFile(file, aInitialStatus + "\n"); @@ -946,14 +1006,14 @@ function runUpdateUsingService(aInitialStatus, aExpectedStatus, // There is a security check done by the service to make sure the updater // we are executing is the same as the one in the apply-to dir. // To make sure they match from tests we copy updater.exe to the apply-to dir. - copyBinToApplyToDir(UPDATER_BIN_FILE); + copyBinToApplyToDir(FILE_UPDATER_BIN); // The service will execute maintenanceservice_installer.exe and // will copy maintenanceservice.exe out of the same directory from // the installation directory. So we need to make sure both of those // bins always exist in the installation directory. - copyBinToApplyToDir(MAINTENANCE_SERVICE_BIN_FILE); - copyBinToApplyToDir(MAINTENANCE_SERVICE_INSTALLER_BIN_FILE); + copyBinToApplyToDir(FILE_MAINTENANCE_SERVICE_BIN); + copyBinToApplyToDir(FILE_MAINTENANCE_SERVICE_INSTALLER_BIN); // Backup the updater-settings.ini file if it exists by moving it. let updateSettingsIni = getApplyDirFile(null, true); @@ -1102,7 +1162,7 @@ function setupHelperFinish() { */ function setupUpdaterTest(aMarFile) { // Remove the directory where the updater, mar file, etc. will be copied to - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); try { removeDirRecursive(updatesDir); } @@ -1139,7 +1199,7 @@ function setupUpdaterTest(aMarFile) { let testFile; if (aTestFile.originalFile) { - testFile = do_get_file(aTestFile.originalFile); + testFile = getTestDirFile(aTestFile.originalFile); testFile.copyTo(testDir, aTestFile.fileName); testFile = getApplyDirFile(aTestFile.relPathDir + aTestFile.fileName); } @@ -1160,12 +1220,12 @@ function setupUpdaterTest(aMarFile) { } }); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let afterApplyBinDir = getApplyDirFile("a/b/", true); helperBin.copyTo(afterApplyBinDir, gCallbackBinFile); // Copy the mar that will be applied - let mar = do_get_file(aMarFile); + let mar = getTestDirFile(aMarFile); mar.copyTo(updatesDir, FILE_UPDATE_ARCHIVE); // Add the test directory that will be updated for a successful update or left in @@ -1181,7 +1241,7 @@ function setupUpdaterTest(aMarFile) { aTestDir.files.forEach(function SUT_TD_F_FE(aTestFile) { let testFile = getApplyDirFile(aTestDir.relPathDir + aTestFile, true); if (!testFile.exists()) { - testFile.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE); + testFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE); } }); } @@ -1197,7 +1257,7 @@ function setupUpdaterTest(aMarFile) { aTestDir.subDirFiles.forEach(function SUT_TD_SDF_FE(aTestFile) { let testFile = getApplyDirFile(aTestDir.relPathDir + aSubDir + aTestFile, true); if (!testFile.exists()) { - testFile.create(AUS_Ci.nsIFile.FILE_TYPE, PERMS_FILE); + testFile.create(AUS_Ci.nsIFile.NORMAL_FILE_TYPE, PERMS_FILE); } }); } @@ -1211,7 +1271,8 @@ function setupUpdaterTest(aMarFile) { * has finished. */ function cleanupUpdaterTest() { - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + logTestInfo("start - updater test cleanup"); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); try { removeDirRecursive(updatesDir); } @@ -1232,7 +1293,8 @@ function cleanupUpdaterTest() { "Exception: " + e + "\n"); } - cleanUp(); + cleanupTestCommon(); + logTestInfo("finish - updater test cleanup"); } /** @@ -1240,7 +1302,7 @@ function cleanupUpdaterTest() { * update log after a successful update. */ function checkUpdateLogContents(aCompareLogFile) { - let updateLog = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updateLog = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); updateLog.append(FILE_UPDATE_LOG); let updateLogContents = readFileBytes(updateLog); if (gBackgroundUpdate) { @@ -1280,20 +1342,36 @@ function checkUpdateLogContents(aCompareLogFile) { // Remove leading and trailing newlines updateLogContents = updateLogContents.replace(/^\n|\n$/g, ""); - let compareLog = do_get_file(aCompareLogFile); + let compareLog = getTestDirFile(aCompareLogFile); let compareLogContents = readFileBytes(compareLog); // Remove leading and trailing newlines compareLogContents = compareLogContents.replace(/^\n|\n$/g, ""); - do_check_eq(compareLogContents, updateLogContents); + // Don't write the contents of the file to the log to reduce log spam + // unless there is a failure. + if (compareLogContents == updateLogContents) { + logTestInfo("log contents are correct"); + do_check_true(true); + } + else { + logTestInfo("log contents are not correct"); + do_check_eq(compareLogContents, updateLogContents); + } } function checkUpdateLogContains(aCheckString) { - let updateLog = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updateLog = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); updateLog.append(FILE_UPDATE_LOG); let updateLogContents = readFileBytes(updateLog); - logTestInfo("log file contents:\n" + updateLogContents + "\n"); - do_check_true(updateLogContents.indexOf(aCheckString) != -1); + if (updateLogContents.indexOf(aCheckString) != -1) { + logTestInfo("log file does contain: " + aCheckString); + do_check_true(true); + } + else { + logTestInfo("log file does not contain: " + aCheckString); + logTestInfo("log file contents:\n" + updateLogContents); + do_check_true(false); + } } /** @@ -1322,12 +1400,19 @@ function checkFilesAfterUpdateSuccess() { do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff); } - if (aTestFile.compareFile) { - do_check_eq(readFileBytes(testFile), - readFileBytes(do_get_file(aTestFile.compareFile))); + let fileContents1 = readFileBytes(testFile); + let fileContents2 = aTestFile.compareFile ? + readFileBytes(getTestDirFile(aTestFile.compareFile)) : + aTestFile.compareContents; + // Don't write the contents of the file to the log to reduce log spam + // unless there is a failure. + if (fileContents1 == fileContents2) { + logTestInfo("file contents are correct"); + do_check_true(true); } else { - do_check_eq(readFileBytes(testFile), aTestFile.compareContents); + logTestInfo("file contents are not correct"); + do_check_eq(fileContents1, fileContents2); } } else { @@ -1410,12 +1495,19 @@ function checkFilesAfterUpdateFailure(aGetDirectory) { do_check_eq(testFile.permissions & 0xfff, aTestFile.comparePerms & 0xfff); } - if (aTestFile.compareFile) { - do_check_eq(readFileBytes(testFile), - readFileBytes(do_get_file(aTestFile.compareFile))); + let fileContents1 = readFileBytes(testFile); + let fileContents2 = aTestFile.compareFile ? + readFileBytes(getTestDirFile(aTestFile.compareFile)) : + aTestFile.compareContents; + // Don't write the contents of the file to the log to reduce log spam + // unless there is a failure. + if (fileContents1 == fileContents2) { + logTestInfo("file contents are correct"); + do_check_true(true); } else { - do_check_eq(readFileBytes(testFile), aTestFile.compareContents); + logTestInfo("file contents are not correct"); + do_check_eq(fileContents1, fileContents2); } } else { @@ -1463,7 +1555,7 @@ function checkFilesAfterUpdateFailure(aGetDirectory) { */ function checkFilesAfterUpdateCommon() { logTestInfo("testing patch files should not be left behind"); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); let entries = updatesDir.QueryInterface(AUS_Ci.nsIFile).directoryEntries; while (entries.hasMoreElements()) { let entry = entries.getNext().QueryInterface(AUS_Ci.nsIFile); @@ -1498,9 +1590,14 @@ function checkCallbackAppLog() { return; } - logTestInfo("testing that the callback application successfully launched " + - "and the expected command line arguments passed to it"); - do_check_eq(logContents, expectedLogContents); + if (logContents == expectedLogContents) { + logTestInfo("callback log file contents are correct"); + do_check_true(true); + } + else { + logTestInfo("callback log file contents are not correct"); + do_check_eq(logContents, expectedLogContents); + } removeCallbackCopy(); } @@ -1539,7 +1636,7 @@ function removeCallbackCopy() { // Remove the copy of the application executable used for the test on // Windows if it exists. let appBinCopy = getAppDir(); - appBinCopy.append(TEST_ID + FILE_WIN_TEST_EXE); + appBinCopy.append(gTestID + FILE_WIN_TEST_EXE); if (appBinCopy.exists()) { try { logTestInfo("attempting removal of file: " + appBinCopy.path); @@ -1567,7 +1664,7 @@ function removeUpdater() { // Windows if it exists. let updater = getUpdatesDir(); updater.append("0"); - updater.append(UPDATER_BIN_FILE); + updater.append(FILE_UPDATER_BIN); if (updater.exists()) { try { updater.remove(false); @@ -1591,7 +1688,7 @@ function removeUpdater() { // then calls removeCallbackCopy. function waitForFilesInUse() { let maintSvcInstaller = getAppDir(); - maintSvcInstaller.append("MAINTENANCE_SERVICE_INSTALLER_BIN_FILE"); + maintSvcInstaller.append("FILE_MAINTENANCE_SERVICE_INSTALLER_BIN"); let helper = getAppDir(); helper.append("uninstall"); @@ -1856,27 +1953,23 @@ const updateCheckListener = { /** * Helper for starting the http server used by the tests - * - * @param aRelativeDirName - * The directory name to register relative to - * toolkit/mozapps/update/test/unit/ */ -function start_httpserver(aRelativeDirName) { - var dir = do_get_file(aRelativeDirName); - if (!dir.exists()) - do_throw("The directory used by HttpServer does not exist! path: " + - dir.path + "\n"); +function start_httpserver() { + let dir = getTestDirFile(); + logTestInfo("http server file path: " + dir.path); - if (!dir.isDirectory()) + if (!dir.isDirectory()) { do_throw("A file instead of a directory was specified for HttpServer " + "registerDirectory! path: " + dir.path + "\n"); + } Components.utils.import("resource://testing-common/httpd.js"); gTestserver = new HttpServer(); - gTestserver.registerDirectory("/data/", dir); + gTestserver.registerDirectory("/", dir); gTestserver.start(-1); - gTestserverPort = gTestserver.identity.primaryPort; - logTestInfo("http server port = " + gTestserverPort); + let testserverPort = gTestserver.identity.primaryPort; + gURLData = URL_HOST + ":" + testserverPort + "/"; + logTestInfo("http server port = " + testserverPort); } /* Helper for stopping the http server used by the tests */ @@ -2001,7 +2094,7 @@ function getProcessArgs(aExtraArgs) { */ function getAppConsoleLogPath() { let appConsoleLog = do_get_file("/", true); - appConsoleLog.append(TEST_ID + "_app_console_log"); + appConsoleLog.append(gTestID + "_app_console_log"); if (appConsoleLog.exists()) { appConsoleLog.remove(false); } @@ -2020,7 +2113,7 @@ function getAppConsoleLogPath() { */ function getAppArgsLogPath() { let appArgsLog = do_get_file("/", true); - appArgsLog.append("app_args_log"); + appArgsLog.append(gTestID + "_app_args_log"); if (appArgsLog.exists()) { appArgsLog.remove(false); } @@ -2039,7 +2132,7 @@ function getAppArgsLogPath() { */ function getLaunchScript() { let launchScript = do_get_file("/", true); - launchScript.append("launch.sh"); + launchScript.append(gTestID + "_launch.sh"); if (launchScript.exists()) { launchScript.remove(false); } @@ -2061,13 +2154,13 @@ XPCOMUtils.defineLazyGetter(this, "gAppBinPath", function test_gAppBinPath() { if (appBin.exists()) { if (IS_WIN) { let appBinCopy = processDir.clone(); - appBinCopy.append(TEST_ID + FILE_WIN_TEST_EXE); + appBinCopy.append(gTestID + FILE_WIN_TEST_EXE); if (appBinCopy.exists()) { appBinCopy.remove(false); } - appBin.copyTo(processDir, TEST_ID + FILE_WIN_TEST_EXE); + appBin.copyTo(processDir, gTestID + FILE_WIN_TEST_EXE); appBin = processDir.clone(); - appBin.append(TEST_ID + FILE_WIN_TEST_EXE); + appBin.append(gTestID + FILE_WIN_TEST_EXE); } let appBinPath = appBin.path; if (/ /.test(appBinPath)) { diff --git a/toolkit/mozapps/update/test/unit/test_0020_general.js b/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js similarity index 98% rename from toolkit/mozapps/update/test/unit/test_0020_general.js rename to toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js index b9e980887d9d..e472e853fd1f 100644 --- a/toolkit/mozapps/update/test/unit/test_0020_general.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/remoteUpdateXML.js @@ -3,20 +3,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Check Update XML Tests */ - -const TEST_ID = "0020"; - var gNextRunFunc; var gExpectedCount; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + logTestInfo("testing remote update xml attributes"); - removeUpdateDirsAndFiles(); setUpdateURLOverride(); setUpdateChannel("test_channel"); // The mock XMLHttpRequest is MUCH faster @@ -26,7 +20,7 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } // Helper function for testing update counts returned from an update xml diff --git a/toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js b/toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js similarity index 95% rename from toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js rename to toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js index f7bdb0b08fe8..f8bbf9409bbb 100644 --- a/toolkit/mozapps/update/test/unit/test_0081_prompt_uiAlreadyOpen.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/uiOnlyAllowOneWindow.js @@ -7,19 +7,12 @@ * showUpdateAvailable when there is already an application update window open. */ -const TEST_ID = "0081"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing nsIUpdatePrompt notifications should not be seen when " + "there is already an application update window open"); - removeUpdateDirsAndFiles(); - Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false); let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar); @@ -69,7 +62,7 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } function check_showUpdateInstalled() { diff --git a/toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js b/toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js similarity index 94% rename from toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js rename to toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js index f82bab13c837..48e554d95f0a 100644 --- a/toolkit/mozapps/update/test/unit/test_0080_prompt_silent.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/uiSilentPref.js @@ -8,19 +8,12 @@ * preference is true. */ -const TEST_ID = "0080"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing nsIUpdatePrompt notifications should not be seen " + "when the " + PREF_APP_UPDATE_SILENT + " preference is true"); - removeUpdateDirsAndFiles(); - Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, true); let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar); @@ -72,7 +65,7 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } function check_showUpdateInstalled() { diff --git a/toolkit/mozapps/update/test/unit/test_0082_prompt_unsupportAlreadyNotified.js b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js similarity index 89% rename from toolkit/mozapps/update/test/unit/test_0082_prompt_unsupportAlreadyNotified.js rename to toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js index 4980da9f2878..ddb9c8ff641a 100644 --- a/toolkit/mozapps/update/test/unit/test_0082_prompt_unsupportAlreadyNotified.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/uiUnsupportedAlreadyNotified.js @@ -2,26 +2,20 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/** - * Test that nsIUpdatePrompt doesn't display UI for showUpdateAvailable for an - * unsupported system update when it has already been shown (bug 843497). - */ - -const TEST_ID = "0082"; - function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + logTestInfo("testing nsIUpdatePrompt notifications should not be displayed " + + "when showUpdateAvailable is called for an unsupported system " + + "update when the unsupported notification has already been " + + "shown (bug 843497)"); - removeUpdateDirsAndFiles(); setUpdateURLOverride(); // The mock XMLHttpRequest is MUCH faster overrideXHR(callHandleEvent); standardInit(); // The HTTP server is only used for the mar file downloads which is slow - start_httpserver(URL_PATH); + start_httpserver(); let registrar = Components.manager.QueryInterface(AUS_Ci.nsIComponentRegistrar); registrar.registerFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af55}"), @@ -33,9 +27,6 @@ function run_test() { "@mozilla.org/appshell/window-mediator;1", WindowMediatorFactory); - logTestInfo("testing nsIUpdatePrompt notifications should not be seen for " + - "an unsupported system update when it has already been shown"); - Services.prefs.setBoolPref(PREF_APP_UPDATE_SILENT, false); Services.prefs.setBoolPref(PREF_APP_UPDATE_NOTIFIEDUNSUPPORTED, true); // This preference is used to determine when the background update check has @@ -66,7 +57,7 @@ function end_test() { WindowWatcherFactory); registrar.unregisterFactory(Components.ID("{1dfeb90a-2193-45d5-9cb8-864928b2af56}"), WindowMediatorFactory); - cleanUp(); + cleanupTestCommon(); } // Callback function used by the custom XMLHttpRequest implementation to diff --git a/toolkit/mozapps/update/test/unit/test_0050_general.js b/toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js similarity index 94% rename from toolkit/mozapps/update/test/unit/test_0050_general.js rename to toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js index 8e2b08939df0..3fce7ba572a8 100644 --- a/toolkit/mozapps/update/test/unit/test_0050_general.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/updateCheckOnLoadOnErrorStatusText.js @@ -3,27 +3,21 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General nsIUpdateCheckListener onload and onerror error code and statusText - Tests */ - // Errors tested: // 200, 403, 404, 500, 2152398849, 2152398862, 2152398864, 2152398867, // 2152398868, 2152398878, 2152398890, 2152398919, 2152398920, 2153390069, // 2152398918, 2152398861 -const TEST_ID = "0050"; - var gNextRunFunc; var gExpectedStatusCode; var gExpectedStatusText; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + logTestInfo("testing nsIUpdateCheckListener onload and onerror error code " + + "and statusText values"); - removeUpdateDirsAndFiles(); setUpdateURLOverride(); standardInit(); // The mock XMLHttpRequest is MUCH faster @@ -32,7 +26,7 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } // Callback function used by the custom XMLHttpRequest implementation to diff --git a/toolkit/mozapps/update/test/unit/test_0060_manager.js b/toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js similarity index 95% rename from toolkit/mozapps/update/test/unit/test_0060_manager.js rename to toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js index 688543d3b060..7f21e0ce03e2 100644 --- a/toolkit/mozapps/update/test/unit/test_0060_manager.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/updateManagerXML.js @@ -3,20 +3,13 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Update Manager Tests */ - -const TEST_ID = "0060"; - function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); logTestInfo("testing addition of a successful update to " + FILE_UPDATES_DB + - " and verification of update properties with the format prior " + - "to bug 530872"); - removeUpdateDirsAndFiles(); + " and verification of update properties including the format " + + "prior to bug 530872"); + setUpdateChannel("test_channel"); var patch, patches, update, updates; @@ -178,7 +171,7 @@ function run_test() { patch = update.selectedPatch; do_check_eq(patch.type, "complete"); - do_check_eq(patch.URL, URL_HOST + "/" + URL_PATH + "/" + FILE_SIMPLE_MAR); + do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR); do_check_eq(patch.hashFunction, "MD5"); do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR); do_check_eq(patch.size, SIZE_SIMPLE_MAR); @@ -208,7 +201,7 @@ function run_test() { patch = update.selectedPatch; do_check_eq(patch.type, "complete"); - do_check_eq(patch.URL, URL_HOST + "/" + URL_PATH + "/" + FILE_SIMPLE_MAR); + do_check_eq(patch.URL, URL_HOST + "/" + FILE_SIMPLE_MAR); do_check_eq(patch.hashFunction, "MD5"); do_check_eq(patch.hashValue, MD5_HASH_SIMPLE_MAR); do_check_eq(patch.size, SIZE_SIMPLE_MAR); @@ -219,5 +212,5 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0300_update_root_dir_migration.js b/toolkit/mozapps/update/tests/unit_aus_update/updateRootDirMigration_win.js similarity index 96% rename from toolkit/mozapps/update/test/unit/test_0300_update_root_dir_migration.js rename to toolkit/mozapps/update/tests/unit_aus_update/updateRootDirMigration_win.js index e059100a0d67..18f2d294ad3c 100644 --- a/toolkit/mozapps/update/test/unit/test_0300_update_root_dir_migration.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/updateRootDirMigration_win.js @@ -3,13 +3,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -const TEST_ID = "0300"; const PREF_APP_UPDATE_MIGRATE_APP_DIR = "app.update.migrated.updateDir"; -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; - function clearTaskbarIDHash(exePath, appInfoName) { let registry = AUS_Cc["@mozilla.org/windows-registry-key;1"]. createInstance(AUS_Ci.nsIWindowsRegKey); @@ -50,7 +45,7 @@ function getMigrated() { /* General Update Manager Tests */ function run_test() { - do_test_pending(); + setupTestCommon(false); do_register_cleanup(end_test); standardInit(); @@ -172,5 +167,5 @@ function end_test() { QueryInterface(AUS_Ci.nsIXULRuntime); var exeFile = FileUtils.getFile(XRE_EXECUTABLE_FILE, []); clearTaskbarIDHash(exeFile.parent.path, appinfo.name); - cleanUp(); + cleanupTestCommon(); } diff --git a/toolkit/mozapps/update/test/unit/test_0040_general.js b/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js similarity index 98% rename from toolkit/mozapps/update/test/unit/test_0040_general.js rename to toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js index 1ec2929a7edf..3b61a4617a10 100644 --- a/toolkit/mozapps/update/test/unit/test_0040_general.js +++ b/toolkit/mozapps/update/tests/unit_aus_update/urlConstruction.js @@ -7,19 +7,13 @@ Components.utils.import("resource://gre/modules/ctypes.jsm") -const TEST_ID = "0040"; - -const URL_PREFIX = URL_HOST + URL_PATH + "/"; +const URL_PREFIX = URL_HOST + "/"; var gAppInfo; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - removeUpdateDirsAndFiles(); // The mock XMLHttpRequest is MUCH faster overrideXHR(callHandleEvent); standardInit(); @@ -30,7 +24,7 @@ function run_test() { } function end_test() { - cleanUp(); + cleanupTestCommon(); } // Callback function used by the custom XMLHttpRequest implementation to diff --git a/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini b/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini new file mode 100644 index 000000000000..6291a59332e5 --- /dev/null +++ b/toolkit/mozapps/update/tests/unit_aus_update/xpcshell.ini @@ -0,0 +1,40 @@ +; 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/. + +[DEFAULT] +head = head_update.js +tail = +generated-files = head_update.js + +[canCheckForAndCanApplyUpdates.js] +[urlConstruction.js] +[updateCheckOnLoadOnErrorStatusText.js] +[updateManagerXML.js] +[remoteUpdateXML.js] +[downloadMar.js] +[cleanupDownloadingForOlderAppVersion.js] +[cleanupDownloadingForDifferentChannel.js] +[cleanupDownloadingForSameVersionAndBuildID.js] +[cleanupDownloadingIncorrectStatus.js] +[cleanupPendingVersionFileIncorrectStatus.js] +[cleanupSuccessLogMove.js] +[cleanupSuccessLogsFIFO.js] +[downloadResumeForSameAppVersion.js] +[downloadCompleteAfterPartialFailure.js] +skip-if = toolkit == 'gonk' +reason = custom nsIUpdatePrompt +[downloadInterruptedByOfflineRetry.js] +[downloadFileTooBig_gonk.js] +run-if = toolkit == 'gonk' +[uiSilentPref.js] +skip-if = toolkit == 'gonk' +reason = custom nsIUpdatePrompt +[uiOnlyAllowOneWindow.js] +skip-if = toolkit == 'gonk' +reason = custom nsIUpdatePrompt +[uiUnsupportedAlreadyNotified.js] +skip-if = toolkit == 'gonk' +reason = custom nsIUpdatePrompt +[updateRootDirMigration_win.js] +run-if = os == 'win' diff --git a/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js similarity index 96% rename from toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js index 1b30724e77a1..bf81f45a5737 100644 --- a/toolkit/mozapps/update/test/unit/test_0203_app_launch_apply_update.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateAppBinInUseStageSuccess_win.js @@ -18,21 +18,11 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0203"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; Components.utils.import("resource://gre/modules/ctypes.jsm"); let gAppTimer; let gProcess; -let gTimeoutRuns = 0; function run_test() { if (APP_BIN_NAME == "xulrunner") { @@ -40,15 +30,14 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); + do_register_cleanup(end_test); if (IS_WIN) { Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true); } - removeUpdateDirsAndFiles(); - symlinkUpdateFilesIntoBundleDirectory(); if (IS_WIN) { adjustPathsOnWindows(); @@ -95,7 +84,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -213,7 +202,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } function shouldAdjustPathsOnMac() { diff --git a/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js similarity index 96% rename from toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js index 4be5910eb7bf..5df488104b30 100644 --- a/toolkit/mozapps/update/test/unit/test_0201_app_launch_apply_update.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateStageSuccess.js @@ -12,19 +12,8 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0201"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; - let gAppTimer; let gProcess; -let gTimeoutRuns = 0; function run_test() { if (APP_BIN_NAME == "xulrunner") { @@ -32,15 +21,14 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); + do_register_cleanup(end_test); if (IS_WIN) { Services.prefs.setBoolPref(PREF_APP_UPDATE_SERVICE_ENABLED, true); } - removeUpdateDirsAndFiles(); - symlinkUpdateFilesIntoBundleDirectory(); if (IS_WIN) { adjustPathsOnWindows(); @@ -87,7 +75,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -184,7 +172,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } function shouldAdjustPathsOnMac() { diff --git a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js similarity index 96% rename from toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js index f99eb0bbbb9a..90ab06f0db84 100644 --- a/toolkit/mozapps/update/test/unit/test_0200_app_launch_apply_update.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppApplyUpdateSuccess.js @@ -9,19 +9,8 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0200"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; - let gAppTimer; let gProcess; -let gTimeoutRuns = 0; function run_test() { if (APP_BIN_NAME == "xulrunner") { @@ -29,10 +18,9 @@ function run_test() { return; } - do_test_pending(); - do_register_cleanup(end_test); + setupTestCommon(false); - removeUpdateDirsAndFiles(); + do_register_cleanup(end_test); if (!gAppBinPath) { do_throw("Main application binary not found... expected: " + @@ -91,7 +79,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -194,7 +182,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } /** diff --git a/toolkit/mozapps/update/test/unit/test_0162_appInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0162_appInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js index 5958a9ae164c..f2f4bb635b37 100644 --- a/toolkit/mozapps/update/test/unit/test_0162_appInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseFallbackStageFailureComplete_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* Application in use complete MAR file background patch apply failure fallback test */ - -const TEST_ID = "0162"; +/* Application in use complete MAR file stage patch apply failure fallback test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -184,13 +182,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -211,7 +206,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -227,7 +222,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js similarity index 88% rename from toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js index e5d9dac4cbc8..e3210c0617d3 100644 --- a/toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageFailureComplete_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* Application in use complete MAR file background patch apply failure test */ - -const TEST_ID = "0161"; +/* Application in use complete MAR file stage patch apply failure test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -184,13 +182,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -211,7 +206,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -228,7 +223,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_unix_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js similarity index 86% rename from toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_unix_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js index 9f1aead10a3f..567710dbc424 100644 --- a/toolkit/mozapps/update/test/unit/test_0161_appInUse_xp_unix_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseStageSuccessComplete_unix.js @@ -2,13 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* Application in use complete MAR file background patch apply success test */ - -const TEST_ID = "0161"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; +/* Application in use complete MAR file stage patch apply success test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -30,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -51,7 +45,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -60,8 +54,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -70,8 +64,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -92,8 +86,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -104,7 +98,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -126,7 +120,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -137,7 +131,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -146,8 +140,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -166,8 +160,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -197,7 +191,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -234,13 +228,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let applyToDir = getApplyDirFile(); @@ -273,7 +264,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); let applyToDir = getApplyDirFile(); @@ -286,7 +277,7 @@ function doUpdate() { let now = Date.now(); let applyToDir = getApplyDirFile(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); @@ -300,7 +291,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); // For Mac OS X check that the last modified time for a directory has been @@ -311,7 +302,7 @@ function doUpdate() { let now = Date.now(); let applyToDir = getApplyDirFile(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0160_appInUse_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0160_appInUse_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js index 637b12632166..6d17edaf8ede 100644 --- a/toolkit/mozapps/update/test/unit/test_0160_appInUse_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marAppInUseSuccessComplete.js @@ -4,12 +4,6 @@ /* Application in use complete MAR file patch apply success test */ -const TEST_ID = "0160"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -30,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -51,7 +45,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -60,8 +54,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -70,8 +64,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -92,8 +86,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -104,7 +98,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -126,7 +120,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -137,7 +131,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -146,8 +140,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -166,8 +160,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -197,7 +191,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -234,12 +228,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -277,7 +268,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); // For Mac OS X check that the last modified time for a directory has been @@ -288,7 +279,7 @@ function checkUpdate() { let now = Date.now(); let applyToDir = getApplyDirFile(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0152_appBinReplaced_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0152_appBinReplaced_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js index 42e140584b3d..90d00eb43117 100644 --- a/toolkit/mozapps/update/test/unit/test_0152_appBinReplaced_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessComplete_win.js @@ -2,10 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* Replace app binary complete MAR file background patch apply success test */ - -const TEST_ID = "0152"; -const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar"; +/* Replace app binary complete MAR file stage patch apply success test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -75,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -85,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -103,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -112,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -160,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -191,13 +188,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_WIN_FILE); + setupUpdaterTest(FILE_COMPLETE_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -208,7 +202,7 @@ function run_test() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version diff --git a/toolkit/mozapps/update/test/unit/test_0153_appBinPatched_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js similarity index 83% rename from toolkit/mozapps/update/test/unit/test_0153_appBinPatched_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js index 573af16b9fe6..8083941d42be 100644 --- a/toolkit/mozapps/update/test/unit/test_0153_appBinPatched_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppStageSuccessPartial_win.js @@ -2,10 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* Patch app binary partial MAR file background patch apply success test */ - -const TEST_ID = "0153"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; +/* Patch app binary partial MAR file stage patch apply success test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -193,13 +190,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -210,7 +204,7 @@ function run_test() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version diff --git a/toolkit/mozapps/update/test/unit/test_0150_appBinReplaced_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0150_appBinReplaced_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js index 8822d52d4642..2a3ecfb3a4c9 100644 --- a/toolkit/mozapps/update/test/unit/test_0150_appBinReplaced_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessComplete_win.js @@ -4,9 +4,6 @@ /* Replace app binary complete MAR file patch apply success test */ -const TEST_ID = "0150"; -const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -75,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -85,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -103,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -112,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -160,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -191,12 +188,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_COMPLETE_WIN_FILE); + setupUpdaterTest(FILE_COMPLETE_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -207,7 +201,7 @@ function run_test() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0151_appBinPatched_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js similarity index 83% rename from toolkit/mozapps/update/test/unit/test_0151_appBinPatched_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js index 73a09b8fc6d1..52efd1ce80b7 100644 --- a/toolkit/mozapps/update/test/unit/test_0151_appBinPatched_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marCallbackAppSuccessPartial_win.js @@ -4,9 +4,6 @@ /* Patch app binary partial MAR file patch apply success test */ -const TEST_ID = "0151"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -193,12 +190,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -209,7 +203,7 @@ function run_test() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js b/toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js similarity index 95% rename from toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js rename to toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js index 543fb22b9aa3..23df97a39c77 100644 --- a/toolkit/mozapps/update/test/unit/test_0202_app_launch_apply_update_dirlocked.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marDirLockedStageFailure_win.js @@ -18,27 +18,18 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0202"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -let gTimeoutRuns = 0; - function run_test() { if (APP_BIN_NAME == "xulrunner") { logTestInfo("Unable to run this test on xulrunner"); return; } - do_test_pending(); + setupTestCommon(false); + do_register_cleanup(end_test); logTestInfo("setting up environment for the update test..."); - removeUpdateDirsAndFiles(); - symlinkUpdateFilesIntoBundleDirectory(); if (IS_WIN) { adjustPathsOnWindows(); @@ -92,7 +83,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -166,7 +157,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); logTestInfo("finish - test cleanup"); } diff --git a/toolkit/mozapps/update/test/unit/test_0112_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0112_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js index 5540ee042a82..b9334ae128d4 100644 --- a/toolkit/mozapps/update/test/unit/test_0112_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFailurePartial.js @@ -5,12 +5,6 @@ /* General Partial MAR File Patch Apply Failure Test */ -const TEST_ID = "0112"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -51,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -91,8 +85,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -111,8 +105,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -121,8 +115,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -131,8 +125,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -142,8 +136,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png", + originalFile : "partial.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -162,8 +156,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -230,14 +224,11 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupUpdaterTest(FILE_PARTIAL_MAR); - setupUpdaterTest(MAR_PARTIAL_FILE); - - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -268,7 +259,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateFailure(); diff --git a/toolkit/mozapps/update/test/unit/test_0188_fileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js similarity index 90% rename from toolkit/mozapps/update/test/unit/test_0188_fileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js index 416846aa736c..a1cfcf976c6a 100644 --- a/toolkit/mozapps/update/test/unit/test_0188_fileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailureComplete_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0188"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -190,13 +188,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -218,7 +213,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -234,7 +229,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0189_fileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0189_fileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js index 22e4c84b1732..11bfb9498457 100644 --- a/toolkit/mozapps/update/test/unit/test_0189_fileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseFallbackStageFailurePartial_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file background patch apply failure fallback test */ -const TEST_ID = "0189"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -193,13 +190,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -221,7 +215,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -237,7 +231,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0184_fileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js similarity index 90% rename from toolkit/mozapps/update/test/unit/test_0184_fileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js index 94690e634bf2..e54b53546a18 100644 --- a/toolkit/mozapps/update/test/unit/test_0184_fileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessComplete_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file background patch apply success test */ -const TEST_ID = "0184"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -190,13 +188,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -218,7 +213,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -235,7 +230,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0185_fileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0185_fileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js index d390c091c646..98ca16c67a80 100644 --- a/toolkit/mozapps/update/test/unit/test_0185_fileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseStageSuccessPartial_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file background patch apply success test */ -const TEST_ID = "0185"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -193,13 +190,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -221,7 +215,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -238,7 +232,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0180_fileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0180_fileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js index 3ae376e22089..991ceb56f7bc 100644 --- a/toolkit/mozapps/update/test/unit/test_0180_fileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessComplete_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file patch apply success test */ -const TEST_ID = "0180"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -41,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -84,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -102,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -111,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -159,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -190,12 +188,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -221,7 +216,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0181_fileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js similarity index 84% rename from toolkit/mozapps/update/test/unit/test_0181_fileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js index c13a29dfed17..298c2fd71471 100644 --- a/toolkit/mozapps/update/test/unit/test_0181_fileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileInUseSuccessPartial_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file patch apply success test */ -const TEST_ID = "0181"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -193,12 +190,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -224,7 +218,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js index 493b3257818a..cc02d3b269b5 100644 --- a/toolkit/mozapps/update/test/unit/test_0170_fileLocked_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailureComplete_win.js @@ -4,8 +4,6 @@ /* File locked complete MAR file patch apply failure test */ -const TEST_ID = "0170"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -184,18 +182,15 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -222,7 +217,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js index 994867017da1..5772cd7affa0 100644 --- a/toolkit/mozapps/update/test/unit/test_0171_fileLocked_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFailurePartial_win.js @@ -4,8 +4,6 @@ /* File locked partial MAR file patch apply failure test */ -const TEST_ID = "0171"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -185,18 +183,15 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -223,7 +218,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test/unit/test_0174_fileLocked_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js similarity index 86% rename from toolkit/mozapps/update/test/unit/test_0174_fileLocked_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js index cc0d45cbd8ed..1e7814f39df9 100644 --- a/toolkit/mozapps/update/test/unit/test_0174_fileLocked_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailureComplete_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* File locked complete MAR file background patch apply failure fallback test */ - -const TEST_ID = "0174"; +/* File locked complete MAR file stage patch apply failure fallback test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -184,19 +182,16 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -219,7 +214,7 @@ function doUpdate() { do_check_eq(exitValue, 1); logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -235,7 +230,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0175_fileLocked_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js similarity index 84% rename from toolkit/mozapps/update/test/unit/test_0175_fileLocked_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js index b7838b4f8125..7b5c4658e7c5 100644 --- a/toolkit/mozapps/update/test/unit/test_0175_fileLocked_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedFallbackStageFailurePartial_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* File locked partial MAR file background patch apply failure fallback test */ - -const TEST_ID = "0175"; +/* File locked partial MAR file stage patch apply failure fallback test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -185,19 +183,16 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -220,7 +215,7 @@ function doUpdate() { do_check_eq(exitValue, 1); logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -236,7 +231,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js index 16f3a4ccf006..18825e383dc3 100644 --- a/toolkit/mozapps/update/test/unit/test_0172_fileLocked_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailureComplete_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* File locked complete MAR file background patch apply failure test */ - -const TEST_ID = "0172"; +/* File locked complete MAR file stage patch apply failure test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -184,19 +182,16 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -219,7 +214,7 @@ function doUpdate() { do_check_eq(exitValue, 1); logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -236,7 +231,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js similarity index 84% rename from toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js index 146379f7cb47..91eb3f7e9a80 100644 --- a/toolkit/mozapps/update/test/unit/test_0173_fileLocked_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marFileLockedStageFailurePartial_win.js @@ -2,9 +2,7 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* File locked partial MAR file background patch apply failure test */ - -const TEST_ID = "0173"; +/* File locked partial MAR file stage patch apply failure test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -185,19 +183,16 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -220,7 +215,7 @@ function doUpdate() { do_check_eq(exitValue, 1); logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -237,7 +232,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test/unit/test_0190_rmrfdirFileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js similarity index 90% rename from toolkit/mozapps/update/test/unit/test_0190_rmrfdirFileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js index a7430708af1f..5b9b5740872c 100644 --- a/toolkit/mozapps/update/test/unit/test_0190_rmrfdirFileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailureComplete_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0190"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -190,13 +188,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -205,7 +200,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -227,7 +222,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -243,7 +238,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0191_rmrfdirFileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0191_rmrfdirFileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js index 5325fbcb946d..d225d008772d 100644 --- a/toolkit/mozapps/update/test/unit/test_0191_rmrfdirFileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseFallbackStageFailurePartial_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file background patch apply failure fallback test */ -const TEST_ID = "0191"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -233,13 +230,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -247,7 +241,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -268,7 +262,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -284,7 +278,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0186_rmrfdirFileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js similarity index 90% rename from toolkit/mozapps/update/test/unit/test_0186_rmrfdirFileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js index c18f8a2f9970..53778ec97c17 100644 --- a/toolkit/mozapps/update/test/unit/test_0186_rmrfdirFileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessComplete_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file background patch apply success test */ -const TEST_ID = "0186"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -190,13 +188,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -205,7 +200,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -227,7 +222,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -244,7 +239,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0187_rmrfdirFileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0187_rmrfdirFileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js index 311e762b534d..1a3ef47b70ca 100644 --- a/toolkit/mozapps/update/test/unit/test_0187_rmrfdirFileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseStageSuccessPartial_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file background patch apply success test */ -const TEST_ID = "0187"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -233,13 +230,10 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -247,7 +241,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -268,7 +262,7 @@ function doUpdate() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -285,7 +279,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test/unit/test_0182_rmrfdirFileInUse_xp_win_complete.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0182_rmrfdirFileInUse_xp_win_complete.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js index a926960e6e0b..0b3b164877ae 100644 --- a/toolkit/mozapps/update/test/unit/test_0182_rmrfdirFileInUse_xp_win_complete.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessComplete_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file patch apply success test */ -const TEST_ID = "0182"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -41,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -84,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -102,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -111,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -159,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -190,12 +188,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -204,7 +199,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -231,7 +226,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0183_rmrfdirFileInUse_xp_win_partial.js b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js similarity index 87% rename from toolkit/mozapps/update/test/unit/test_0183_rmrfdirFileInUse_xp_win_partial.js rename to toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js index adda2899431a..73a4c8ea4986 100644 --- a/toolkit/mozapps/update/test/unit/test_0183_rmrfdirFileInUse_xp_win_partial.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marRMRFDirFileInUseSuccessPartial_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file patch apply success test */ -const TEST_ID = "0183"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : null }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : null }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -186,7 +183,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -233,12 +230,9 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); - - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -246,7 +240,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -272,7 +266,7 @@ function doUpdate() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0115_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0115_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js index 373d82fbd618..6f8751b4189b 100644 --- a/toolkit/mozapps/update/test/unit/test_0115_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageFailurePartial.js @@ -3,13 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Partial MAR File Background Patch Apply Failure Test */ - -const TEST_ID = "0115"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; +/* General Partial MAR File stage Patch Apply Failure Test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -51,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -91,8 +85,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -111,8 +105,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -121,8 +115,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -131,8 +125,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -142,8 +136,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png", + originalFile : "partial.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -162,8 +156,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -230,15 +224,12 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -268,7 +259,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateFailure(); diff --git a/toolkit/mozapps/update/test/unit/test_0113_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js similarity index 88% rename from toolkit/mozapps/update/test/unit/test_0113_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js index 3f3934156efa..92172e7ddf50 100644 --- a/toolkit/mozapps/update/test/unit/test_0113_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessComplete.js @@ -5,12 +5,6 @@ /* General Complete MAR File Background Patch Apply Test */ -const TEST_ID = "0113"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ var TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 6 * 64 + 6 * 8 + 6, // 0666 comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -52,7 +46,7 @@ var TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -61,8 +55,8 @@ var TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 6 * 64 + 6 * 8 + 6, // 0666 comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -71,8 +65,8 @@ var TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 6 * 64 + 6 * 8 + 6, // 0666 comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -93,8 +87,8 @@ var TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 6 * 64 + 6 * 8 + 6, // 0666 comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -105,7 +99,7 @@ var TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -127,7 +121,7 @@ var TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -138,7 +132,7 @@ var TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -147,8 +141,8 @@ var TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 7 * 64 + 7 * 8 + 7, // 0777 comparePerms : 7 * 64 + 5 * 8 + 5 // 0755 }, { @@ -167,8 +161,8 @@ var TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 7 * 64 + 7 * 8 + 7, // 0777 comparePerms : 7 * 64 + 5 * 8 + 5 // 0755 }, { @@ -198,7 +192,7 @@ var TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 7 * 64 + 7 * 8 + 6, // 0776 comparePerms : 6 * 64 + 4 * 8 + 4 // 0644 }, { @@ -235,7 +229,7 @@ ADDITIONAL_TEST_DIRS = [ }]; function runHelperProcess(args) { - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let process = AUS_Cc["@mozilla.org/process/util;1"]. createInstance(AUS_Ci.nsIProcess); process.init(helperBin); @@ -268,15 +262,12 @@ function checkSymlink() { } function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -309,14 +300,12 @@ function run_test() { let exitValue = runUpdate(); logTestInfo("testing updater binary process exitValue for success when " + "applying a complete mar"); - let updateLog = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX, true); + let updateLog = do_get_file(gTestID + UPDATES_DIR_SUFFIX, true); updateLog.append(FILE_UPDATE_LOG); - let updateLogContents = readFileBytes(updateLog); - logTestInfo(updateLogContents); do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // For Mac OS X check that the last modified time for a directory has been @@ -326,7 +315,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); @@ -360,7 +349,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0114_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js similarity index 86% rename from toolkit/mozapps/update/test/unit/test_0114_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js index 94643dacb9dd..4e965dae8205 100644 --- a/toolkit/mozapps/update/test/unit/test_0114_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marStageSuccessPartial.js @@ -3,13 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -/* General Partial MAR File Background Patch Apply Test */ - -const TEST_ID = "0114"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; +/* General Partial MAR File stage Patch Apply Test */ // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,8 +46,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -63,8 +57,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -85,8 +79,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -96,8 +90,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -118,8 +112,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -129,8 +123,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -139,8 +133,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -149,8 +143,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -169,8 +163,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -190,7 +184,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -237,15 +231,12 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); - - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -273,7 +264,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); @@ -307,7 +298,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0110_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js similarity index 86% rename from toolkit/mozapps/update/test/unit/test_0110_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js index 71e24b5048d3..78fc94334cab 100644 --- a/toolkit/mozapps/update/test/unit/test_0110_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessComplete.js @@ -5,12 +5,6 @@ /* General Complete MAR File Patch Apply Test */ -const TEST_ID = "0110"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,7 +46,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -71,8 +65,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -93,8 +87,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -105,7 +99,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -127,7 +121,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -138,7 +132,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -147,8 +141,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -167,8 +161,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -198,7 +192,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -235,14 +229,11 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupUpdaterTest(FILE_COMPLETE_MAR); - setupUpdaterTest(MAR_COMPLETE_FILE); - - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -261,7 +252,7 @@ function run_test() { do_check_eq(exitValue, 0); logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); // For Mac OS X check that the last modified time for a directory has been @@ -271,7 +262,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0111_general.js b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js similarity index 85% rename from toolkit/mozapps/update/test/unit/test_0111_general.js rename to toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js index d45678e0abf5..d1402e1936f4 100644 --- a/toolkit/mozapps/update/test/unit/test_0111_general.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marSuccessPartial.js @@ -5,12 +5,6 @@ /* General Partial MAR File Patch Apply Test */ -const TEST_ID = "0111"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,8 +46,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -63,8 +57,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -85,8 +79,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -96,8 +90,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -118,8 +112,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -129,8 +123,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -139,8 +133,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -149,8 +143,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -169,8 +163,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -190,7 +184,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -237,14 +231,11 @@ ADDITIONAL_TEST_DIRS = [ }]; function run_test() { - do_test_pending(); + setupTestCommon(true); - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupUpdaterTest(FILE_PARTIAL_MAR); - setupUpdaterTest(MAR_PARTIAL_FILE); - - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); let applyToDir = getApplyDirFile(); // For Mac OS X set the last modified time for the root directory to a date in @@ -272,7 +263,7 @@ function run_test() { "changed after a successful update (bug 600098)"); let now = Date.now(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test/unit/test_0113_versionDowngradeCheck.js b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js similarity index 83% rename from toolkit/mozapps/update/test/unit/test_0113_versionDowngradeCheck.js rename to toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js index 1f89561e8f83..f559ff5f01b3 100644 --- a/toolkit/mozapps/update/test/unit/test_0113_versionDowngradeCheck.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marVersionDowngrade.js @@ -5,8 +5,6 @@ /* Test version downgrade MAR security check */ -const TEST_ID = "0113-VDC"; - // We don't actually care if the MAR has any data, we only care about the // application return code and update.status result. const TEST_FILES = []; @@ -18,11 +16,10 @@ function run_test() { return; } - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); // Setup an old version MAR file - setupUpdaterTest(MAR_OLD_VERSION_FILE); + setupUpdaterTest(FILE_OLD_VERSION_MAR); // Apply the MAR let exitValue = runUpdate(); @@ -33,11 +30,12 @@ function run_test() { // callback process, so its return code will be that of the callback // app. do_check_eq(exitValue, USE_EXECV ? 0 : 1); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); //Make sure we get a version downgrade error let updateStatus = readStatusFile(updatesDir); do_check_eq(updateStatus.split(": ")[1], VERSION_DOWNGRADE_ERROR); + do_test_finished(); } function end_test() { diff --git a/toolkit/mozapps/update/test/unit/test_0114_productChannelCheck.js b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js similarity index 83% rename from toolkit/mozapps/update/test/unit/test_0114_productChannelCheck.js rename to toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js index 5d5391749c68..7014c92798b2 100644 --- a/toolkit/mozapps/update/test/unit/test_0114_productChannelCheck.js +++ b/toolkit/mozapps/update/tests/unit_base_updater/marWrongChannel.js @@ -5,8 +5,6 @@ /* Test product/channel MAR security check */ -const TEST_ID = "0114-PCC"; - // We don't actually care if the MAR has any data, we only care about the // application return code and update.status result. const TEST_FILES = []; @@ -18,11 +16,10 @@ function run_test() { return; } - // adjustGeneralPaths registers a cleanup function that calls end_test. - adjustGeneralPaths(); + setupTestCommon(true); // Setup a wrong channel MAR file - setupUpdaterTest(MAR_WRONG_CHANNEL_FILE); + setupUpdaterTest(FILE_WRONG_CHANNEL_MAR); // Apply the MAR let exitValue = runUpdate(); @@ -33,11 +30,12 @@ function run_test() { // callback process, so its return code will be that of the callback // app. do_check_eq(exitValue, USE_EXECV ? 0 : 1); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); //Make sure we get a version downgrade error let updateStatus = readStatusFile(updatesDir); do_check_eq(updateStatus.split(": ")[1], MAR_CHANNEL_MISMATCH_ERROR); + do_test_finished(); } function end_test() { diff --git a/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini b/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini new file mode 100644 index 000000000000..b047187e7449 --- /dev/null +++ b/toolkit/mozapps/update/tests/unit_base_updater/xpcshell.ini @@ -0,0 +1,93 @@ +; 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/. + +; Tests that require the updater binary. These tests should never run on Android +; which doesn't use the updater binary as other applications do and are excluded +; from running the tests in the moz.build file. + +[DEFAULT] +head = head_update.js +tail = +generated-files = head_update.js + +[marSuccessComplete.js] +[marSuccessPartial.js] +[marFailurePartial.js] +[marStageSuccessComplete.js] +skip-if = os == 'mac' || toolkit == 'gonk' +reason = bug 820380 +[marVersionDowngrade.js] +run-sequentially = Need to investigate. +run-if = os == 'win' +[marStageSuccessPartial.js] +skip-if = os == 'mac' +[marWrongChannel.js] +run-if = os == 'win' +[marStageFailurePartial.js] +[marCallbackAppSuccessComplete_win.js] +run-if = os == 'win' +[marCallbackAppSuccessPartial_win.js] +run-if = os == 'win' +[marCallbackAppStageSuccessComplete_win.js] +run-if = os == 'win' +[marCallbackAppStageSuccessPartial_win.js] +run-if = os == 'win' +[marAppInUseSuccessComplete.js] +run-if = os == 'linux' || os == 'mac' || os == 'sunos' || os == 'win' +[marAppInUseStageSuccessComplete_unix.js] +run-if = os == 'linux' || os == 'sunos' +[marAppInUseStageFailureComplete_win.js] +run-if = os == 'win' +[marAppInUseFallbackStageFailureComplete_win.js] +run-if = os == 'win' +[marFileLockedFailureComplete_win.js] +run-if = os == 'win' +[marFileLockedFailurePartial_win.js] +run-if = os == 'win' +[marFileLockedStageFailureComplete_win.js] +run-if = os == 'win' +[marFileLockedStageFailurePartial_win.js] +run-if = os == 'win' +[marFileLockedFallbackStageFailureComplete_win.js] +run-if = os == 'win' +[marFileLockedFallbackStageFailurePartial_win.js] +run-if = os == 'win' +[marFileInUseSuccessComplete_win.js] +run-if = os == 'win' +[marFileInUseSuccessPartial_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseSuccessComplete_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseSuccessPartial_win.js] +run-if = os == 'win' +[marFileInUseStageSuccessComplete_win.js] +run-if = os == 'win' +[marFileInUseStageSuccessPartial_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseStageSuccessComplete_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseStageSuccessPartial_win.js] +run-if = os == 'win' +[marFileInUseFallbackStageFailureComplete_win.js] +run-if = os == 'win' +[marFileInUseFallbackStageFailurePartial_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseFallbackStageFailureComplete_win.js] +run-if = os == 'win' +[marRMRFDirFileInUseFallbackStageFailurePartial_win.js] +run-if = os == 'win' +[marAppApplyUpdateSuccess.js] +run-sequentially = Launches application. +skip-if = toolkit == 'gonk' +reason = bug 820380 +[marAppApplyUpdateStageSuccess.js] +run-sequentially = Launches application. +skip-if = toolkit == 'gonk' +reason = bug 820380 +[marDirLockedStageFailure_win.js] +run-sequentially = Launches application. +run-if = os == 'win' +[marAppApplyUpdateAppBinInUseStageSuccess_win.js] +run-sequentially = Launches application. +run-if = os == 'win' diff --git a/toolkit/mozapps/update/test_svc/unit/test_0000_bootstrap_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js similarity index 92% rename from toolkit/mozapps/update/test_svc/unit/test_0000_bootstrap_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js index a1cac2c5f0c5..4921368fbfe3 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0000_bootstrap_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/bootstrapSvc.js @@ -4,8 +4,6 @@ /* Bootstrap the tests using the service by installing our own version of the service */ -const TEST_ID = "0000_svc"; - const TEST_FILES = [ { description : "the dummy file to make sure that the update worked", @@ -25,10 +23,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // apply the complete mar runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, checkUpdateApplied, null, false); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js similarity index 96% rename from toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js index b9bacf6c4d66..16570552c57e 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0203_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js @@ -18,28 +18,17 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0203_svc"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; - Components.utils.import("resource://gre/modules/ctypes.jsm"); let gAppTimer; let gProcess; -let gTimeoutRuns = 0; function run_test() { if (!shouldRunServiceTest()) { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(end_test); if (IS_WIN) { @@ -94,7 +83,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -216,7 +205,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } function shouldAdjustPathsOnMac() { diff --git a/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js similarity index 96% rename from toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js index 0c4dc0a4d321..efc13349a893 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0201_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateStageSuccessSvc.js @@ -12,26 +12,15 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0201_svc"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -// Maximum number of milliseconds the process that is launched can run before -// the test will try to kill it. -const APP_TIMER_TIMEOUT = 120000; - let gAppTimer; let gProcess; -let gTimeoutRuns = 0; function run_test() { if (!shouldRunServiceTest()) { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(end_test); if (IS_WIN) { @@ -86,7 +75,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -190,7 +179,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } function shouldAdjustPathsOnMac() { diff --git a/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js similarity index 96% rename from toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js index ce439f1819a3..7f25625e8f1e 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0200_app_launch_apply_update_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppApplyUpdateSuccessSvc.js @@ -9,20 +9,12 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0200_svc"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -let gTimeoutRuns = 0; - function run_test() { if (!shouldRunServiceTest()) { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(end_test); removeUpdateDirsAndFiles(); @@ -84,7 +76,7 @@ function run_test() { let updatesRootDir = processDir.clone(); updatesRootDir.append("updates"); updatesRootDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesRootDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -156,7 +148,7 @@ function end_test() { // This will delete the app console log file if it exists. getAppConsoleLogPath(); - cleanUp(); + cleanupTestCommon(); } /** diff --git a/toolkit/mozapps/update/test_svc/unit/test_0162_appInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js similarity index 89% rename from toolkit/mozapps/update/test_svc/unit/test_0162_appInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js index 19cc5a738521..2f6b020e09a5 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0162_appInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseFallbackStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* Application in use complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0162_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -188,11 +186,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -212,7 +210,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -228,7 +226,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0161_appInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js similarity index 90% rename from toolkit/mozapps/update/test_svc/unit/test_0161_appInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js index a04d545611e4..b1d14adb937d 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0161_appInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* Application in use complete MAR file background patch apply failure test */ -const TEST_ID = "0161_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -188,11 +186,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -212,7 +210,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -229,7 +227,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0160_appInUse_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0160_appInUse_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js index 449ca08fe8f6..9fba5c2f4c7f 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0160_appInUse_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marAppInUseSuccessCompleteSvc.js @@ -2,19 +2,8 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -/* This test mirrors ../../test/unit/test_0160_appInUse_complete.js but does the - * update using the service. This test only runs on Windows but the blocks like - * IS_MACOSX are preserved to make it easy to spot differences between the 2 - * mirrored tests. */ - /* Application in use complete MAR file patch apply success test */ -const TEST_ID = "0160_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -35,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -56,7 +45,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -65,8 +54,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -75,8 +64,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -97,8 +86,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -109,7 +98,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -131,7 +120,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -142,7 +131,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -151,8 +140,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -171,8 +160,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -202,7 +191,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -243,10 +232,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch the callback helper application so it is in use during the update let callbackApp = getApplyDirFile("a/b/" + gCallbackBinFile); @@ -282,7 +271,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); // For Mac OS X check that the last modified time for a directory has been @@ -293,7 +282,7 @@ function checkUpdate() { let now = Date.now(); let applyToDir = getApplyDirFile(); let timeDiff = Math.abs(applyToDir.lastModifiedTime - now); - do_check_true(timeDiff < MAX_TIME_DIFFERENCE); + do_check_true(timeDiff < MAC_MAX_TIME_DIFFERENCE); } checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0152_appBinReplaced_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js similarity index 87% rename from toolkit/mozapps/update/test_svc/unit/test_0152_appBinReplaced_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js index 785778598f9e..fbcb6eee7c91 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0152_appBinReplaced_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessCompleteSvc_win.js @@ -4,9 +4,6 @@ /* Replace app binary complete MAR file background patch apply success test */ -const TEST_ID = "0152_svc"; -const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -75,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -85,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -103,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -112,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -160,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -195,11 +192,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_WIN_FILE); + setupUpdaterTest(FILE_COMPLETE_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -209,7 +206,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version diff --git a/toolkit/mozapps/update/test_svc/unit/test_0153_appBinPatched_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0153_appBinPatched_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js index c34b6a8204e8..d0e859f82c10 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0153_appBinPatched_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppStageSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* Patch app binary partial MAR file background patch apply success test */ -const TEST_ID = "0153_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -197,11 +194,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -211,7 +208,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version diff --git a/toolkit/mozapps/update/test_svc/unit/test_0150_appBinReplaced_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0150_appBinReplaced_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js index 3a88d61e9bcc..c7be41284a0e 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0150_appBinReplaced_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessCompleteSvc_win.js @@ -4,9 +4,6 @@ /* Replace app binary complete MAR file patch apply success test */ -const TEST_ID = "0150_svc"; -const MAR_COMPLETE_WIN_FILE = "data/complete_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -75,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -85,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -103,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -112,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_after.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_after.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -160,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -195,10 +192,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_WIN_FILE); + setupUpdaterTest(FILE_COMPLETE_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -208,7 +205,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0151_appBinPatched_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js similarity index 84% rename from toolkit/mozapps/update/test_svc/unit/test_0151_appBinPatched_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js index c5a4ca315f7e..0784209fee88 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0151_appBinPatched_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marCallbackAppSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* Patch app binary partial MAR file patch apply success test */ -const TEST_ID = "0151_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -197,10 +194,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); gCallbackBinFile = "exe0.exe"; @@ -210,7 +207,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js similarity index 95% rename from toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js index 45e4c0ca713f..da0944376300 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0202_app_launch_apply_update_dirlocked_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marDirLockedStageFailureSvc_win.js @@ -18,20 +18,12 @@ * manifest file (e.g. updatev2.manifest). */ -const TEST_ID = "0202_svc"; - -// Backup the updater.ini and use a custom one to prevent the updater from -// launching a post update executable. -const FILE_UPDATER_INI_BAK = "updater.ini.bak"; - -let gTimeoutRuns = 0; - function run_test() { if (!shouldRunServiceTest()) { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(end_test); removeUpdateDirsAndFiles(); @@ -89,7 +81,7 @@ function run_test() { let updatesPatchDir = getUpdatesDir(); updatesPatchDir.append("0"); - let mar = do_get_file("data/simple.mar"); + let mar = getTestDirFile(FILE_SIMPLE_MAR); mar.copyTo(updatesPatchDir, FILE_UPDATE_ARCHIVE); // Backup the updater.ini file if it exists by moving it. This prevents the @@ -159,7 +151,7 @@ function end_test() { getLaunchScript(); } - cleanUp(); + cleanupTestCommon(); } function shouldAdjustPathsOnMac() { diff --git a/toolkit/mozapps/update/test_svc/unit/test_0112_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0112_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js index fa80292d38dd..07ff2fc73564 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0112_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFailurePartialSvc.js @@ -5,12 +5,6 @@ /* General Partial MAR File Patch Apply Failure Test */ -const TEST_ID = "0112_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -51,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -91,8 +85,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -111,8 +105,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -121,8 +115,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -131,8 +125,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -142,8 +136,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png", + originalFile : "partial.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -162,8 +156,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -234,19 +228,19 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // apply the partial mar runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED, checkUpdateApplied); } function checkUpdateApplied() { - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); logTestInfo("testing update.status should be " + STATE_FAILED); // The update status format for a failure is failed: # where # is the error // code for the failure. diff --git a/toolkit/mozapps/update/test_svc/unit/test_0188_fileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js similarity index 91% rename from toolkit/mozapps/update/test_svc/unit/test_0188_fileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js index 5dbe420beca9..5904daf80d65 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0188_fileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0188_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -194,11 +192,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -219,7 +217,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -235,7 +233,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0189_fileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0189_fileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js index d55ec0389dab..d0b7f30b1106 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0189_fileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseFallbackStageFailurePartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file background patch apply failure fallback test */ -const TEST_ID = "0189_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -197,11 +194,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -222,7 +219,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -238,7 +235,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0184_fileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js similarity index 91% rename from toolkit/mozapps/update/test_svc/unit/test_0184_fileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js index 5392866f1d4a..35e375aa2b1f 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0184_fileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file background patch apply success test */ -const TEST_ID = "0184_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -194,11 +192,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -219,7 +217,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -236,7 +234,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0185_fileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0185_fileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js index e42bc774f0bd..90233d32b8fb 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0185_fileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseStageSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file background patch apply success test */ -const TEST_ID = "0185_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_before.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_before.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -197,11 +194,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -222,7 +219,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -239,7 +236,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0180_fileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0180_fileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js index e5ad35d0f29b..3c70eebfae7a 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0180_fileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use complete MAR file patch apply success test */ -const TEST_ID = "0180_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -41,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -84,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -102,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -111,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -159,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -194,10 +192,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[14].relPathDir + @@ -222,7 +220,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0181_fileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0181_fileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js index b61f10996ebd..30192aad9c90 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0181_fileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileInUseSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use partial MAR file patch apply success test */ -const TEST_ID = "0181_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial_win.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -25,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "complete_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -42,8 +39,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the file exists " + "(patch-if)", @@ -51,8 +48,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -69,8 +66,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -78,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -96,8 +93,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest if the parent directory " + "exists (patch-if)", @@ -105,24 +102,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Patched by update.manifest (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Patched by update.manifest (patch) file in use", fileName : "0exe0.exe", relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial_in_use_win_before.exe", - compareFile : "data/partial_in_use_win_after.exe" + originalFile : "partial_in_use_win_before.exe", + compareFile : "partial_in_use_win_after.exe" }, { description : "Added by update.manifest (add)", fileName : "00text0", @@ -137,8 +134,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png" + originalFile : "complete.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "20text0", @@ -154,7 +151,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png" + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "00text2", @@ -197,10 +194,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_WIN_MAR); // Launch an existing file so it is in use during the update let fileInUseBin = getApplyDirFile(TEST_FILES[12].relPathDir + @@ -225,7 +222,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0170_fileLocked_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0170_fileLocked_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js index b7c4dfb59f94..8e6b9a6f6c9c 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0170_fileLocked_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File locked complete MAR file patch apply failure test */ -const TEST_ID = "0170_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -188,16 +186,16 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -223,7 +221,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0171_fileLocked_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0171_fileLocked_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js index 29beb73c65b1..57b667d94c03 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0171_fileLocked_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFailurePartialSvc_win.js @@ -4,8 +4,6 @@ /* File locked partial MAR file patch apply failure test */ -const TEST_ID = "0171_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -189,16 +187,16 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -224,7 +222,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0174_fileLocked_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0174_fileLocked_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js index 6ca0ff7e674e..02bc0fa96356 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0174_fileLocked_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File locked complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0174_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -188,17 +186,17 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -220,7 +218,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -236,7 +234,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0175_fileLocked_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0175_fileLocked_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js index 3aa2a0de9616..dc1e1d70b788 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0175_fileLocked_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedFallbackStageFailurePartialSvc_win.js @@ -4,8 +4,6 @@ /* File locked partial MAR file background patch apply failure fallback test */ -const TEST_ID = "0175_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -189,17 +187,17 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -221,7 +219,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -237,7 +235,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js index af8b686937aa..828d8ad48a6e 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0172_fileLocked_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File locked complete MAR file background patch apply failure test */ -const TEST_ID = "0172_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,24 +38,24 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -96,8 +94,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0png0.png", @@ -112,8 +110,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "10text0", @@ -152,8 +150,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not removed for failed update (remove)", fileName : "20text0", @@ -188,17 +186,17 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -220,7 +218,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -237,7 +235,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js index dabcb801e59d..a3b17d8fabad 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0173_fileLocked_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marFileLockedStageFailurePartialSvc_win.js @@ -4,8 +4,6 @@ /* File locked partial MAR file background patch apply failure test */ -const TEST_ID = "0173_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "complete_precomplete", + compareFile : "complete_precomplete" }, { description : "Not added for failed update (add)", fileName : "searchpluginstext0", @@ -40,16 +38,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions1text0", @@ -64,16 +62,16 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions1png0.png", relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add-if)", fileName : "extensions0text0", @@ -88,24 +86,24 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch-if)", fileName : "extensions0png0.png", relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not patched for failed update (patch) and causes " + "LoadSourceFile failed", @@ -113,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Not added for failed update (add)", fileName : "00text0", @@ -129,8 +127,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png" + originalFile : "complete.png", + compareFile : "complete.png" }, { description : "Not added for failed update (add)", fileName : "20text0", @@ -189,17 +187,17 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); // Exclusively lock an existing file so it is in use during the update - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let helperDestDir = getApplyDirFile("a/b/"); - helperBin.copyTo(helperDestDir, HELPER_BIN_FILE); - helperBin = getApplyDirFile("a/b/" + HELPER_BIN_FILE); + helperBin.copyTo(helperDestDir, FILE_HELPER_BIN); + helperBin = getApplyDirFile("a/b/" + FILE_HELPER_BIN); // Strip off the first two directories so the path has to be from the helper's // working directory. let lockFileRelPath = TEST_FILES[3].relPathDir.split("/"); @@ -221,7 +219,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); // Now switch the application and its updated version @@ -238,7 +236,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // The update status format for a failure is failed: # where # is the error // code for the failure. do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0190_rmrfdirFileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js similarity index 91% rename from toolkit/mozapps/update/test_svc/unit/test_0190_rmrfdirFileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js index f26be5b612b0..a3aee092e6fe 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0190_rmrfdirFileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file background patch apply failure fallback test */ -const TEST_ID = "0190_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -194,11 +192,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -207,7 +205,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -228,7 +226,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -244,7 +242,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0191_rmrfdirFileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0191_rmrfdirFileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js index 093316579803..54a8b61a194d 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0191_rmrfdirFileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file background patch apply failure fallback test */ -const TEST_ID = "0191_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -237,11 +234,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -249,7 +246,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -269,7 +266,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -285,7 +282,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_PENDING); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_PENDING); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0186_rmrfdirFileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js similarity index 91% rename from toolkit/mozapps/update/test_svc/unit/test_0186_rmrfdirFileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js index 78962d9e7942..6d929ee36c55 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0186_rmrfdirFileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file background patch apply success test */ -const TEST_ID = "0186_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/partial_precomplete" + originalFile : "partial_precomplete", + compareFile : "partial_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -48,16 +46,16 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/partial_removed-files" + originalFile : "partial_removed-files", + compareFile : "partial_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png" + originalFile : "partial.png", + compareFile : "partial.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -118,8 +116,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : HELPER_BIN_FILE + originalFile : FILE_HELPER_BIN, + compareFile : FILE_HELPER_BIN }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -194,11 +192,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -207,7 +205,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -228,7 +226,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -245,7 +243,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0187_rmrfdirFileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0187_rmrfdirFileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js index 9b05af0f0cb8..fd46bf6c4ba3 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0187_rmrfdirFileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseStageSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file background patch apply success test */ -const TEST_ID = "0187_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : null }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -237,11 +234,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -249,7 +246,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -269,7 +266,7 @@ function doUpdate() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); // Now switch the application and its updated version @@ -286,7 +283,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_FAILED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir).split(": ")[0], STATE_FAILED); checkFilesAfterUpdateFailure(getApplyDirFile); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0182_rmrfdirFileInUse_xp_win_complete_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0182_rmrfdirFileInUse_xp_win_complete_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js index e4fa4cc75496..42fd6af0ffd0 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0182_rmrfdirFileInUse_xp_win_complete_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessCompleteSvc_win.js @@ -4,8 +4,6 @@ /* File in use inside removed dir complete MAR file patch apply success test */ -const TEST_ID = "0182_svc"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -24,8 +22,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete" + originalFile : "partial_precomplete", + compareFile : "complete_precomplete" }, { description : "Added by update.manifest (add)", fileName : "searchpluginstext0", @@ -41,23 +39,23 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "searchpluginspng0.png", relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "removed-files", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files" + originalFile : "partial_removed-files", + compareFile : "complete_removed-files" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -74,8 +72,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png" + originalFile : "partial.png", + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -84,7 +82,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -102,7 +100,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest if the parent directory " + "exists (add-if)", @@ -111,15 +109,15 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "exe0.exe", relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "10text0", @@ -134,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : HELPER_BIN_FILE, - compareFile : "data/complete.png" + originalFile : FILE_HELPER_BIN, + compareFile : "complete.png" }, { description : "Added by update.manifest (add)", fileName : "00text1", @@ -159,7 +157,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png" + compareFile : "complete.png" }, { description : "Removed by precomplete (remove)", fileName : "20text0", @@ -194,10 +192,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0] + @@ -206,7 +204,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[4].relPathDir + TEST_DIRS[4].subDirs[0]); helperBin.copyTo(fileInUseDir, TEST_DIRS[4].subDirFiles[0]); @@ -232,7 +230,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0183_rmrfdirFileInUse_xp_win_partial_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js similarity index 87% rename from toolkit/mozapps/update/test_svc/unit/test_0183_rmrfdirFileInUse_xp_win_partial_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js index 20736b70fe5b..bf836f38484b 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0183_rmrfdirFileInUse_xp_win_partial_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marRMRFDirFileInUseSuccessPartialSvc_win.js @@ -4,9 +4,6 @@ /* File in use inside removed dir partial MAR file patch apply success test */ -const TEST_ID = "0183_svc"; -const MAR_IN_USE_WIN_FILE = "data/partial.mar"; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -27,8 +24,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -48,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -59,8 +56,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +78,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -92,8 +89,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -114,8 +111,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -125,8 +122,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -135,8 +132,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : null }, { @@ -145,8 +142,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : null }, { @@ -165,8 +162,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -186,7 +183,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -237,10 +234,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_IN_USE_WIN_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); let fileInUseBin = getApplyDirFile(TEST_DIRS[2].relPathDir + TEST_DIRS[2].files[0]); @@ -248,7 +245,7 @@ function run_test() { // replace it. fileInUseBin.remove(false); - let helperBin = do_get_file(HELPER_BIN_FILE); + let helperBin = getTestDirFile(FILE_HELPER_BIN); let fileInUseDir = getApplyDirFile(TEST_DIRS[2].relPathDir); helperBin.copyTo(fileInUseDir, TEST_DIRS[2].files[0]); @@ -273,7 +270,7 @@ function checkUpdateApplied() { function checkUpdate() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js similarity index 85% rename from toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js index 52802b21077c..5beb3eb9dcca 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0115_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageFailurePartialSvc.js @@ -5,12 +5,6 @@ /* General Partial MAR File Background Patch Apply Failure Test */ -const TEST_ID = "0115_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "complete_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0666 }, { @@ -51,8 +45,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -81,8 +75,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -91,8 +85,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -111,8 +105,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -121,8 +115,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -131,8 +125,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -142,8 +136,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/partial.png", + originalFile : "partial.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -162,8 +156,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/complete.png", + originalFile : "complete.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -234,20 +228,20 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // apply the partial mar runUpdateUsingService(STATE_PENDING_SVC, STATE_FAILED, checkUpdateApplied); } function checkUpdateApplied() { - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); logTestInfo("testing update.status should be " + STATE_FAILED); // The update status format for a failure is failed: # where # is the error // code for the failure. diff --git a/toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js similarity index 88% rename from toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js index 221c6d154e36..17b1ac1ea6d1 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0113_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessCompleteSvc.js @@ -5,12 +5,6 @@ /* General Complete MAR File Background Patch Apply Test */ -const TEST_ID = "0113_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,7 +46,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -71,8 +65,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -93,8 +87,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -105,7 +99,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -127,7 +121,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -138,7 +132,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -147,8 +141,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -167,8 +161,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -198,7 +192,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -239,11 +233,11 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // apply the complete mar runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED, checkUpdateApplied); @@ -251,7 +245,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_APPLIED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js similarity index 86% rename from toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js index a0c2858e47e7..2ddc5462d31b 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0114_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marStageSuccessPartialSvc.js @@ -5,12 +5,6 @@ /* General Partial MAR File Background Patch Apply Test */ -const TEST_ID = "0114_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,8 +46,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -63,8 +57,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -85,8 +79,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -96,8 +90,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -118,8 +112,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -129,8 +123,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -139,8 +133,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -149,8 +143,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -169,8 +163,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -190,7 +184,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -241,20 +235,20 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); gBackgroundUpdate = true; - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // apply the partial mar runUpdateUsingService(STATE_PENDING_SVC, STATE_APPLIED, checkUpdateApplied); } function checkUpdateApplied() { - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); logTestInfo("testing update.status should be " + STATE_APPLIED); do_check_eq(readStatusFile(updatesDir), STATE_APPLIED); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0110_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js similarity index 87% rename from toolkit/mozapps/update/test_svc/unit/test_0110_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js index 0846bbd9c18a..967bf0929e88 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0110_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessCompleteSvc.js @@ -5,12 +5,6 @@ /* General Complete MAR File Patch Apply Test */ -const TEST_ID = "0110_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/partial_precomplete", - compareFile : "data/complete_precomplete", + originalFile : "partial_precomplete", + compareFile : "complete_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,7 +46,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -61,8 +55,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -71,8 +65,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial_removed-files", - compareFile : "data/complete_removed-files", + originalFile : "partial_removed-files", + compareFile : "complete_removed-files", originalPerms : 0666, comparePerms : 0644 }, { @@ -93,8 +87,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0666, comparePerms : 0644 }, { @@ -105,7 +99,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -127,7 +121,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -138,7 +132,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : null, comparePerms : 0644 }, { @@ -147,8 +141,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -167,8 +161,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/partial.png", - compareFile : "data/complete.png", + originalFile : "partial.png", + compareFile : "complete.png", originalPerms : 0777, comparePerms : 0755 }, { @@ -198,7 +192,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/complete.png", + compareFile : "complete.png", originalPerms : 0776, comparePerms : 0644 }, { @@ -239,10 +233,10 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_COMPLETE_FILE); + setupUpdaterTest(FILE_COMPLETE_MAR); // apply the complete mar runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, checkUpdateApplied); @@ -250,7 +244,7 @@ function run_test() { function checkUpdateApplied() { logTestInfo("testing update.status should be " + STATE_SUCCEEDED); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); checkFilesAfterUpdateSuccess(); diff --git a/toolkit/mozapps/update/test_svc/unit/test_0111_general_svc.js b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js similarity index 84% rename from toolkit/mozapps/update/test_svc/unit/test_0111_general_svc.js rename to toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js index 7b589aa1a4d7..9ee641f4b436 100644 --- a/toolkit/mozapps/update/test_svc/unit/test_0111_general_svc.js +++ b/toolkit/mozapps/update/tests/unit_service_updater/marSuccessPartialSvc.js @@ -5,12 +5,6 @@ /* General Partial MAR File Patch Apply Test */ -const TEST_ID = "0111_svc"; -// All we care about is that the last modified time has changed so that Mac OS -// X Launch Services invalidates its cache so the test allows up to one minute -// difference in the last modified time. -const MAX_TIME_DIFFERENCE = 60000; - // The files are listed in the same order as they are applied from the mar's // update.manifest. Complete updates have remove file and rmdir directory // operations located in the precomplete file performed first. @@ -31,8 +25,8 @@ const TEST_FILES = [ relPathDir : "", originalContents : null, compareContents : null, - originalFile : "data/complete_precomplete", - compareFile : "data/partial_precomplete", + originalFile : "complete_precomplete", + compareFile : "partial_precomplete", originalPerms : 0666, comparePerms : 0644 }, { @@ -52,8 +46,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -63,8 +57,8 @@ const TEST_FILES = [ relPathDir : "a/b/searchplugins/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -85,8 +79,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -96,8 +90,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions1/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -118,8 +112,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -129,8 +123,8 @@ const TEST_FILES = [ relPathDir : "a/b/extensions/extensions0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0644, comparePerms : 0644 }, { @@ -139,8 +133,8 @@ const TEST_FILES = [ relPathDir : "a/b/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -149,8 +143,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0755, comparePerms : 0755 }, { @@ -169,8 +163,8 @@ const TEST_FILES = [ relPathDir : "a/b/0/00/", originalContents : null, compareContents : null, - originalFile : "data/complete.png", - compareFile : "data/partial.png", + originalFile : "complete.png", + compareFile : "partial.png", originalPerms : 0666, comparePerms : 0666 }, { @@ -190,7 +184,7 @@ const TEST_FILES = [ originalContents : null, compareContents : null, originalFile : null, - compareFile : "data/partial.png", + compareFile : "partial.png", originalPerms : null, comparePerms : 0644 }, { @@ -241,19 +235,19 @@ function run_test() { return; } - do_test_pending(); + setupTestCommon(false); do_register_cleanup(cleanupUpdaterTest); - setupUpdaterTest(MAR_PARTIAL_FILE); + setupUpdaterTest(FILE_PARTIAL_MAR); - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); // apply the partial mar runUpdateUsingService(STATE_PENDING_SVC, STATE_SUCCEEDED, checkUpdateApplied); } function checkUpdateApplied() { - let updatesDir = do_get_file(TEST_ID + UPDATES_DIR_SUFFIX); + let updatesDir = do_get_file(gTestID + UPDATES_DIR_SUFFIX); logTestInfo("testing update.status should be " + STATE_SUCCEEDED); do_check_eq(readStatusFile(updatesDir), STATE_SUCCEEDED); diff --git a/toolkit/mozapps/update/test_svc/unit/xpcshell.ini b/toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini similarity index 59% rename from toolkit/mozapps/update/test_svc/unit/xpcshell.ini rename to toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini index f9977859fae6..1e01dce0d7c4 100644 --- a/toolkit/mozapps/update/test_svc/unit/xpcshell.ini +++ b/toolkit/mozapps/update/tests/unit_service_updater/xpcshell.ini @@ -2,80 +2,82 @@ ; 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/. +; Tests that require the updater binary and the maintenance service. + [DEFAULT] head = head_update.js tail = generated-files = head_update.js -[test_0000_bootstrap_svc.js] +[bootstrapSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0110_general_svc.js] +[marSuccessCompleteSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0111_general_svc.js] +[marSuccessPartialSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0112_general_svc.js] +[marFailurePartialSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0113_general_svc.js] +[marStageSuccessCompleteSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0114_general_svc.js] +[marStageSuccessPartialSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0115_general_svc.js] +[marStageFailurePartialSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0150_appBinReplaced_xp_win_complete_svc.js] +[marCallbackAppSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0151_appBinPatched_xp_win_partial_svc.js] +[marCallbackAppSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0152_appBinReplaced_xp_win_complete_svc.js] +[marCallbackAppStageSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0153_appBinPatched_xp_win_partial_svc.js] +[marCallbackAppStageSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0160_appInUse_complete_svc.js] +[marAppInUseSuccessCompleteSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0161_appInUse_xp_win_complete_svc.js] +[marAppInUseStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0162_appInUse_xp_win_complete_svc.js] +[marAppInUseFallbackStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0170_fileLocked_xp_win_complete_svc.js] +[marFileLockedFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0171_fileLocked_xp_win_partial_svc.js] +[marFileLockedFailurePartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0172_fileLocked_xp_win_complete_svc.js] +[marFileLockedStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0173_fileLocked_xp_win_partial_svc.js] +[marFileLockedStageFailurePartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0174_fileLocked_xp_win_complete_svc.js] +[marFileLockedFallbackStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0175_fileLocked_xp_win_partial_svc.js] +[marFileLockedFallbackStageFailurePartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0180_fileInUse_xp_win_complete_svc.js] +[marFileInUseSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0181_fileInUse_xp_win_partial_svc.js] +[marFileInUseSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0182_rmrfdirFileInUse_xp_win_complete_svc.js] +[marRMRFDirFileInUseSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0183_rmrfdirFileInUse_xp_win_partial_svc.js] +[marRMRFDirFileInUseSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0184_fileInUse_xp_win_complete_svc.js] +[marFileInUseStageSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0185_fileInUse_xp_win_partial_svc.js] +[marFileInUseStageSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0186_rmrfdirFileInUse_xp_win_complete_svc.js] +[marRMRFDirFileInUseStageSuccessCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0187_rmrfdirFileInUse_xp_win_partial_svc.js] +[marRMRFDirFileInUseStageSuccessPartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0188_fileInUse_xp_win_complete_svc.js] +[marFileInUseFallbackStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0189_fileInUse_xp_win_partial_svc.js] +[marFileInUseFallbackStageFailurePartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0190_rmrfdirFileInUse_xp_win_complete_svc.js] +[marRMRFDirFileInUseFallbackStageFailureCompleteSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0191_rmrfdirFileInUse_xp_win_partial_svc.js] +[marRMRFDirFileInUseFallbackStageFailurePartialSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0200_app_launch_apply_update_svc.js] +[marAppApplyUpdateSuccessSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0201_app_launch_apply_update_svc.js] +[marAppApplyUpdateStageSuccessSvc.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0202_app_launch_apply_update_dirlocked_svc.js] +[marDirLockedStageFailureSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. -[test_0203_app_launch_apply_update_svc.js] +[marAppApplyUpdateAppBinInUseStageSuccessSvc_win.js] run-sequentially = Uses the Mozilla Maintenance Service. diff --git a/toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js b/toolkit/mozapps/update/tests/unit_timermanager/consumerNotifications.js similarity index 100% rename from toolkit/mozapps/update/test_timermanager/unit/test_0010_timermanager.js rename to toolkit/mozapps/update/tests/unit_timermanager/consumerNotifications.js diff --git a/toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini b/toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini similarity index 91% rename from toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini rename to toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini index cff4642ea745..8f5ab7009c43 100644 --- a/toolkit/mozapps/update/test_timermanager/unit/xpcshell.ini +++ b/toolkit/mozapps/update/tests/unit_timermanager/xpcshell.ini @@ -6,6 +6,6 @@ head = tail = -[test_0010_timermanager.js] +[consumerNotifications.js] # Bug 676992: test consistently fails on Android fail-if = os == "android"