Bug 370750 - consolidate mochitest files installation; r=glandium
authorNathan Froyd <froydnj@mozilla.com>
Tue, 03 Jul 2012 16:49:02 -0400
changeset 98706 654677c62195ade890271785c1d1d6e05b2332d5
parent 98705 a516a86f854da9a92976566878010c820458b22d
child 98707 d651a39e115b3f52ff2411a6acecb74776342329
push id11615
push usernfroyd@mozilla.com
push dateMon, 09 Jul 2012 17:37:45 +0000
treeherdermozilla-inbound@654677c62195 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs370750
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 370750 - consolidate mochitest files installation; r=glandium With assistance on the patch from Ms2ger, Waldo, and Mossop.
accessible/tests/mochitest/Makefile.in
accessible/tests/mochitest/actions/Makefile.in
accessible/tests/mochitest/attributes/Makefile.in
accessible/tests/mochitest/bounds/Makefile.in
accessible/tests/mochitest/editabletext/Makefile.in
accessible/tests/mochitest/elm/Makefile.in
accessible/tests/mochitest/events/Makefile.in
accessible/tests/mochitest/focus/Makefile.in
accessible/tests/mochitest/hittest/Makefile.in
accessible/tests/mochitest/hyperlink/Makefile.in
accessible/tests/mochitest/hypertext/Makefile.in
accessible/tests/mochitest/name/Makefile.in
accessible/tests/mochitest/pivot/Makefile.in
accessible/tests/mochitest/relations/Makefile.in
accessible/tests/mochitest/role/Makefile.in
accessible/tests/mochitest/selectable/Makefile.in
accessible/tests/mochitest/states/Makefile.in
accessible/tests/mochitest/table/Makefile.in
accessible/tests/mochitest/text/Makefile.in
accessible/tests/mochitest/textcaret/Makefile.in
accessible/tests/mochitest/textselection/Makefile.in
accessible/tests/mochitest/tree/Makefile.in
accessible/tests/mochitest/treeupdate/Makefile.in
accessible/tests/mochitest/value/Makefile.in
browser/base/content/test/Makefile.in
browser/components/downloads/test/browser/Makefile.in
browser/components/feeds/test/Makefile.in
browser/components/feeds/test/chrome/Makefile.in
browser/components/places/tests/browser/Makefile.in
browser/components/places/tests/chrome/Makefile.in
browser/components/privatebrowsing/test/browser/Makefile.in
browser/components/search/test/Makefile.in
browser/components/sessionstore/test/Makefile.in
browser/components/shell/test/Makefile.in
browser/components/test/Makefile.in
browser/devtools/commandline/test/Makefile.in
browser/devtools/debugger/test/Makefile.in
browser/devtools/scratchpad/test/Makefile.in
browser/devtools/shared/test/Makefile.in
browser/devtools/sourceeditor/test/Makefile.in
browser/devtools/styleinspector/test/Makefile.in
browser/devtools/tilt/test/Makefile.in
browser/devtools/webconsole/test/Makefile.in
browser/extensions/pdfjs/test/Makefile.in
caps/tests/mochitest/Makefile.in
config/makefiles/mochitest.mk
config/rules.mk
content/base/test/Makefile.in
content/base/test/chrome/Makefile.in
content/base/test/websocket_hybi/Makefile.in
content/canvas/test/Makefile.in
content/canvas/test/crossorigin/Makefile.in
content/canvas/test/webgl/Makefile.in
content/events/test/Makefile.in
content/html/content/test/Makefile.in
content/html/content/test/bug649134/Makefile.in
content/html/content/test/forms/Makefile.in
content/html/document/test/Makefile.in
content/media/test/Makefile.in
content/smil/test/Makefile.in
content/svg/content/test/Makefile.in
content/xbl/test/Makefile.in
content/xml/document/test/Makefile.in
content/xslt/tests/mochitest/Makefile.in
content/xul/content/test/Makefile.in
content/xul/document/test/Makefile.in
content/xul/templates/tests/chrome/Makefile.in
docshell/test/Makefile.in
docshell/test/browser/Makefile.in
docshell/test/chrome/Makefile.in
docshell/test/navigation/Makefile.in
dom/alarm/test/Makefile.in
dom/apps/tests/Makefile.in
dom/base/test/Makefile.in
dom/battery/test/Makefile.in
dom/bindings/test/Makefile.in
dom/browser-element/mochitest/Makefile.in
dom/contacts/tests/Makefile.in
dom/devicestorage/test/Makefile.in
dom/file/test/Makefile.in
dom/imptests/editing/Makefile.in
dom/imptests/editing/conformancetest/Makefile.in
dom/imptests/editing/css/Makefile.in
dom/imptests/editing/selecttest/Makefile.in
dom/imptests/failures/editing/conformancetest/Makefile.in
dom/imptests/failures/editing/selecttest/Makefile.in
dom/imptests/failures/html/tests/submission/Opera/microdata/Makefile.in
dom/imptests/failures/webapps/DOMCore/tests/approved/Makefile.in
dom/imptests/failures/webapps/DOMCore/tests/submissions/Opera/Makefile.in
dom/imptests/failures/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
dom/imptests/failures/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
dom/imptests/html/tests/submission/Mozilla/Makefile.in
dom/imptests/html/tests/submission/Opera/microdata/Makefile.in
dom/imptests/webapps/DOMCore/tests/approved/Makefile.in
dom/imptests/webapps/DOMCore/tests/submissions/Opera/Makefile.in
dom/imptests/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/Makefile.in
dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
dom/indexedDB/ipc/Makefile.in
dom/indexedDB/test/Makefile.in
dom/indexedDB/test/unit/Makefile.in
dom/ipc/tests/Makefile.in
dom/network/tests/Makefile.in
dom/plugins/test/mochitest/Makefile.in
dom/power/test/Makefile.in
dom/settings/tests/Makefile.in
dom/sms/tests/Makefile.in
dom/src/foo/Makefile.in
dom/src/json/test/Makefile.in
dom/src/jsurl/test/Makefile.in
dom/system/tests/Makefile.in
dom/tests/mochitest/ajax/jquery/Makefile.in
dom/tests/mochitest/ajax/jquery/dist/Makefile.in
dom/tests/mochitest/ajax/jquery/test/Makefile.in
dom/tests/mochitest/ajax/jquery/test/data/Makefile.in
dom/tests/mochitest/ajax/jquery/test/data/offset/Makefile.in
dom/tests/mochitest/ajax/jquery/test/unit/Makefile.in
dom/tests/mochitest/ajax/lib/Makefile.in
dom/tests/mochitest/ajax/mochikit/Makefile.in
dom/tests/mochitest/ajax/mochikit/MochiKit/Makefile.in
dom/tests/mochitest/ajax/mochikit/tests/Makefile.in
dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/Makefile.in
dom/tests/mochitest/ajax/offline/Makefile.in
dom/tests/mochitest/ajax/offline/namespace1/Makefile.in
dom/tests/mochitest/ajax/offline/namespace1/sub/Makefile.in
dom/tests/mochitest/ajax/offline/namespace1/sub2/Makefile.in
dom/tests/mochitest/ajax/offline/namespace2/Makefile.in
dom/tests/mochitest/ajax/prototype/Makefile.in
dom/tests/mochitest/ajax/prototype/dist/Makefile.in
dom/tests/mochitest/ajax/prototype/test/Makefile.in
dom/tests/mochitest/ajax/prototype/test/functional/Makefile.in
dom/tests/mochitest/ajax/prototype/test/lib/Makefile.in
dom/tests/mochitest/ajax/prototype/test/unit/Makefile.in
dom/tests/mochitest/ajax/prototype/test/unit/fixtures/Makefile.in
dom/tests/mochitest/ajax/prototype/test/unit/tmp/Makefile.in
dom/tests/mochitest/ajax/scriptaculous/Makefile.in
dom/tests/mochitest/ajax/scriptaculous/lib/Makefile.in
dom/tests/mochitest/ajax/scriptaculous/src/Makefile.in
dom/tests/mochitest/ajax/scriptaculous/test/unit/Makefile.in
dom/tests/mochitest/bugs/Makefile.in
dom/tests/mochitest/chrome/Makefile.in
dom/tests/mochitest/dom-level0/Makefile.in
dom/tests/mochitest/dom-level1-core/Makefile.in
dom/tests/mochitest/dom-level1-core/files/Makefile.in
dom/tests/mochitest/dom-level2-core/Makefile.in
dom/tests/mochitest/dom-level2-core/files/Makefile.in
dom/tests/mochitest/dom-level2-html/Makefile.in
dom/tests/mochitest/dom-level2-html/files/Makefile.in
dom/tests/mochitest/general/Makefile.in
dom/tests/mochitest/geolocation/Makefile.in
dom/tests/mochitest/localstorage/Makefile.in
dom/tests/mochitest/notification/Makefile.in
dom/tests/mochitest/orientation/Makefile.in
dom/tests/mochitest/pointerlock/Makefile.in
dom/tests/mochitest/sessionstorage/Makefile.in
dom/tests/mochitest/storageevent/Makefile.in
dom/tests/mochitest/webapps/Makefile.in
dom/tests/mochitest/webapps/apps/Makefile.in
dom/tests/mochitest/whatwg/Makefile.in
dom/workers/test/Makefile.in
editor/composer/test/Makefile.in
editor/libeditor/base/tests/Makefile.in
editor/libeditor/html/tests/Makefile.in
editor/libeditor/text/tests/Makefile.in
embedding/test/Makefile.in
extensions/cookie/test/Makefile.in
extensions/spellcheck/tests/chrome/Makefile.in
extensions/spellcheck/tests/chrome/base/Makefile.in
extensions/spellcheck/tests/chrome/map/Makefile.in
extensions/universalchardet/tests/Makefile.in
gfx/tests/Makefile.in
image/test/mochitest/Makefile.in
intl/uconv/tests/Makefile.in
js/jsd/test/Makefile.in
js/src/config/makefiles/mochitest.mk
js/src/config/rules.mk
js/xpconnect/tests/chrome/Makefile.in
js/xpconnect/tests/mochitest/Makefile.in
layout/base/tests/Makefile.in
layout/base/tests/chrome/Makefile.in
layout/forms/test/Makefile.in
layout/generic/test/Makefile.in
layout/inspector/tests/Makefile.in
layout/inspector/tests/chrome/Makefile.in
layout/mathml/tests/Makefile.in
layout/style/test/Makefile.in
layout/style/test/chrome/Makefile.in
layout/tables/test/Makefile.in
layout/xul/base/test/Makefile.in
layout/xul/test/Makefile.in
mobile/xul/chrome/tests/Makefile.in
modules/libjar/test/chrome/Makefile.in
modules/libjar/test/mochitest/Makefile.in
netwerk/test/browser/Makefile.in
parser/htmlparser/tests/mochitest/Makefile.in
parser/htmlparser/tests/mochitest/dir_bug534293/Makefile.in
parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile.in
parser/htmlparser/tests/mochitest/html5lib_tree_construction/scripted/Makefile.in
security/manager/ssl/tests/mochitest/bugs/Makefile.in
security/manager/ssl/tests/mochitest/mixedcontent/Makefile.in
security/manager/ssl/tests/mochitest/stricttransportsecurity/Makefile.in
services/aitc/tests/Makefile.in
testing/mochitest/tests/browser/Makefile.in
toolkit/components/aboutmemory/tests/Makefile.in
toolkit/components/alerts/test/Makefile.in
toolkit/components/ctypes/tests/Makefile.in
toolkit/components/downloads/test/browser/Makefile.in
toolkit/components/feeds/test/Makefile.in
toolkit/components/osfile/tests/mochi/Makefile.in
toolkit/components/passwordmgr/test/Makefile.in
toolkit/components/passwordmgr/test/browser/Makefile.in
toolkit/components/perf/Makefile.in
toolkit/components/places/tests/Makefile.in
toolkit/components/places/tests/browser/Makefile.in
toolkit/components/places/tests/chrome/Makefile.in
toolkit/components/places/tests/mochitest/bug_411966/Makefile.in
toolkit/components/places/tests/mochitest/bug_461710/Makefile.in
toolkit/components/prompts/test/Makefile.in
toolkit/components/satchel/test/Makefile.in
toolkit/components/social/test/browser/Makefile.in
toolkit/components/startup/tests/browser/Makefile.in
toolkit/components/url-classifier/tests/mochitest/Makefile.in
toolkit/components/viewsource/test/Makefile.in
toolkit/components/viewsource/test/browser/Makefile.in
toolkit/content/tests/browser/Makefile.in
toolkit/content/tests/browser/common/Makefile.in
toolkit/content/tests/browser/data/Makefile.in
toolkit/content/tests/chrome/Makefile.in
toolkit/content/tests/widgets/Makefile.in
toolkit/crashreporter/test/Makefile.in
toolkit/identity/tests/chrome/Makefile.in
toolkit/mozapps/downloads/tests/chrome/Makefile.in
toolkit/mozapps/extensions/test/browser/Makefile.in
toolkit/mozapps/extensions/test/mochitest/Makefile.in
toolkit/mozapps/extensions/test/xpinstall/Makefile.in
toolkit/mozapps/shared/test/chrome/Makefile.in
toolkit/mozapps/update/test/chrome/Makefile.in
toolkit/profile/test/Makefile.in
toolkit/themes/pinstripe/mochitests/Makefile.in
toolkit/xre/test/Makefile.in
uriloader/exthandler/tests/mochitest/Makefile.in
webapprt/test/chrome/Makefile.in
webapprt/test/content/Makefile.in
widget/tests/Makefile.in
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -31,19 +31,18 @@ DIRS	= \
   textcaret \
   textselection \
   tree \
   treeupdate \
   value \
   $(null)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		formimage.png \
 		letters.gif \
 		moz.png \
 		$(topsrcdir)/content/media/test/bug461281.ogg \
 		longdesc_src.html \
 		actions.js \
 		attributes.js \
 		autocomplete.js \
@@ -69,10 +68,9 @@ include $(topsrcdir)/config/rules.mk
 		test_textboxes.html \
 		test_textboxes.xul \
 		testTextboxes.js \
 		text.js \
 		treeview.css \
 		treeview.js \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/actions/Makefile.in
+++ b/accessible/tests/mochitest/actions/Makefile.in
@@ -5,27 +5,25 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/actions
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_anchors.html \
 		test_aria.html \
 		test_general.html \
 		test_general.xul \
 		test_controls.html \
 		test_keys_menu.xul \
 		test_keys.html \
 		test_link.html \
 		test_media.html \
 		test_select.html \
 		test_tree.xul \
 		test_treegrid.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/attributes/Makefile.in
+++ b/accessible/tests/mochitest/attributes/Makefile.in
@@ -5,24 +5,22 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/attributes
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_obj.html \
 		test_obj_css.html \
 		test_obj_css.xul \
 		test_obj_group.html \
 		test_obj_group.xul \
 		test_obj_group_tree.xul \
 		test_tag.html \
 		test_text.html \
 		test_xml-roles.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/bounds/Makefile.in
+++ b/accessible/tests/mochitest/bounds/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/bounds
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_list.html \
 		test_select.html \
 		test_zoom.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/editabletext/Makefile.in
+++ b/accessible/tests/mochitest/editabletext/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/editabletext
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		editabletext.js \
 		test_1.html \
 		test_2.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/elm/Makefile.in
+++ b/accessible/tests/mochitest/elm/Makefile.in
@@ -5,19 +5,17 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/elm
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_figure.html \
 		test_listbox.xul \
 		test_nsApplicationAcc.html \
 		test_plugin.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/events/Makefile.in
+++ b/accessible/tests/mochitest/events/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/events
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		docload_wnd.html \
 		focus.html \
 		scroll.html \
 		test_aria_alert.html \
 		test_aria_menu.html \
 		test_aria_objattr.html \
 		test_aria_statechange.html \
 		test_attrs.html \
@@ -57,10 +56,9 @@ include $(topsrcdir)/config/rules.mk
 		test_statechange.html \
 		test_text_alg.html \
 		test_text.html \
 		test_textattrchange.html \
 		test_tree.xul \
 		test_valuechange.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/focus/Makefile.in
+++ b/accessible/tests/mochitest/focus/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/focus
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_focusedChild.html \
 		test_takeFocus.html \
 		test_takeFocus.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/hittest/Makefile.in
+++ b/accessible/tests/mochitest/hittest/Makefile.in
@@ -5,20 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hittest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		test_browser.html \
 		test_general.html \
 		test_zoom_tree.xul \
 		test_zoom.html \
 		zoom_tree.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/hyperlink/Makefile.in
+++ b/accessible/tests/mochitest/hyperlink/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hyperlink
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		hyperlink.js \
 		test_general.html \
 		test_general.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/hypertext/Makefile.in
+++ b/accessible/tests/mochitest/hypertext/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/hypertext
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		test_general.html \
 		test_update.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/name/Makefile.in
+++ b/accessible/tests/mochitest/name/Makefile.in
@@ -5,27 +5,25 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/name
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		general.css \
 		general.xbl \
 		markup.js \
 		test_button.html \
 		test_general.html \
 		test_general.xul \
 		test_link.html \
 		test_list.html \
 		test_markup.html \
 		test_browserui.xul \
 		test_tree.xul \
 		markuprules.xml \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/pivot/Makefile.in
+++ b/accessible/tests/mochitest/pivot/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/pivot
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		doc_virtualcursor.html \
 		test_virtualcursor.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/relations/Makefile.in
+++ b/accessible/tests/mochitest/relations/Makefile.in
@@ -5,23 +5,21 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/relations
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_bindings.xhtml \
 		test_embeds.xul \
 		test_general.html \
 		test_general.xul \
 		test_tabbrowser.xul \
 		test_tree.xul \
 		test_ui_modalprompt.html \
 		test_update.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/role/Makefile.in
+++ b/accessible/tests/mochitest/role/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/role
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_aria.html \
 		test_aria.xul \
 		test_general.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/selectable/Makefile.in
+++ b/accessible/tests/mochitest/selectable/Makefile.in
@@ -5,21 +5,19 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/selectable
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_aria.html \
 		test_listbox.xul \
 		test_menu.xul \
 		test_menulist.xul \
 		test_select.html \
 		test_tree.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/states/Makefile.in
+++ b/accessible/tests/mochitest/states/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/states
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_aria.html \
 		test_aria_imgmap.html \
 		test_aria_widgetitems.html \
 		test_buttons.html \
 		test_controls.html \
 		test_controls.xul \
 		test_doc.html \
 		test_docarticle.html \
@@ -34,10 +33,9 @@ include $(topsrcdir)/config/rules.mk
 		test_visibility.html \
 		z_frames.html \
 		z_frames_article.html \
 		z_frames_checkbox.html \
 		z_frames_textbox.html \
 		z_frames_update.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/table/Makefile.in
+++ b/accessible/tests/mochitest/table/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/table
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		test_headers_ariagrid.html \
 		test_headers_listbox.xul \
 		test_headers_table.html \
 		test_headers_tree.xul \
 		test_indexes_ariagrid.html \
 		test_indexes_listbox.xul \
 		test_indexes_table.html \
 		test_indexes_tree.xul \
@@ -30,10 +29,9 @@ include $(topsrcdir)/config/rules.mk
 		test_struct_ariatreegrid.html \
 		test_struct_listbox.xul \
 		test_struct_table.html \
 		test_struct_tree.xul \
 		test_table_1.html \
 		test_table_2.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/text/Makefile.in
+++ b/accessible/tests/mochitest/text/Makefile.in
@@ -5,23 +5,21 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/text
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		doc.html \
 		test_doc.html \
 		test_hypertext.html \
 		test_passwords.html \
 		test_selection.html \
 		test_singleline.html \
 		test_whitespaces.html \
 		test_words.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/textcaret/Makefile.in
+++ b/accessible/tests/mochitest/textcaret/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/textcaret
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		test_browserui.xul \
 		test_general.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/textselection/Makefile.in
+++ b/accessible/tests/mochitest/textselection/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/textselection
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_A11Y_FILES = \
 		test_general.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/tree/Makefile.in
+++ b/accessible/tests/mochitest/tree/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/tree
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		dockids.html \
 	$(warning test_applicationacc.xul temporarily disabled, see bug 561508) \
 		test_aria_globals.html \
 		test_aria_imgmap.html \
 		test_aria_presentation.html \
 		test_button.xul \
 		test_canvas.html \
 		test_combobox.xul \
@@ -41,10 +40,9 @@ include $(topsrcdir)/config/rules.mk
 		test_table.html \
 		test_tree.xul \
 		test_txtcntr.html \
 		test_txtctrl.html \
 		test_txtctrl.xul \
 		wnd.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/treeupdate/Makefile.in
+++ b/accessible/tests/mochitest/treeupdate/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/treeupdate
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_ariadialog.html \
 		test_canvas.html \
 		test_colorpicker.xul \
 		test_cssoverflow.html \
 		test_contextmenu.xul \
 		test_doc.html \
 		test_gencontent.html \
 		test_hidden.html \
@@ -29,10 +28,9 @@ include $(topsrcdir)/config/rules.mk
 		test_menubutton.xul \
 		test_recreation.html \
 		test_select.html \
 		test_textleaf.html \
 		test_visibility.html \
 		test_whitespace.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/accessible/tests/mochitest/value/Makefile.in
+++ b/accessible/tests/mochitest/value/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/value
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_A11Y_FILES =\
 		test_general.html \
 		test_progress.html \
 		test_progress.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -8,19 +8,18 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = browser/base/content/test
 
 DIRS += \
 		newtab \
 		$(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_feed_discovery.html \
 		feed_discovery.html \
 		test_bug395533.html \
 		bug395533-data.txt \
 		ctxmenu-image.png \
 		video.ogg \
 		test_offlineNotification.html \
 		offlineChild.html \
@@ -39,17 +38,17 @@ include $(topsrcdir)/config/rules.mk
 		gZipOfflineChild.html \
 		gZipOfflineChild.html^headers^ \
 		gZipOfflineChild.cacheManifest \
 		gZipOfflineChild.cacheManifest^headers^ \
 		$(NULL)
 
 # test_contextmenu.html is disabled on Linux due to bug 513558
 ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		audio.ogg \
 		test_contextmenu.html \
 		subtst_contextmenu.html \
 		$(NULL)
 endif
 
 # The following tests are disabled because they are unreliable:
 #   browser_bug423833.js is bug 428712
@@ -266,13 +265,12 @@ else
 		browser_bug565667.js \
 		$(NULL)
 
 # TODO: Activate after carbon test plugin lands, bug 628651
 # 		browser_maconly_carbon_mismatch_plugin.js \
 
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
 libs::	$(_BROWSER_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
--- a/browser/components/downloads/test/browser/Makefile.in
+++ b/browser/components/downloads/test/browser/Makefile.in
@@ -4,17 +4,15 @@
 DEPTH     = ../../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 
 relativesrcdir = browser/components/downloads/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_basic_functionality.js \
   head.js \
   $(NULL)
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/feeds/test/Makefile.in
+++ b/browser/components/feeds/test/Makefile.in
@@ -12,23 +12,20 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_feeds
 XPCSHELL_TESTS	= unit
 
 DIRS = \
 	chrome \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES =	bug408328-data.xml \
+MOCHITEST_FILES =	bug408328-data.xml \
 		bug368464-data.xml \
 		test_bug494328.html \
 		bug494328-data.xml \
 		test_bug589543.html \
 		bug589543-data.xml \
 		test_registerHandler.html \
 		valid-feed.xml \
 		valid-unsniffable-feed.xml \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/feeds/test/chrome/Makefile.in
+++ b/browser/components/feeds/test/chrome/Makefile.in
@@ -5,28 +5,23 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = browser/components/feeds/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # sample_feed.atom was copied from toolkit/components/places/tests/chrome
-_HTTP_FILES	= \
+MOCHITEST_FILES	= \
 		sample_feed.atom \
 		$(NULL)
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_423060.xul \
 		test_bug368464.html \
 		test_bug408328.html \
 		test_maxSniffing.html \
 		$(NULL)
 
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/browser/components/places/tests/browser/Makefile.in
+++ b/browser/components/places/tests/browser/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH			= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
 relativesrcdir  = browser/components/places/tests/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	head.js \
 	browser_0_library_left_pane_migration.js \
 	browser_library_left_pane_fixnames.js \
 	browser_425884.js \
 	browser_475045.js \
 	browser_423515.js \
 	browser_410196_paste_into_tags.js \
 	browser_sort_in_library.js \
@@ -40,10 +39,9 @@ include $(topsrcdir)/config/rules.mk
 	frameRight.html \
 	browser_toolbar_migration.js \
 	browser_library_batch_delete.js \
 	browser_555547.js \
 	browser_416459_cut.js \
 	browser_library_downloads.js \
 	$(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/places/tests/chrome/Makefile.in
+++ b/browser/components/places/tests/chrome/Makefile.in
@@ -4,24 +4,22 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = browser/components/places/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 	test_treeview_date.xul \
 	test_bug485100-change-case-loses-tag.xul \
 	test_bug427633_no_newfolder_if_noip.xul \
 	test_0_multiple_left_pane.xul \
 	test_0_bug510634.xul \
 	test_bug549192.xul \
 	test_bug549491.xul \
 	test_editBookmarkOverlay_tags_liveUpdate.xul \
 	test_bug631374_tags_selector_scroll.xul \
 	$(NULL)
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/privatebrowsing/test/browser/Makefile.in
+++ b/browser/components/privatebrowsing/test/browser/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = browser/components/privatebrowsing/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES =  \
+MOCHITEST_BROWSER_FILES =  \
 		head.js \
 		browser_console_clear.js \
 		browser_privatebrowsing_certexceptionsui.js \
 		browser_privatebrowsing_commandline_toggle.js \
 		browser_privatebrowsing_concurrent.js \
 		browser_privatebrowsing_concurrent_page.html \
 		browser_privatebrowsing_crh.js \
 		browser_privatebrowsing_fastswitch.js \
@@ -62,16 +61,15 @@ include $(topsrcdir)/config/rules.mk
 		title.sjs \
 		$(NULL)
 
 # Disabled until bug 564934 is fixed:
 #		browser_privatebrowsing_downloadmonitor.js \
 
 # Turn off private browsing tests that perma-timeout on Linux.
 ifneq (Linux,$(OS_ARCH))
-_BROWSER_TEST_FILES += \
+MOCHITEST_BROWSER_FILES += \
 		browser_privatebrowsing_beforeunload.js \
 		browser_privatebrowsing_cookieacceptdialog.js \
 		$(NULL)
 endif
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/search/test/Makefile.in
+++ b/browser/components/search/test/Makefile.in
@@ -4,26 +4,24 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  =  browser/components/search/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = 	  browser_405664.js \
+MOCHITEST_BROWSER_FILES = 	  browser_405664.js \
 	                  browser_addEngine.js \
 	                  browser_contextmenu.js \
 	                  testEngine.xml \
 	                  testEngine_mozsearch.xml \
 	                  testEngine.src \
 	                  browser_426329.js \
 	                  426329.xml \
 	                  browser_483086.js \
 	                  483086-1.xml \
 	                  483086-2.xml \
 	                  test.html \
 	                  $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/sessionstore/test/Makefile.in
+++ b/browser/components/sessionstore/test/Makefile.in
@@ -4,24 +4,23 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = browser/components/sessionstore/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # browser_506482.js is disabled because of frequent failures (bug 538672)
 # browser_526613.js is disabled because of frequent failures (bug 534489)
 # browser_589246.js is disabled for leaking browser windows (bug 752467)
 # browser_580512.js is disabled for leaking browser windows (bug 752467)
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	head.js \
 	browser_form_restore_events.js \
 	browser_form_restore_events_sample.html \
 	browser_formdata_format.js \
 	browser_formdata_format_sample.html \
 	browser_248970_a.js \
 	browser_248970_b.js \
 	browser_248970_b_sample.html \
@@ -133,16 +132,15 @@ include $(topsrcdir)/config/rules.mk
 	browser_705597.js \
 	browser_707862.js \
 	browser_739531.js \
 	browser_739531_sample.html \
 	browser_739805.js \
 	$(NULL)
 
 ifneq ($(OS_ARCH),Darwin)
-_BROWSER_TEST_FILES += \
+MOCHITEST_BROWSER_FILES += \
 	browser_597071.js \
 	browser_625016.js \
 	$(NULL)
 endif
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/shell/test/Makefile.in
+++ b/browser/components/shell/test/Makefile.in
@@ -8,16 +8,14 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = browser/components/shell/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= test_browser_shell
 XPCSHELL_TESTS	= unit
 
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = browser_420786.js \
+MOCHITEST_BROWSER_FILES = browser_420786.js \
     browser_633221.js \
 	$(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/components/test/Makefile.in
+++ b/browser/components/test/Makefile.in
@@ -4,16 +4,14 @@
 
 DEPTH     = ../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = browser/components/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_bug538331.js \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/commandline/test/Makefile.in
+++ b/browser/devtools/commandline/test/Makefile.in
@@ -5,36 +5,31 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = browser/devtools/commandline/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_gcli_break.js \
   browser_gcli_commands.js \
   browser_gcli_edit.js \
   browser_gcli_inspect.js \
   browser_gcli_integrate.js \
   browser_gcli_pref.js \
   browser_gcli_settings.js \
   browser_gcli_web.js \
   head.js \
   $(NULL)
 
-_BROWSER_TEST_PAGES = \
+MOCHITEST_BROWSER_FILES += \
   browser_gcli_break.html \
   browser_gcli_inspect.html \
   resources_inpage.js \
   resources_inpage1.css \
   resources_inpage2.css \
   resources.html \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_PAGES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/debugger/test/Makefile.in
+++ b/browser/devtools/debugger/test/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH           = ../../../..
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 relativesrcdir  = browser/devtools/debugger/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_TESTS = \
 	browser_dbg_createRemote.js \
 	browser_dbg_createChrome.js \
 	browser_dbg_debugger-tab-switch.js \
 	browser_dbg_debugger-tab-switch-window.js \
 	browser_dbg_debuggerstatement.js \
 	browser_dbg_listtabs.js \
 	browser_dbg_tabactor-01.js \
 	browser_dbg_tabactor-02.js \
@@ -56,30 +55,28 @@ include $(topsrcdir)/config/rules.mk
 	browser_dbg_displayName.js \
 	browser_dbg_iframes.js \
 	browser_dbg_pause-exceptions.js \
 	browser_dbg_multiple-windows.js \
 	browser_dbg_menustatus.js \
 	head.js \
 	$(NULL)
 
-_BROWSER_TEST_PAGES = \
+MOCHITEST_BROWSER_PAGES = \
 	browser_dbg_tab1.html \
 	browser_dbg_tab2.html \
 	browser_dbg_debuggerstatement.html \
 	browser_dbg_stack.html \
 	browser_dbg_script-switching.html \
 	test-script-switching-01.js \
 	test-script-switching-02.js \
 	browser_dbg_frame-parameters.html \
 	browser_dbg_update-editor-mode.html \
 	test-editor-mode \
 	browser_dbg_displayName.html \
 	browser_dbg_iframes.html \
 	browser_dbg_with-frame.html \
 	browser_dbg_pause-exceptions.html \
 	$(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+MOCHITEST_BROWSER_FILES_PARTS = MOCHITEST_BROWSER_TESTS MOCHITEST_BROWSER_PAGES
 
-libs:: $(_BROWSER_TEST_PAGES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/scratchpad/test/Makefile.in
+++ b/browser/devtools/scratchpad/test/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH			= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
 relativesrcdir  = browser/devtools/scratchpad/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_scratchpad_initialization.js \
 		browser_scratchpad_contexts.js \
 		browser_scratchpad_tab_switch.js \
 		browser_scratchpad_execute_print.js \
 		browser_scratchpad_inspect.js \
 		browser_scratchpad_files.js \
 		browser_scratchpad_ui.js \
 		browser_scratchpad_bug_646070_chrome_context_pref.js \
@@ -30,10 +29,9 @@ include $(topsrcdir)/config/rules.mk
 		browser_scratchpad_bug684546_reset_undo.js \
 		browser_scratchpad_bug690552_display_outputs_errors.js \
 		browser_scratchpad_bug650345_find_ui.js \
 		browser_scratchpad_bug714942_goto_line_ui.js \
 		browser_scratchpad_bug_650760_help_key.js \
 		browser_scratchpad_bug_651942_recent_files.js \
 		head.js \
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/shared/test/Makefile.in
+++ b/browser/devtools/shared/test/Makefile.in
@@ -5,35 +5,30 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = browser/devtools/shared/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_browser_basic.js \
   browser_promise_basic.js \
   browser_require_basic.js \
   browser_templater_basic.js \
   browser_toolbar_basic.js \
   browser_toolbar_tooltip.js \
   browser_toolbar_webconsole_errors_count.js \
   browser_layoutHelpers.js \
   head.js \
   $(NULL)
 
-_BROWSER_TEST_PAGES = \
+MOCHITEST_BROWSER_FILES += \
   browser_templater_basic.html \
   browser_toolbar_basic.html \
   browser_toolbar_webconsole_errors_count.html \
   browser_layoutHelpers.html \
   browser_layoutHelpers_iframe.html \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_PAGES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/sourceeditor/test/Makefile.in
+++ b/browser/devtools/sourceeditor/test/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir = browser/devtools/sourceeditor/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_sourceeditor_initialization.js \
 		browser_bug684862_paste_html.js \
 		browser_bug687573_vscroll.js \
 		browser_bug687568_pagescroll.js \
 		browser_bug687580_drag_and_drop.js \
 		browser_bug684546_reset_undo.js \
 		browser_bug695035_middle_click_paste.js \
 		browser_bug687160_line_api.js \
@@ -28,10 +27,9 @@ include $(topsrcdir)/config/rules.mk
 		browser_bug725618_moveLines_shortcut.js \
 		browser_bug700893_dirty_state.js \
 		browser_bug729480_line_vertical_align.js \
 		browser_bug725430_comment_uncomment.js \
 		browser_bug731721_debugger_stepping.js \
 		browser_bug729960_block_bracket_jump.js \
 		head.js \
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/styleinspector/test/Makefile.in
+++ b/browser/devtools/styleinspector/test/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = browser/devtools/styleinspector/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_styleinspector.js \
   browser_bug683672.js \
   browser_styleinspector_bug_672746_default_styles.js \
   browser_styleinspector_bug_672744_search_filter.js \
   browser_bug589375_keybindings.js \
   browser_styleinspector_bug_689759_no_results_placeholder.js \
   browser_bug_692400_element_style.js \
   browser_csslogic_inherited.js \
@@ -35,25 +34,21 @@ include $(topsrcdir)/config/rules.mk
   browser_bug_592743_specificity.js \
   browser_ruleview_bug_703643_context_menu_copy.js \
   browser_computedview_bug_703643_context_menu_copy.js \
   browser_ruleview_734259_style_editor_link.js \
   browser_computedview_734259_style_editor_link.js \
   head.js \
   $(NULL)
 
-_BROWSER_TEST_PAGES = \
+MOCHITEST_BROWSER_FILES += \
   browser_bug683672.html \
   browser_bug705707_is_content_stylesheet.html \
   browser_bug705707_is_content_stylesheet_imported.css \
   browser_bug705707_is_content_stylesheet_imported2.css \
   browser_bug705707_is_content_stylesheet_linked.css \
   browser_bug705707_is_content_stylesheet_script.css \
   browser_bug705707_is_content_stylesheet.xul \
   browser_bug705707_is_content_stylesheet_xul.css \
   browser_bug722196_identify_media_queries.html \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_PAGES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/tilt/test/Makefile.in
+++ b/browser/devtools/tilt/test/Makefile.in
@@ -4,23 +4,22 @@
 
 DEPTH			= ../../../..
 topsrcdir		= @top_srcdir@
 srcdir			= @srcdir@
 VPATH			= @srcdir@
 relativesrcdir 	= browser/devtools/tilt/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = head.js
+MOCHITEST_BROWSER_FILES = head.js
 
 # browser_tilt* disabled on Linux due to bug 759157
 ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
-_BROWSER_TEST_FILES += \
+MOCHITEST_BROWSER_FILES += \
 	browser_tilt_01_lazy_getter.js \
 	browser_tilt_02_notifications-seq.js \
 	browser_tilt_02_notifications.js \
 	browser_tilt_03_tab_switch.js \
 	browser_tilt_04_initialization-key.js \
 	browser_tilt_04_initialization.js \
 	browser_tilt_05_destruction-esc.js \
 	browser_tilt_05_destruction-url.js \
@@ -57,10 +56,9 @@ ifneq (gtk2,$(MOZ_WIDGET_TOOLKIT))
 	browser_tilt_utils04.js \
 	browser_tilt_utils05.js \
 	browser_tilt_utils06.js \
 	browser_tilt_visualizer.js \
 	browser_tilt_zoom.js \
 	$(NULL)
 endif
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/devtools/webconsole/test/Makefile.in
+++ b/browser/devtools/webconsole/test/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH			= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH			= @srcdir@
 relativesrcdir  = browser/devtools/webconsole/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	browser_webconsole_notifications.js \
 	browser_webconsole_message_node_id.js \
 	browser_webconsole_bug_580030_errors_after_page_reload.js \
 	browser_webconsole_basic_net_logging.js \
 	browser_webconsole_bug_579412_input_focus.js \
 	browser_webconsole_bug_580001_closing_after_completion.js \
 	browser_webconsole_bug_580400_groups.js \
 	browser_webconsole_bug_588730_text_node_insertion.js \
@@ -108,17 +107,17 @@ include $(topsrcdir)/config/rules.mk
 	browser_webconsole_bug_622303_persistent_filters.js \
 	browser_webconsole_window_zombie.js \
 	browser_cached_messages.js \
 	browser_bug664688_sandbox_update_after_navigation.js \
 	browser_webconsole_menustatus.js \
 	head.js \
 	$(NULL)
 
-_BROWSER_TEST_PAGES = \
+MOCHITEST_BROWSER_FILES += \
 	test-console.html \
 	test-network.html \
 	test-network-request.html \
 	test-mutation.html \
 	testscript.js \
 	test-filter.html \
 	test-observe-http-ajax.html \
 	test-data.json \
@@ -179,13 +178,9 @@ include $(topsrcdir)/config/rules.mk
 	test-bug-632275-getters.html \
 	test-bug-646025-console-file-location.html \
 	test-file-location.js \
 	test-bug-658368-time-methods.html \
 	test-webconsole-error-observer.html \
 	test-for-of.html \
 	$(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_PAGES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/browser/extensions/pdfjs/test/Makefile.in
+++ b/browser/extensions/pdfjs/test/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = browser/extensions/pdfjs/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_pdfjs_main.js \
   browser_pdfjs_savedialog.js \
   file_pdfjs_test.pdf \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir) 
+include $(topsrcdir)/config/rules.mk
--- a/caps/tests/mochitest/Makefile.in
+++ b/caps/tests/mochitest/Makefile.in
@@ -5,25 +5,23 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = caps/tests/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug423375.html \
+MOCHITEST_FILES = 	test_bug423375.html \
                 test_bug246699.html \
                 test_bug292789.html \
                 test_bug470804.html \
                 test_disallowInheritPrincipal.html \
                 $(NULL)
 
 test_bug292789.html : % : %.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py \
 	     $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $< > $@
 
 GARBAGE += test_bug292789.html
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/config/makefiles/mochitest.mk
@@ -0,0 +1,60 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# 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/.
+
+ifndef INCLUDED_TESTS_MOCHITEST_MK #{
+
+ifdef relativesrcdir
+  mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir)
+else
+  mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir))
+endif
+
+define mochitest-libs-rule-template
+libs:: $$($(1))
+	$$(INSTALL) $$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2))
+endef
+
+# Provide support for modules with such a large number of tests that
+# installing them with a single $(INSTALL) invocation would overflow
+# command-line length limits on some operating systems.
+ifdef MOCHITEST_FILES_PARTS
+ifdef MOCHITEST_FILES
+$(error You must define only one of MOCHITEST_FILES_PARTS or MOCHITEST_FILES)
+endif
+$(foreach part,$(MOCHITEST_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),tests)))
+endif
+
+ifdef MOCHITEST_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_FILES,tests))
+endif
+
+ifdef MOCHITEST_CHROME_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_CHROME_FILES,chrome))
+endif
+
+ifdef MOCHITEST_BROWSER_FILES_PARTS
+ifdef MOCHITEST_BROWSER_FILES
+$(error You must define only one of MOCHITEST_BROWSER_FILES_PARTS or MOCHITEST_BROWSER_FILES)
+endif
+$(foreach part,$(MOCHITEST_BROWSER_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),browser)))
+endif
+
+ifdef MOCHITEST_BROWSER_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_BROWSER_FILES,browser))
+endif
+
+ifdef MOCHITEST_A11Y_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y))
+endif
+
+ifdef MOCHITEST_WEBAPPRT_CHROME_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome))
+endif
+
+INCLUDED_TESTS_MOCHITEST_MK := 1
+
+endif #} INCLUDED_TESTS_MOCHITEST_MK
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -84,16 +84,20 @@ ifdef ENABLE_TESTS
 # that changes to tests may not be updated and code could assume to pass
 # locally against non-current test code.
 DIRS += $(TEST_DIRS)
 
 ifndef INCLUDED_TESTS_XPCSHELL_MK #{
   include $(topsrcdir)/config/makefiles/xpcshell.mk
 endif #}
 
+ifndef INCLUDED_TESTS_MOCHITEST_MK #{
+  include $(topsrcdir)/config/makefiles/mochitest.mk
+endif #}
+
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 INCLUDES += -I$(DIST)/include/testing
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -28,21 +28,20 @@ CPP_UNIT_TESTS = \
 XPCSHELL_TESTS = \
                unit \
                $(NULL)
 # FIXME/bug 575918: out-of-process xpcshell is broken on OS X
 ifneq ($(OS_ARCH),Darwin)
 XPCSHELL_TESTS += unit_ipc
 endif
 
-include $(topsrcdir)/config/rules.mk
 
 # Split files arbitrarily in two groups to not run into too-long command lines
 # which break on Windows (see bug 563151)
-_TEST_FILES1 = \
+MOCHITEST_FILES_A = \
 		responseIdentical.sjs \
 		test_bug5141.html \
 		test_bug51034.html \
 		test_bug166235.html \
 		test_bug199959.html \
 		test_bug218236.html \
 		file_bug218236_multipart.txt \
 		file_bug218236_multipart.txt^headers^ \
@@ -253,17 +252,17 @@ include $(topsrcdir)/config/rules.mk
 		file_XHRDocURI.text \
 		file_XHRDocURI.text^headers^ \
 		test_DOMException.html \
 		test_mutationobservers.html \
 		mutationobserver_dialog.html \
 		test_bug744830.html \
 		$(NULL)
 
-_TEST_FILES2 = \
+MOCHITEST_FILES_B = \
 		test_bug459424.html \
 		bug461735-redirect1.sjs \
 		bug461735-redirect2.sjs \
 		bug461735-post-redirect.js \
 		test_bug513194.html \
 		test_bug461735.html \
 		test_bug380418.html \
 		test_bug469304.html \
@@ -552,42 +551,35 @@ include $(topsrcdir)/config/rules.mk
 		test_bug761120.html \
 		test_XHR_onuploadprogress.html \
 		test_XHR_anon.html \
 		file_XHR_anon.sjs \
 		test_XHR_system.html \
 		test_XHR_parameters.html \
 		$(NULL)
 
-_CHROME_FILES =	\
+MOCHITEST_CHROME_FILES =	\
 		test_bug357450.js \
 		$(NULL)
 
+MOCHITEST_FILES_PARTS = $(foreach s,A B,MOCHITEST_FILES_$(s))
+
 # This test fails on the Mac for some reason
 ifneq (,$(filter gtk2 windows,$(MOZ_WIDGET_TOOLKIT)))
-_TEST_FILES2 += 	test_copyimage.html \
+MOCHITEST_FILES_C = 	test_copyimage.html \
 		$(NULL)
+MOCHITEST_FILES_PARTS += MOCHITEST_FILES_C
 endif
 
 # Disabled for now. Mochitest isn't reliable enough for these.
 # test_bug444546.html \
 # bug444546.sjs \
 
 # Disabled due to making the harness time out
 #		test_bug503473.html \
 #		file_bug503473-frame.sjs \
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug593387.js \
 		$(NULL)
 
-libs:: $(_TEST_FILES1)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_TEST_FILES2)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/content/base/test/chrome/Makefile.in
+++ b/content/base/test/chrome/Makefile.in
@@ -4,23 +4,22 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = content/base/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
     bug421622-referer.sjs \
     $(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
     test_bug206691.xul \
     test_bug391728.html \
     file_bug391728.html \
     file_bug391728_2.html \
     test_bug421622.xul \
     test_bug429785.xul \
     test_bug430050.xul \
     test_bug467123.xul \
@@ -41,13 +40,9 @@ include $(topsrcdir)/config/rules.mk
     test_bug599295.html \
     test_bug650776.html \
     test_bug650784.html \
     test_bug752226-3.xul \
     test_bug752226-4.xul \
     test_bug682305.html \
     $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/base/test/websocket_hybi/Makefile.in
+++ b/content/base/test/websocket_hybi/Makefile.in
@@ -5,25 +5,21 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/base/test/websocket_hybi
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 #### MODULE = content
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
     test_send-arraybuffer.html \
     test_send-blob.html \
     file_check-binary-messages_wsh.py \
     test_receive-arraybuffer.html \
     test_receive-blob.html \
     file_binary-frames_wsh.py \
     $(NULL)
 
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/content/canvas/test/Makefile.in
+++ b/content/canvas/test/Makefile.in
@@ -6,18 +6,17 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/canvas/test
 DIRS		+= webgl crossorigin
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-_TEST_FILES_0 = \
+MOCHITEST_FILES = \
 	test_canvas.html \
 	image_transparent50.png \
 	image_redtransparent.png \
 	image_yellow.png \
 	image_anim-poster-gr.png \
 	image_green-16x16.png \
 	image_red-16x16.png \
 	image_green-1x1.png \
@@ -56,17 +55,17 @@ include $(topsrcdir)/config/rules.mk
 	test_canvas_strokeStyle_getter.html \
 	test_bug613794.html \
 	test_bug753758.html \
 	test_drawImage_edge_cases.html \
 	$(NULL)
 
 ifneq (1_Linux,$(MOZ_SUITE)_$(OS_ARCH))
 # This test fails in Suite on Linux for some reason, disable it there
-_TEST_FILES_0 += test_2d.composite.uncovered.image.destination-atop.html
+MOCHITEST_FILES += test_2d.composite.uncovered.image.destination-atop.html
 endif
 
 # xor and lighter aren't well handled by cairo; they mostly work, but we don't want
 # to test that
 #	test_2d.composite.solid.xor.html \
 #	test_2d.composite.solid.lighter.html \
 #	test_2d.composite.transparent.xor.html \
 #	test_2d.composite.transparent.lighter.html \
@@ -76,63 +75,63 @@ endif
 #	test_2d.composite.canvas.lighter.html \
 #	test_2d.composite.clip.xor.html \
 #	test_2d.composite.clip.lighter.html \
 #
 
 # Tests that fail on Mac (possibly because spec is underdefined?).  Bug 407105
 ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 # XXX vlad don't test these anywhere, cairo behaviour changed
-_TEST_FILES_0 += \
+MOCHITEST_FILES += \
 	test_2d.line.join.parallel.html \
 	$(NULL)
 
 # This is an issue with Quartz's handling of radial gradients and some numeric
 # imprecision that results in errors here.
-_TEST_FILES_0 += \
+MOCHITEST_FILES += \
 	test_2d.gradient.radial.inside2.html \
 	test_2d.gradient.radial.inside3.html \
 	test_2d.gradient.radial.outside1.html \
 	test_2d.gradient.radial.cone.front.html \
 	test_2d.gradient.radial.cone.top.html \
 	$(NULL)
 
 # This is another Quartz bug -- closed paths that don't lie fully within the
 # destination bounds seem to have problems with the BEVEL/SQUARE join/cap combo.
 # The joins are rendered as if with MITER; the correct behaviour is also seen
 # if BUTT is used instead of SQUARE.
-_TEST_FILES_0 += test_2d.line.cap.closed.html
+MOCHITEST_FILES += test_2d.line.cap.closed.html
 
 endif
 
 # Tests that fail on non-Mac (bug 407107)
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 
 # still need bug numbers
-_TEST_FILES_0 += \
+MOCHITEST_FILES += \
 	test_2d.composite.uncovered.fill.source-in.html \
 	test_2d.composite.uncovered.fill.destination-in.html \
 	test_2d.composite.uncovered.fill.source-out.html \
 	test_2d.composite.uncovered.fill.destination-atop.html \
 	test_2d.composite.uncovered.pattern.source-in.html \
 	test_2d.composite.uncovered.pattern.destination-in.html \
 	test_2d.composite.uncovered.pattern.source-out.html \
 	test_2d.composite.uncovered.pattern.destination-atop.html \
 	$(NULL)
 
 # still need bug numbers
-_TEST_FILES_0 += \
+MOCHITEST_FILES += \
 	test_2d.gradient.radial.outside2.html \
 	test_2d.gradient.radial.outside3.html \
 	$(NULL)
 
 # still need bug numbers
-_TEST_FILES_0 += test_2d.path.arc.shape.3.html
+MOCHITEST_FILES += test_2d.path.arc.shape.3.html
 
-_TEST_FILES_0 += test_2d.path.rect.selfintersect.html
+MOCHITEST_FILES += test_2d.path.rect.selfintersect.html
 endif
 
 # These tests only pass on Mac OS X >= 10.5; see bug 450114
 # test_2d.gradient.radial.touch1.html \
 # test_2d.gradient.radial.touch2.html \
 # test_2d.gradient.radial.touch3.html \
 # test_2d.gradient.radial.equal.html \
 
@@ -142,10 +141,9 @@ endif
 #	test_2d.gradient.radial.cone.shape2.html \
 #	test_2d.gradient.radial.cone.behind.html \
 #	test_2d.gradient.radial.cone.beside.html \
 
 # This test is bogus according to the spec; see bug 407107
 # test_2d.path.rect.zero.6.html
 
 # split up into groups to work around command-line length limits
-libs:: $(_TEST_FILES_0)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/canvas/test/crossorigin/Makefile.in
+++ b/content/canvas/test/crossorigin/Makefile.in
@@ -5,23 +5,21 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/canvas/test/crossorigin
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-_TEST_FILES = \
+MOCHITEST_FILES = \
 	image-allow-credentials.png \
 	image-allow-credentials.png^headers^ \
 	image-allow-star.png \
 	image-allow-star.png^headers^ \
 	image.png \
 	test_canvas2d_crossorigin.html \
 	test_webgl_crossorigin_textures.html \
 	video.sjs \
 	test_video_crossorigin.html \
 	$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/canvas/test/webgl/Makefile.in
+++ b/content/canvas/test/webgl/Makefile.in
@@ -5,24 +5,24 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/canvas/test/webgl
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_webgl_conformance_test_suite.html \
   00_test_list.txt \
   failing_tests_linux.txt \
   failing_tests_windows.txt \
   failing_tests_mac.txt \
   failing_tests_android.txt \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
+
+libs::
 	$(TAR) -cf - -C $(srcdir) \
 	  resources \
 	  conformance \
 	  | $(TAR) -xf - -C $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/content/events/test/Makefile.in
+++ b/content/events/test/Makefile.in
@@ -5,21 +5,20 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/events/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # Disabled due to timeouts.
 # 		test_bug563329.html
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug226361.xhtml \
 		     bug226361_iframe.xhtml \
 		test_bug238987.html \
 		test_bug288392.html \
 		test_bug299673-1.html \
 		test_bug299673-2.html \
 		     bug299673.js \
 		test_bug322588.html \
@@ -85,35 +84,35 @@ include $(topsrcdir)/config/rules.mk
 		test_bug741666.html \
 		test_dom_keyboard_event.html \
 		test_dom_mouse_event.html \
 		test_bug742376.html \
 		$(NULL)
 
 #bug 585630
 ifneq (mobile,$(MOZ_BUILD_APP))
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_dragstart.html \
 		$(NULL)
 endif
 
 # bug 565245
 ifneq (Linux,$(OS_ARCH))
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug493251.html \
 		$(NULL)
 endif
 
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug603008.html \
 		$(NULL)
 endif
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug336682_2.xul \
 		test_bug336682.js \
 		test_bug350471.xul \
 		test_bug586961.xul \
 		test_bug415498.xul \
 		bug415498-doc1.html \
 		bug415498-doc2.html \
 		test_bug591249.xul \
@@ -122,13 +121,9 @@ endif
 		test_bug602962.xul \
 		test_bug617528.xul \
 		window_bug617528.xul \
 		test_bug679494.xul \
 		file_bug679494.html \
 		test_eventctors.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -17,19 +17,18 @@ include $(DEPTH)/config/autoconf.mk
 # it exists in that case, which we use to detect failure.
 # We can't have index.html in this directory because it would prevent
 # running the tests here.
 TEST_DIRS += bug649134
 
 # For form-related test suite.
 TEST_DIRS += forms
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_hidden.html \
 		test_bug589.html \
 		test_bug691.html \
 		nnc_lockup.gif \
 		test_bug694.html \
 		test_bug696.html \
 		test_bug1297.html \
 		test_bug1366.html \
@@ -263,19 +262,15 @@ include $(topsrcdir)/config/rules.mk
 		test_object_plugin_nav.html \
 		test_bug742030.html \
 		test_bug742549.html \
 		test_bug745685.html \
 		test_input_file_picker.html \
 		test_bug763626.html \
 		$(NULL)
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug649778.js \
 		file_bug649778.html \
 		file_bug649778.html^headers^ \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/html/content/test/bug649134/Makefile.in
+++ b/content/html/content/test/bug649134/Makefile.in
@@ -5,14 +5,12 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = content/html/content/test/bug649134
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = file_bug649134-1.sjs file_bug649134-2.sjs index.html
+MOCHITEST_FILES = file_bug649134-1.sjs file_bug649134-2.sjs index.html
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/html/content/test/forms/Makefile.in
+++ b/content/html/content/test/forms/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = content/html/content/test/forms
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		save_restore_radio_groups.sjs \
 		test_save_restore_radio_groups.html \
 		test_change_event.html \
 		test_mozistextfield.html \
 		test_input_attributes_reflection.html \
 		test_input_list_attribute.html \
 		test_input_email.html \
 		test_input_url.html \
@@ -46,11 +45,10 @@ include $(topsrcdir)/config/rules.mk
 		test_min_attribute.html \
 		test_step_attribute.html \
 		test_stepup_stepdown.html \
 		test_valueasnumber_attribute.html \
 		test_experimental_forms_pref.html \
 		test_input_number_value.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
--- a/content/html/document/test/Makefile.in
+++ b/content/html/document/test/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/html/document/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug1682.html \
+MOCHITEST_FILES = 	test_bug1682.html \
 		test_bug1823.html \
 		test_bug57600.html \
 		test_bug196523.html \
 		bug196523-subframe.html \
 		test_bug199692.html \
 		bug199692-nested.html \
 		bug199692-nested-d2.html \
 		bug199692-popup.html \
@@ -71,21 +70,15 @@ include $(topsrcdir)/config/rules.mk
 		test_bug512367.html \
 		test_bug571981.html \
 		test_bug677495.html \
 		test_bug677495-1.html \
 		test_bug741266.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug592641.js \
 		bug592641_img.jpg \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-ifneq (mobile,$(MOZ_BUILD_APP))
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-endif
+include $(topsrcdir)/config/rules.mk
--- a/content/media/test/Makefile.in
+++ b/content/media/test/Makefile.in
@@ -4,17 +4,16 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= content/media/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # Media tests should be backend independent, i.e., not conditioned on
 # MOZ_OGG, MOZ_WAVE etc. (The only exception is the can_play_type tests,
 # which necessarily depend on the backend(s) configured.) As far as possible,
 # each test should work with any resource type. This makes it
 # easy to add new backends and reduces the amount of test duplication.
 
 # For each supported backend, resources that can be played by that backend
@@ -29,17 +28,17 @@ include $(topsrcdir)/config/rules.mk
 # add it to gPlayTests in manifest.js. To test whether an invalid
 # resource correctly throws an error (and does not cause a crash or hang),
 # just add it to gErrorTests in manifest.js.
 
 # To test for a specific bug in handling a specific resource type,
 # make the test first check canPlayType for the type, and if it's not
 # supported, just do ok(true, "Type not supported") and stop the test.
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		allowed.sjs \
 		can_play_type_ogg.js \
 		can_play_type_wave.js \
 		can_play_type_webm.js \
 		cancellable_request.sjs \
 		dynamic_redirect.sjs \
 		dynamic_resource.sjs \
 		file_access_controls.html \
@@ -120,30 +119,30 @@ include $(topsrcdir)/config/rules.mk
 		test_video_to_canvas.html \
 		use_large_cache.js \
 		test_audiowrite.html \
 		test_mozHasAudio.html \
 		test_source_media.html \
 		$(NULL)
 
 # Bug 759221
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_autoplay_contentEditable.html \
 		test_buffered.html \
 		test_bug448534.html \
 		test_bug463162.xhtml \
 		test_decoder_disable.html \
 		test_media_selection.html \
 		test_playback.html \
 		test_seekLies.html \
 		$(NULL)
 
 # Don't run in suite
 ifndef MOZ_SUITE
-_TEST_FILES += test_play_twice.html
+MOCHITEST_FILES += test_play_twice.html
 else
 $(warning test_play_twice.html is disabled pending investigation. Bug 598252)
 endif
 
 # These tests are disabled until we figure out random failures.
 # When these tests are fixed, we should also make them backend-independent.
 #		test_resume.html \
 # Bug 492821:
@@ -151,17 +150,17 @@ endif
 # Bug 493692:
 #   test_preload_suspend.html
 # Bug 567954 and Bug 574586:
 #   test_mixed_principals.html
 # Disabled since we don't play Wave files standalone, for now
 #		test_audioDocumentTitle.html
 
 # sample files
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		320x240.ogv \
 		448636.ogv \
 		audio-overhang.ogg \
 		audio-gaps.ogg \
 		beta-phrasebook.ogg \
 		bogus.ogv \
 		bug495129.ogv \
 		bug495794.ogg \
@@ -205,51 +204,51 @@ endif
 		sound.ogg \
 		spacestorm-1000Hz-100ms.ogg \
 		video-overhang.ogg \
 		file_a4_tone.ogg \
 		detodos.opus \
 		$(NULL)
 
 # Wave sample files
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		big.wav \
 		bogus.wav \
 		r11025_msadpcm_c1.wav \
 		r11025_s16_c1.wav \
 		r11025_s16_c1_trailing.wav \
 		r11025_u8_c1.wav \
 		r11025_u8_c1_trunc.wav \
 		r16000_u8_c1_list.wav \
 		wavedata_u8.wav \
 		wavedata_s16.wav \
 		audio.wav \
 		$(NULL)
 
 # Other files
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		bogus.duh \
 		$(NULL)
 
 # These tests contain backend-specific tests. Try to write backend
 # independent tests rather than adding to this list.
 ifdef MOZ_OGG
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_ogg.html \
 		noContentLength.sjs \
 		test_seekable3.html \
 		test_a4_tone.html \
 		file_audio_event_adopt_iframe.html \
 		test_audio_event_adopt.html \
 		test_referer.html \
 		test_bug726904.html \
 		$(NULL)
 
 # Bug 759221
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug686137.html \
 		test_contentDuration1.html \
 		test_contentDuration2.html \
 		test_contentDuration3.html \
 		test_contentDuration4.html \
 		test_contentDuration5.html \
 		test_contentDuration6.html \
 		test_contentDuration7.html \
@@ -259,44 +258,43 @@ ifdef MOZ_OGG
 		contentDuration4.sjs \
 		contentDuration5.sjs \
 		contentDuration6.sjs \
 		contentDuration7.sjs \
 		test_framebuffer.html \
 		test_seekable2.html \
 		$(NULL)
 else
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_no_ogg.html \
 		$(NULL)
 endif
 
 ifdef MOZ_WEBM
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_webm.html \
 		$(NULL)
 else
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_no_webm.html \
 		$(NULL)
 endif
 
 ifdef MOZ_WAVE
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_wave.html \
 		$(NULL)
 
 
 # Bug 759221
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_fragment_play.html \
 		test_fragment_noplay.html \
 		test_wave_data_u8.html \
 		test_wave_data_s16.html \
 		$(NULL)
 else
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_can_play_type_no_wave.html \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/smil/test/Makefile.in
+++ b/content/smil/test/Makefile.in
@@ -3,19 +3,18 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/smil/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 	  db_smilAnimateMotion.js \
 	  db_smilCSSFromBy.js \
 	  db_smilCSSFromTo.js \
 	  db_smilCSSPaced.js \
 	  db_smilCSSPropertyList.js \
 	  db_smilMappedAttrList.js \
 	  smilAnimateMotionValueLists.js \
 	  smilTestUtils.js \
@@ -60,10 +59,9 @@ include $(topsrcdir)/config/rules.mk
 	  test_smilUpdatedInterval.xhtml \
 	  test_smilValues.xhtml \
 	  test_smilXHR.xhtml \
 	  $(NULL)
 
 # Tests disabled due to intermittent orange
 # test_smilCSSInherit.xhtml disabled until bug 501183 is fixed
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/svg/content/test/Makefile.in
+++ b/content/svg/content/test/Makefile.in
@@ -5,23 +5,22 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/svg/content/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # Disabled:
 #		bbox-helper.svg \
 #		test_length.xhtml \
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		matrixUtils.js \
 		MutationEventChecker.js \
 		test_a_href_01.xhtml \
 		test_a_href_02.xhtml \
 		a_href_destination.svg \
 		a_href_helper_01.svg \
 		a_href_helper_02_03.svg \
 		a_href_helper_04.svg \
@@ -79,10 +78,9 @@ include $(topsrcdir)/config/rules.mk
 		test_valueAsString.xhtml \
 		test_valueLeaks.xhtml \
 		viewport-helper.svg \
 		test_viewport.html \
 		zoom-helper.svg \
 		test_zoom.xhtml \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/xbl/test/Makefile.in
+++ b/content/xbl/test/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/xbl/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	\
+MOCHITEST_FILES =	\
 		test_bug310107.html \
 		bug310107-resource.xhtml \
 		test_bug366770.html \
 		test_bug371724.xhtml \
 		test_bug372769.xhtml \
 		test_bug378866.xhtml \
 		test_bug397934.xhtml \
 		test_bug389322.xhtml \
@@ -35,23 +34,19 @@ include $(topsrcdir)/config/rules.mk
 		test_bug526178.xhtml \
 		test_bug542406.xhtml \
 		test_bug591198.html \
 		file_bug591198_xbl.xml \
 		file_bug591198_inner.html \
 		test_bug639338.xhtml \
 		$(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug296375.xul \
 		test_bug378518.xul \
 		test_bug398135.xul \
 		test_bug398492.xul \
 		test_bug721452.xul \
 		test_bug723676.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/content/xml/document/test/Makefile.in
+++ b/content/xml/document/test/Makefile.in
@@ -5,25 +5,23 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/xml/document/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug232004.xhtml \
+MOCHITEST_FILES = 	test_bug232004.xhtml \
 		test_bug343870.xhtml \
 		test_bug355213.xhtml \
 		test_bug392338.html \
 		test_bug399502.xhtml \
 		test_bug445330.html \
 		test_viewport.xhtml \
 		test_bug293347.html \
 		file_bug293347.xml \
 		file_bug293347xslt.xml \
 		test_bug691215.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/xslt/tests/mochitest/Makefile.in
+++ b/content/xslt/tests/mochitest/Makefile.in
@@ -5,28 +5,26 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/xslt/tests/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug319374.xhtml \
+MOCHITEST_FILES = 	test_bug319374.xhtml \
 		test_bug440974.html \
 		test_bug427060.html \
 		test_bug468208.html \
 		test_bug453441.html \
 		test_bug511487.html \
 		test_bug551412.html \
 		test_bug551654.html \
 		test_bug566629.html \
 		test_bug566629.xhtml \
 		test_bug603159.html \
 		test_bug616774.html \
 		test_bug667315.html \
 		test_exslt_regex.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/xul/content/test/Makefile.in
+++ b/content/xul/content/test/Makefile.in
@@ -5,26 +5,21 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/xul/content/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	\
+MOCHITEST_FILES = 	\
 		test_bug486990.xul \
 		test_bug749367.xul \
 		$(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug233643.xul \
- 		test_bug398289.html \
- 		398289-resource.xul \
- 		$(NULL)
+		test_bug398289.html \
+		398289-resource.xul \
+		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/xul/document/test/Makefile.in
+++ b/content/xul/document/test/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = content/xul/document/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_bug311681.xul \
 		test_bug199692.xul \
 		test_bug391002.xul \
 		test_bug403868.xul \
 		test_bug414907.xul \
 		test_bug418216.xul \
 		test_bug445177.xul \
 		test_bug449457.xul \
@@ -28,10 +27,9 @@ include $(topsrcdir)/config/rules.mk
 		bug497875-iframe.xul \
 		test_bug335375.xul \
 		overlay1_bug335375.xul \
 		overlay2_bug335375.xul \
 		test_bug757137.xul \
 		window_bug757137.xul \
 		$(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/content/xul/templates/tests/chrome/Makefile.in
+++ b/content/xul/templates/tests/chrome/Makefile.in
@@ -5,22 +5,21 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= content/xul/templates/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # NOTE: it is important that the first test of the test_tmpl_* tests here use
 #       datasources="rdf:null" to ensure that the real animals.rdf datasource
 #       can be synchronously loaded before the tests run.
-_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug476634.xul \
 		templates_shared.js \
 		animals.rdf \
 		animals.xml \
 		animals.sqlite \
 		test_tmpl_bindingsextendedsyntax.xul \
 		test_tmpl_bindingsmultiple.xul \
 		test_tmpl_bindingsquerysyntax.xul \
@@ -228,10 +227,9 @@ include $(topsrcdir)/config/rules.mk
 		test_tmpl_errors.xul \
 		test_tmpl_regenerate.xul \
 		test_bug441785.xul \
 		bug441785-1.rdf \
 		bug441785-2.rdf \
 		test_sortservice.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/docshell/test/Makefile.in
+++ b/docshell/test/Makefile.in
@@ -22,19 +22,17 @@ XPCSHELL_TESTS = unit
 ifneq ($(OS_ARCH),Darwin)
 XPCSHELL_TESTS += unit_ipc
 endif
 
 ifneq (mobile,$(MOZ_BUILD_APP))
 	DIRS += browser
 endif
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug94514.html \
 		bug94514-postpage.html \
 		test_bug123696.html \
 		bug123696-subframe.html \
 		test_bug344861.html \
 		test_bug369814.html \
 		bug369814.zip \
 		bug369814.jar \
@@ -98,16 +96,15 @@ include $(topsrcdir)/config/rules.mk
 		bug691547_frame.html \
 		test_bug694612.html \
 		test_bug713825.html \
 		test_bug728939.html \
 		file_bug728939.html \
 		$(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug511449.html \
 		file_bug511449.html \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/docshell/test/browser/Makefile.in
+++ b/docshell/test/browser/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= docshell/test/browser 
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES =	\
+MOCHITEST_BROWSER_FILES =	\
 		browser_bug92473.js \
 		test-form_sjis.html \
 		browser_bug134911.js \
 		browser_bug349769.js \
 		browser_bug388121-1.js \
 		browser_bug388121-2.js \
 		browser_bug435325.js \
 		browser_bug441169.js \
@@ -30,10 +29,9 @@ include $(topsrcdir)/config/rules.mk
 		browser_bug655270.js \
 		file_bug655270.html \
 		favicon_bug655270.ico \
 		browser_bug670318.js \
 		file_bug670318.html \
 		browser_bug673467.js \
 		$(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/docshell/test/chrome/Makefile.in
+++ b/docshell/test/chrome/Makefile.in
@@ -4,36 +4,35 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= docshell/test/chrome 
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_HTTP_FILES =	\
+MOCHITEST_FILES =	\
                 bug89419.sjs \
                 blue.png \
                 red.png \
 		92598_nostore.html \
 		92598_nostore.html^headers^ \
 		112564_nocache.html \
 		112564_nocache.html^headers^ \
 		215405_nostore.html \
 		215405_nostore.html^headers^ \
 		215405_nocache.html \
 		215405_nocache.html^headers^ \
 		582176_dummy.html \
 		582176_xml.xml \
 		582176_xslt.xsl \
 		$(NULL)
 
-_TEST_FILES =	\
+MOCHITEST_CHROME_FILES =	\
                 test_bug89419.xul \
                 bug89419_window.xul \
                 89419.html \
 		test_bug92598.xul \
 		bug92598_window.xul \
 		92598_nostore.html \
 		test_bug112564.xul \
 		bug112564_window.xul \
@@ -92,21 +91,14 @@ include $(topsrcdir)/config/rules.mk
 		bug690056_window.xul \
 		test_bug311007.xul \
 		bug311007_window.xul \
 		test_principalInherit.xul \
 		test_mozFrameType.xul \
 		mozFrameType_window.xul \
 		$(NULL)
 
-_DOCSHELL_SUBHARNESS = \
+MOCHITEST_CHROME_FILES += \
     docshell_helpers.js \
     generic.html \
     $(NULL)
 
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
-libs:: $(_DOCSHELL_SUBHARNESS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/docshell/test/navigation/Makefile.in
+++ b/docshell/test/navigation/Makefile.in
@@ -6,25 +6,24 @@ DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = docshell/test/navigation
 
 MODULE = test_docshell
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug13871.html \
 		test_bug270414.html \
 		test_bug278916.html \
 		test_bug279495.html \
 		test_bug386782.html \
- 		test_bug430624.html \
+		test_bug430624.html \
 		test_bug430723.html \
 		test_child.html \
 		test_grandchild.html \
 		test_sibling-off-domain.html \
 		test_sibling-matching-parent.html \
 		test_opener.html \
 		test_not-opener.html \
 		test_popup-navigates-children.html \
@@ -46,26 +45,20 @@ include $(topsrcdir)/config/rules.mk
 		frame1.html \
 		frame2.html \
 		frame3.html \
 		goback.html \
 		file_bug534178.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug343515.js \
 		bug343515_pg1.html \
 		bug343515_pg2.html \
 		bug343515_pg3.html \
 		bug343515_pg3_1.html \
 		bug343515_pg3_2.html \
 		bug343515_pg3_1_1.html \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-ifneq (mobile,$(MOZ_BUILD_APP))
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-endif
+include $(topsrcdir)/config/rules.mk
--- a/dom/alarm/test/Makefile.in
+++ b/dom/alarm/test/Makefile.in
@@ -9,17 +9,14 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/alarm/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_alarm_permitted_app.html \
   test_alarm_non_permitted_app.html \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/apps/tests/Makefile.in
+++ b/dom/apps/tests/Makefile.in
@@ -9,26 +9,13 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/apps/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
-  $(NULL)
-
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
   test_apps_service.xul \
   $(NULL)
 
-ifneq (,$(_TEST_FILES))
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-endif
-
-ifneq (,$(_CHROME_TEST_FILES))
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-endif
+include $(topsrcdir)/config/rules.mk
--- a/dom/base/test/Makefile.in
+++ b/dom/base/test/Makefile.in
@@ -4,29 +4,24 @@
 
 DEPTH = ../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/base/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-TEST_FILES = \
+MOCHITEST_FILES = \
   test_domrequest.html \
   test_gsp-standards.html \
   test_gsp-quirks.html \
   test_nondomexception.html \
   test_screen_orientation.html \
   $(NULL)
 
-CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
    test_bug715041.xul \
    test_bug715041_removal.xul \
    $(NULL)
 
-libs:: $(TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/dom/battery/test/Makefile.in
+++ b/dom/battery/test/Makefile.in
@@ -9,22 +9,14 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/battery/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_battery_basics.html \
   $(NULL)
 
-_CHROME_TEST_FILES = \
-  $(NULL)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-#libs:: $(_CHROME_TEST_FILES)
-#	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/bindings/test/Makefile.in
+++ b/dom/bindings/test/Makefile.in
@@ -29,17 +29,16 @@ test_webidl_files := $(addprefix ../,$(t
 CPPSRCS := $(subst .webidl,Binding.cpp,$(test_webidl_files))
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/js/xpconnect/src \
   -I$(topsrcdir)/js/xpconnect/wrappers \
   -I$(topsrcdir)/dom/bindings \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
 
 # If you change bindinggen_dependencies here, change it in
 # dom/bindings/Makefile.in too.  But note that we include ../Makefile
 # here manually, since $(GLOBAL_DEPS) won't cover it.
 bindinggen_dependencies := \
   ../BindingGen.py \
   ../Bindings.conf \
   ../Configuration.py \
@@ -51,28 +50,27 @@ bindinggen_dependencies := \
   $(NULL)
 
 $(CPPSRCS): ../%Binding.cpp: $(bindinggen_dependencies) \
                              ../%.webidl \
                              $(NULL)
 	$(MAKE) -C .. $*Binding.h
 	$(MAKE) -C .. $*Binding.cpp
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_enums.html \
   test_integers.html \
   test_interfaceToString.html \
   test_lookupGetter.html \
   test_InstanceOf.html \
   test_traceProtos.html \
   $(NULL)
 
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
 check::
 	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) $(srcdir)/../parser/runtests.py
 
 check-interactive:
 	PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
 	  $(PLY_INCLUDE) $(srcdir)/../parser/runtests.py -q
--- a/dom/browser-element/mochitest/Makefile.in
+++ b/dom/browser-element/mochitest/Makefile.in
@@ -5,23 +5,22 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/browser-element/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # Note: browserElementTestHelpers.js looks at the test's filename to determine
 # whether the test should be OOP.  "_oop_" signals OOP, "_inproc_" signals in
 # process.  Default is OOP.
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		file_empty_script.js \
 		file_empty.html \
 		file_focus.html \
 		browserElementTestHelpers.js \
 		test_browserElement_NoAttr.html \
 		test_browserElement_NoPref.html \
 		test_browserElement_NoWhitelist.html \
 		browserElement_LoadEvents.js \
@@ -71,17 +70,17 @@ include $(topsrcdir)/config/rules.mk
                 browserElement_ContextmenuEvents.js \
                 test_browserElement_inproc_ContextmenuEvents.html \
 		$(NULL)
 
 # OOP tests don't work on Windows (bug 763081).
 #
 # Note that there's no inproc equivalent of BackForward; that's intentional.
 ifneq ($(OS_ARCH),WINNT)
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_browserElement_oop_LoadEvents.html \
 		test_browserElement_oop_DataURI.html \
 		test_browserElement_oop_ErrorSecurity.html \
 		test_browserElement_oop_Titlechange.html \
 		test_browserElement_oop_TopBarrier.html \
 		test_browserElement_oop_Iconchange.html \
 		test_browserElement_oop_GetScreenshot.html \
 		test_browserElement_oop_SetVisible.html \
@@ -96,10 +95,9 @@ ifneq ($(OS_ARCH),WINNT)
 		test_browserElement_oop_OpenWindowRejected.html \
 		test_browserElement_oop_SecurityChange.html \
 		test_browserElement_oop_BackForward.html \
                 test_browserElement_oop_ContextmenuEvents.html \
 		$(NULL)
 endif
 
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/contacts/tests/Makefile.in
+++ b/dom/contacts/tests/Makefile.in
@@ -9,20 +9,14 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/contacts/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_contacts_basics.html \
   $(NULL)
 
-_CHROME_TEST_FILES = \
-  $(NULL)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
--- a/dom/devicestorage/test/Makefile.in
+++ b/dom/devicestorage/test/Makefile.in
@@ -5,25 +5,21 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/devicestorage/test/
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_sanity.html \
 		test_basic.html \
 		test_enumerate.html \
 		test_enumerateMultipleContinue.html \
 		test_overwrite.html \
 		test_dotdot.html \
 		test_enumerateOptions.html \
 		test_lastModificationFilter.html \
 		devicestorage_common.js \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/file/test/Makefile.in
+++ b/dom/file/test/Makefile.in
@@ -5,19 +5,18 @@
 DEPTH            = ../../..
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 relativesrcdir   = dom/file/test
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
 
-TEST_FILES = \
+MOCHITEST_FILES = \
   helpers.js \
   test_append_read_data.html \
   test_getFileId.html \
   test_location.html \
   test_lockedfile_lifetimes.html \
   test_lockedfile_lifetimes_nested.html \
   test_lockedfile_ordering.html \
   test_overlapping_lockedfiles.html \
@@ -25,10 +24,9 @@ TEST_FILES = \
   test_readonly_lockedfiles.html \
   test_request_readyState.html \
   test_stream_tracking.html \
   test_success_events_after_abort.html \
   test_truncate.html \
   test_write_read_data.html \
   $(NULL)
 
-libs:: $(TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/editing/Makefile.in
+++ b/dom/imptests/editing/Makefile.in
@@ -9,20 +9,18 @@ relativesrcdir = dom/imptests/editing
 
 DIRS = \
   css \
   conformancetest \
   selecttest \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   implementation.js \
   tests.js \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/editing/conformancetest/Makefile.in
+++ b/dom/imptests/editing/conformancetest/Makefile.in
@@ -6,21 +6,19 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/editing/conformancetest
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_runtest.html \
   test_event.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   data.js \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/editing/css/Makefile.in
+++ b/dom/imptests/editing/css/Makefile.in
@@ -6,19 +6,17 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/editing/css
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   reset.css \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/editing/selecttest/Makefile.in
+++ b/dom/imptests/editing/selecttest/Makefile.in
@@ -6,32 +6,30 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/editing/selecttest
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_addRange.html \
   test_collapse.html \
   test_collapseToStartEnd.html \
   test_deleteFromDocument.html \
   test_Document-open.html \
   test_extend.html \
   test_getRangeAt.html \
   test_getSelection.html \
   test_interfaces.html \
   test_isCollapsed.html \
   test_removeAllRanges.html \
   test_selectAllChildren.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   common.js \
   test-iframe.html \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/editing/conformancetest/Makefile.in
+++ b/dom/imptests/failures/editing/conformancetest/Makefile.in
@@ -4,17 +4,15 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/editing/conformancetest
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_event.html.json \
   test_runtest.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/editing/selecttest/Makefile.in
+++ b/dom/imptests/failures/editing/selecttest/Makefile.in
@@ -4,19 +4,17 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/editing/selecttest
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_addRange.html.json \
   test_Document-open.html.json \
   test_getSelection.html.json \
   test_interfaces.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/html/tests/submission/Opera/microdata/Makefile.in
+++ b/dom/imptests/failures/html/tests/submission/Opera/microdata/Makefile.in
@@ -4,16 +4,14 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/html/tests/submission/Opera/microdata 
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_001.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/webapps/DOMCore/tests/approved/Makefile.in
+++ b/dom/imptests/failures/webapps/DOMCore/tests/approved/Makefile.in
@@ -4,27 +4,25 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/webapps/DOMCore/tests/approved
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_Range-cloneContents.html.json \
   test_Range-cloneRange.html.json \
   test_Range-collapse.html.json \
   test_Range-commonAncestorContainer.html.json \
   test_Range-compareBoundaryPoints.html.json \
   test_Range-comparePoint.html.json \
   test_Range-deleteContents.html.json \
   test_Range-extractContents.html.json \
   test_Range-intersectsNode.html.json \
   test_Range-isPointInRange.html.json \
   test_Range-set.html.json \
   test_interfaces.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/webapps/DOMCore/tests/submissions/Opera/Makefile.in
+++ b/dom/imptests/failures/webapps/DOMCore/tests/submissions/Opera/Makefile.in
@@ -4,17 +4,15 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/webapps/DOMCore/tests/submissions/Opera
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_getElementsByClassName-10.xml.json \
   test_getElementsByClassName-11.xml.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
+++ b/dom/imptests/failures/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
@@ -4,16 +4,14 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/webapps/WebStorage/tests/submissions/Infraware
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_storage_local_security.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
+++ b/dom/imptests/failures/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
@@ -4,20 +4,18 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/webapps/WebStorage/tests/submissions/Ms2ger
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_missing_arguments.html.json \
   test_storage_local_in_js.html.json \
   test_storage_local_removeitem_js.html.json \
   test_storage_session_in_js.html.json \
   test_storage_session_removeitem_js.html.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
+++ b/dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
@@ -4,17 +4,15 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/failures/webapps/XMLHttpRequest/tests/submissions/Ms2ger
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_interfaces.html.json \
   test_setrequestheader-invalid-arguments.htm.json \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/html/tests/submission/Mozilla/Makefile.in
+++ b/dom/imptests/html/tests/submission/Mozilla/Makefile.in
@@ -6,26 +6,24 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/html/tests/submission/Mozilla
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_body-onload.html \
   test_pageload-image.html \
   test_pageload-video.html \
   test_script-for-onload.html \
   test_window-onerror-parse-error.html \
   test_window-onerror-runtime-error.html \
   test_window-onerror-runtime-error-throw.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   nested-document-write-external.js \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/html/tests/submission/Opera/microdata/Makefile.in
+++ b/dom/imptests/html/tests/submission/Opera/microdata/Makefile.in
@@ -6,19 +6,17 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/html/tests/submission/Opera/microdata
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_001.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/DOMCore/tests/approved/Makefile.in
+++ b/dom/imptests/webapps/DOMCore/tests/approved/Makefile.in
@@ -6,19 +6,18 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/DOMCore/tests/approved
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_interfaces.html \
   test_Range-cloneContents.html \
   test_Range-cloneRange.html \
   test_Range-collapse.html \
   test_Range-commonAncestorContainer.html \
   test_Range-compareBoundaryPoints.html \
   test_Range-comparePoint.html \
   test_Range-deleteContents.html \
@@ -27,15 +26,14 @@ include $(topsrcdir)/config/rules.mk
   test_Range-intersectsNode.html \
   test_Range-isPointInRange.html \
   test_Range-mutations.html \
   test_Range-selectNode.html \
   test_Range-set.html \
   test_Range-surroundContents.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   common.js \
   Range-test-iframe.html \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/DOMCore/tests/submissions/Opera/Makefile.in
+++ b/dom/imptests/webapps/DOMCore/tests/submissions/Opera/Makefile.in
@@ -6,19 +6,18 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/DOMCore/tests/submissions/Opera
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_getElementsByClassName-01.htm \
   test_getElementsByClassName-02.htm \
   test_getElementsByClassName-03.htm \
   test_getElementsByClassName-04.htm \
   test_getElementsByClassName-05.htm \
   test_getElementsByClassName-06.htm \
   test_getElementsByClassName-07.htm \
   test_getElementsByClassName-08.htm \
@@ -29,13 +28,12 @@ include $(topsrcdir)/config/rules.mk
   test_getElementsByClassName-13.htm \
   test_getElementsByClassName-14.htm \
   test_getElementsByClassName-15.htm \
   test_getElementsByClassName-16.htm \
   test_getElementsByClassName-17.htm \
   test_getElementsByClassName-18.htm \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
+++ b/dom/imptests/webapps/WebStorage/tests/submissions/Infraware/Makefile.in
@@ -7,19 +7,18 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/WebStorage/tests/submissions/Infraware
 
 DIRS = \
   iframe \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_event_constructor.html \
   test_event_local_key.html \
   test_event_local_newvalue.html \
   test_event_local_oldvalue.html \
   test_event_local_storagearea.html \
   test_event_local_storageeventinit.html \
   test_event_local_url.html \
   test_event_session_key.html \
@@ -38,13 +37,12 @@ include $(topsrcdir)/config/rules.mk
   test_storage_session_clear.html \
   test_storage_session_getitem.html \
   test_storage_session_key.html \
   test_storage_session_length.html \
   test_storage_session_removeitem.html \
   test_storage_session_setitem.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/Makefile.in
+++ b/dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe/Makefile.in
@@ -6,25 +6,23 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/WebStorage/tests/submissions/Infraware/iframe
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   local_change_item_iframe.html \
   local_security_iframe.html \
   local_set_item_clear_iframe.html \
   local_set_item_iframe.html \
   session_change_item_iframe.html \
   session_set_item_clear_iframe.html \
   session_set_item_iframe.html \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
+++ b/dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger/Makefile.in
@@ -6,19 +6,18 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/WebStorage/tests/submissions/Ms2ger
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_event_constructor_js.html \
   test_missing_arguments.html \
   test_storage_local_clear_js.html \
   test_storage_local_getitem_js.html \
   test_storage_local_index_js.html \
   test_storage_local_in_js.html \
   test_storage_local_length_js.html \
   test_storage_local_removeitem_js.html \
@@ -27,13 +26,12 @@ include $(topsrcdir)/config/rules.mk
   test_storage_session_getitem_js.html \
   test_storage_session_index_js.html \
   test_storage_session_in_js.html \
   test_storage_session_length_js.html \
   test_storage_session_removeitem_js.html \
   test_storage_session_setitem_js.html \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
+++ b/dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger/Makefile.in
@@ -6,20 +6,18 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/imptests/webapps/XMLHttpRequest/tests/submissions/Ms2ger
 
 DIRS = \
   $(NULL)
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TESTS = \
+MOCHITEST_FILES = \
   test_interfaces.html \
   test_setrequestheader-invalid-arguments.htm \
   $(NULL)
 
-_TESTS += \
+MOCHITEST_FILES += \
   $(NULL)
 
-libs:: $(_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/indexedDB/ipc/Makefile.in
+++ b/dom/indexedDB/ipc/Makefile.in
@@ -26,19 +26,15 @@ EXPORTS_mozilla/dom/indexedDB = Serializ
 
 LOCAL_INCLUDES += \
   -I$(topsrcdir)/dom/indexedDB \
   -I$(topsrcdir)/content/events/src \
   $(NULL)
 
 DEFINES += -D_IMPL_NS_LAYOUT
 
-TEST_FILES = \
+MOCHITEST_FILES = \
   test_ipc.html \
   $(NULL)
 
 include $(topsrcdir)/config/config.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") \
-    $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/dom/indexedDB/test/Makefile.in
+++ b/dom/indexedDB/test/Makefile.in
@@ -8,19 +8,17 @@ srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/indexedDB/test
 DIRS += unit
 
 include $(DEPTH)/config/autoconf.mk
 
 XPCSHELL_TESTS = unit
 
-include $(topsrcdir)/config/rules.mk
-
-TEST_FILES = \
+MOCHITEST_FILES = \
   bfcache_iframe1.html \
   bfcache_iframe2.html \
   error_events_abort_transactions_iframe.html \
   event_propagation_iframe.html \
   exceptions_in_events_iframe.html \
   file.js \
   helpers.js \
   leaving_page_iframe.html \
@@ -101,17 +99,17 @@ TEST_FILES = \
   test_unique_index_update.html \
   third_party_iframe1.html \
   third_party_iframe2.html \
   $(NULL)
 
 #   test_writer_starvation.html  disabled for infinite loops, bug 595368
 
 ifeq (browser,$(MOZ_BUILD_APP))
-BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_forgetThisSite.js \
   browser_forgetThisSiteAdd.html \
   browser_forgetThisSiteGet.html \
   browserHelpers.js \
   browser_permissionsPrompt.html \
   browser_permissionsPromptAllow.js \
   browser_permissionsPromptDeny.js \
   browser_privateBrowsing.js \
@@ -119,16 +117,12 @@ BROWSER_TEST_FILES = \
   browser_quotaPromptAllow.js \
   browser_quotaPromptDeny.js \
   browser_quotaPromptDatabases.html \
   browser_quotaPromptDatabases.js \
   browser_quotaPromptDelete.html \
   browser_quotaPromptDelete.js \
   head.js \
   $(NULL)
-
-libs:: $(BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
 endif
 
-libs:: $(TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
--- a/dom/indexedDB/test/unit/Makefile.in
+++ b/dom/indexedDB/test/unit/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH = ../../../..
 topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir = dom/indexedDB/test/unit
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-TEST_FILES = \
+MOCHITEST_FILES = \
   test_add_put.js \
   test_add_twice_failure.js \
   test_advance.js \
   test_autoIncrement_indexes.js \
   test_clear.js \
   test_complex_keyPaths.js \
   test_count.js \
   test_create_index.js \
@@ -61,11 +60,10 @@ TEST_FILES = \
   test_success_events_after_abort.js \
   test_traffic_jam.js \
   test_transaction_abort.js \
   test_transaction_lifetimes.js \
   test_transaction_lifetimes_nested.js \
   test_transaction_ordering.js \
   $(NULL)
 
-libs:: $(TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
--- a/dom/ipc/tests/Makefile.in
+++ b/dom/ipc/tests/Makefile.in
@@ -4,18 +4,16 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/ipc/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-MOCHICHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
   test_process_error.xul \
   process_error.xul \
   process_error_contentscript.js \
   $(NULL)
 
-libs:: $(MOCHICHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/network/tests/Makefile.in
+++ b/dom/network/tests/Makefile.in
@@ -9,22 +9,13 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/network/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_network_basics.html \
   $(NULL)
 
-_CHROME_TEST_FILES = \
-  $(NULL)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-#libs:: $(_CHROME_TEST_FILES)
-#	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/plugins/test/mochitest/Makefile.in
+++ b/dom/plugins/test/mochitest/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/plugins/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_MOCHITEST_FILES = \
+MOCHITEST_FILES = \
   utils.js \
   test_defaultValue.html \
   test_getauthenticationinfo.html \
   test_npobject_getters.html \
   test_npruntime_npnevaluate.html \
   test_npruntime_npninvoke.html \
   test_npruntime_npninvokedefault.html \
   test_npruntime_identifiers.html \
@@ -81,73 +80,69 @@ include $(topsrcdir)/config/rules.mk
   test_pluginstream_src_referer.html \
   plugin-stream-referer.sjs \
   test_src_url_change.html \
   $(NULL)
 
 #  test_plugin_scroll_painting.html \ bug 596491
 
 ifeq ($(OS_ARCH),WINNT)
-_MOCHITEST_FILES += \
+MOCHITEST_FILES += \
   test_windowed_invalidate.html \
   $(NULL)
 
 # test_positioning.html \ disabled due to oddness, perhaps scrolling of the
 # mochitest window?
 endif
 
-_MOCHICHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
   utils.js \
   test_clear_site_data.html \
   test_npruntime.xul   \
   test_privatemode.xul \
   test_wmode.xul \
   test_bug479979.xul \
   $(NULL)
 
 ifneq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-_MOCHITEST_FILES += \
+MOCHITEST_FILES += \
   test_instance_re-parent-windowed.html \
   test_visibility.html \
   $(NULL)
 
 ifneq ($(OS_ARCH),WINNT)
-_MOCHICHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
   test_xulbrowser_plugin_visibility.xul \
   xulbrowser_plugin_visibility.xul \
   plugin_visibility_loader.html \
   $(NULL)
 endif
 endif
 
 ifdef MOZ_CRASHREPORTER
-_MOCHICHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
   test_crash_notify.xul \
   test_crash_notify_no_report.xul \
   test_crash_submit.xul \
   $(NULL)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-_MOCHICHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
   test_convertpoint.xul \
   $(NULL)
 
-_MOCHITEST_FILES += \
+MOCHITEST_FILES += \
   test_cocoa_window_focus.html \
   cocoa_window_focus.html \
   test_cocoa_focus.html \
   cocoa_focus.html \
   $(NULL)
 endif
 
 ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
-_MOCHITEST_FILES += \
+MOCHITEST_FILES += \
 		test_copyText.html \
 		test_crash_nested_loop.html \
 		$(NULL)
 endif
 
-libs:: $(_MOCHICHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
-libs:: $(_MOCHITEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/power/test/Makefile.in
+++ b/dom/power/test/Makefile.in
@@ -9,26 +9,17 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/power/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_power_basics.html \
   $(NULL)
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_bug697132.js \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-#libs:: $(_CHROME_TEST_FILES)
-#	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/settings/tests/Makefile.in
+++ b/dom/settings/tests/Makefile.in
@@ -6,20 +6,18 @@ DEPTH            = ../../..
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 relativesrcdir   = dom/settings/tests
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_settings_basics.html \
   test_settings_events.html \
   $(NULL)
 
-_CHROME_TEST_FILES = \
+_CHROMEMOCHITEST_FILES = \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/sms/tests/Makefile.in
+++ b/dom/sms/tests/Makefile.in
@@ -9,31 +9,20 @@ VPATH            = @srcdir@
 
 relativesrcdir   = dom/sms/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_sms_basics.html \
   test_smsfilter.html \
   $(NULL)
 
-_CHROME_TEST_FILES = \
-  $(NULL)
-
 ifdef MOZ_B2G_RIL
-_CHROME_TEST_FILES += \
+MOCHITEST_CHROME_FILES = \
   test_smsdatabaseservice.xul \
   $(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-ifneq (,$(_CHROME_TEST_FILES))
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-endif
+include $(topsrcdir)/config/rules.mk
--- a/dom/src/foo/Makefile.in
+++ b/dom/src/foo/Makefile.in
@@ -6,16 +6,13 @@ DEPTH            = ../../..
 topsrcdir        = @top_srcdir@
 srcdir           = @srcdir@
 VPATH            = @srcdir@
 
 relativesrcdir   = dom/src/foo
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_foo.html \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/src/json/test/Makefile.in
+++ b/dom/src/json/test/Makefile.in
@@ -10,16 +10,13 @@ VPATH          = @srcdir@
 relativesrcdir  = dom/src/json/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE         = json_test
 
 XPCSHELL_TESTS = unit
 
+ MOCHITEST_FILES =	test_json.html \
+		$(NULL)
+
 include $(topsrcdir)/config/rules.mk
 
- _TEST_FILES =	test_json.html \
-		$(NULL)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
--- a/dom/src/jsurl/test/Makefile.in
+++ b/dom/src/jsurl/test/Makefile.in
@@ -5,26 +5,24 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/src/jsurl/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	pass.html \
+MOCHITEST_FILES = 	pass.html \
 		fail.html \
 		test_bug351633-1.html \
 		form-submit.html \
 		test_bug351633-2.html \
 		load-stopping-1a.html \
 		load-stopping-1b.html \
 		load-stopping-1c.html \
 		load-stopping-1d.html \
 		test_bug351633-3.html \
 		test_bug351633-4.html \
 		test_bug384981.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/system/tests/Makefile.in
+++ b/dom/system/tests/Makefile.in
@@ -1,16 +1,13 @@
 DEPTH           = ../../..
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 relativesrcdir  = dom/system/tests
 
 MODULE          = test_domsystem
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 	test_constants.xul \
 	worker_constants.js \
         $(NULL)
 
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
--- a/dom/tests/mochitest/ajax/jquery/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/Makefile.in
@@ -11,17 +11,14 @@ relativesrcdir	= dom/tests/mochitest/aja
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	dist \
 	test \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	manifest.json \
 	test_jQuery.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/jquery/dist/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/dist/Makefile.in
@@ -9,16 +9,13 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/jquery/dist
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	jquery.js \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/jquery/test/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/test/Makefile.in
@@ -11,19 +11,16 @@ relativesrcdir	= dom/tests/mochitest/aja
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	data \
 	unit \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	index.html \
 	offset.html \
 	test.js \
 	fix.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/jquery/test/data/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/test/data/Makefile.in
@@ -10,28 +10,25 @@ VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/jquery/test/data
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	offset \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	cow.jpg \
 	dashboard.xml \
 	iframe.html \
 	json_assigned_obj.js \
 	json_obj.js \
 	name.html \
 	test.html \
 	test.js \
 	test2.html \
 	test3.html \
 	testrunner.js \
 	testsuite.css \
 	with_fries.xml \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/jquery/test/data/offset/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/test/data/offset/Makefile.in
@@ -9,21 +9,18 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/jquery/test/data/offset
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	absolute.html \
 	fixed.html \
 	relative.html \
 	scroll.html \
 	static.html \
 	table.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/jquery/test/unit/Makefile.in
+++ b/dom/tests/mochitest/ajax/jquery/test/unit/Makefile.in
@@ -9,22 +9,19 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/jquery/test/unit
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	ajax.js \
 	core.js \
 	dimensions.js \
 	event.js \
 	fx.js \
 	offset.js \
 	selector.js \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/lib/Makefile.in
+++ b/dom/tests/mochitest/ajax/lib/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/lib
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		AJAX_setup.js \
 		test.css \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/mochikit/Makefile.in
+++ b/dom/tests/mochitest/ajax/mochikit/Makefile.in
@@ -11,17 +11,14 @@ relativesrcdir	= dom/tests/mochitest/aja
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	MochiKit \
 	tests \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	test_Mochikit.html \
 	manifest.json \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/mochikit/MochiKit/Makefile.in
+++ b/dom/tests/mochitest/ajax/mochikit/MochiKit/Makefile.in
@@ -6,19 +6,17 @@
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/mochikit/MochiKit
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		Async.js \
 		Base.js \
 		Color.js \
 		Controls.js \
 		DOM.js \
 		DateTime.js \
 		DragAndDrop.js \
 		Format.js \
@@ -32,10 +30,9 @@ include $(topsrcdir)/config/rules.mk
 		Signal.js \
 		Sortable.js \
 		Style.js \
 		Test.js \
 		Visual.js \
 		__package__.js \
 		$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/mochikit/tests/Makefile.in
+++ b/dom/tests/mochitest/ajax/mochikit/tests/Makefile.in
@@ -10,19 +10,17 @@ VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/mochikit/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS		= \
 		SimpleTest \
 		$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		FakeJSAN.js \
 		cli.js \
 		index.html \
 		standalone.js \
 		test_Base.js \
 		test_Color.js \
 		test_DateTime.js \
 		test_DragAndDrop.js \
@@ -43,10 +41,9 @@ include $(topsrcdir)/config/rules.mk
 		MochiKit-MochiKit.html \
 		MochiKit-Selector.html \
 		MochiKit-Signal.html \
 		MochiKit-Style.html \
 		MochiKit-Visual.html \
 		test_Signal.js \
 		$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/Makefile.in
+++ b/dom/tests/mochitest/ajax/mochikit/tests/SimpleTest/Makefile.in
@@ -8,18 +8,15 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/mochikit/tests/SimpleTest
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		SimpleTest.js \
 		TestRunner.js \
 		test.css \
 		$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/offline/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/Makefile.in
@@ -8,41 +8,39 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/offline
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = namespace1 namespace2
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	offlineTests.js \
 	test_badManifestMagic.html \
 	test_badManifestMime.html \
 	test_bypass.html \
 	test_missingFile.html \
 	test_noManifest.html \
 	test_simpleManifest.html \
 	test_identicalManifest.html \
 	test_changingManifest.html \
 	test_refetchManifest.html \
 	test_offlineIFrame.html \
 	test_bug445544.html \
 	test_bug460353.html \
 	test_bug474696.html \
 	test_bug544462.html \
-  test_bug744719.html \
-  744719.cacheManifest \
-  744719.cacheManifest^headers^ \
-  test_bug744719-cancel.html \
-  744719-cancel.cacheManifest \
-  744719-cancel.cacheManifest^headers^ \
-  subresource744719.html \
+	test_bug744719.html \
+	744719.cacheManifest \
+	744719.cacheManifest^headers^ \
+	test_bug744719-cancel.html \
+	744719-cancel.cacheManifest \
+	744719-cancel.cacheManifest^headers^ \
+	subresource744719.html \
 	test_foreign.html \
 	test_fallback.html \
 	test_overlap.html \
 	test_redirectManifest.html \
 	test_redirectUpdateItem.html \
 	overlap.cacheManifest \
 	overlap.cacheManifest^headers^ \
 	test_updatingManifest.html \
@@ -95,10 +93,9 @@ include $(topsrcdir)/config/rules.mk
 	test_xhtmlManifest.xhtml \
 	test_missingManifest.html \
 	missing.html \
 	jupiter.jpg \
 	$(NULL)
 
 # test_offlineMode.html disabled due to bug 656943
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/offline/namespace1/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/namespace1/Makefile.in
@@ -8,18 +8,15 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/offline/namespace1
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = sub sub2
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
         opp.html \
         script.js \
         redirectToDifferentOrigin.sjs \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/offline/namespace1/sub/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/namespace1/sub/Makefile.in
@@ -6,17 +6,14 @@
 DEPTH		= ../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/offline/namespace1/sub
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
         opp.html \
         script1.js \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/offline/namespace1/sub2/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/namespace1/sub2/Makefile.in
@@ -6,16 +6,13 @@
 DEPTH		= ../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/offline/namespace1/sub2
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
         script2.js \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/offline/namespace2/Makefile.in
+++ b/dom/tests/mochitest/ajax/offline/namespace2/Makefile.in
@@ -6,16 +6,13 @@
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/offline/namespace2
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
         script3.js \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/Makefile.in
@@ -11,17 +11,14 @@ relativesrcdir	= dom/tests/mochitest/aja
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	dist \
 	test \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
         test_Prototype.html \
         manifest.json \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/dist/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/dist/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/prototype/dist
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	prototype.js \
         $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/Makefile.in
@@ -12,18 +12,15 @@ relativesrcdir	= dom/tests/mochitest/aja
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	unit \
 	lib \
 	functional \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test.css \
 		browser.html \
 		console.html \
 		$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/functional/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/functional/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/prototype/test/functional
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	event.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/lib/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/lib/Makefile.in
@@ -6,16 +6,13 @@
 DEPTH		= ../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/prototype/test/lib
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		unittest.js \
 		$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/unit/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/Makefile.in
@@ -11,19 +11,17 @@ relativesrcdir	= dom/tests/mochitest/aja
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = 	\
 	fixtures \
 	tmp \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	ajax_test.js \
 	array_test.js \
 	base_test.js \
 	dom_test.js \
 	element_mixins_test.js \
 	enumerable_test.js \
 	event_test.js \
 	form_test.js \
@@ -31,10 +29,9 @@ include $(topsrcdir)/config/rules.mk
 	number_test.js \
 	position_test.js \
 	range_test.js \
 	selector_test.js \
 	string_test.js \
 	unittest_test.js \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/fixtures/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/prototype/test/unit/fixtures
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES= \
+MOCHITEST_FILES= \
 	ajax.html \
 	ajax.js \
 	array.html \
 	base.html \
 	base.js \
 	content.html \
 	data.json \
 	dom.css \
@@ -35,10 +34,9 @@ include $(topsrcdir)/config/rules.mk
 	hello.js \
 	logo.gif \
 	position.html \
 	selector.html \
 	string.js \
 	unittest.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/prototype/test/unit/tmp/Makefile.in
+++ b/dom/tests/mochitest/ajax/prototype/test/unit/tmp/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/prototype/test/unit/tmp
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES= \
+MOCHITEST_FILES= \
 	ajax_test.html \
 	array_test.html \
 	base_test.html \
 	dom_test.html \
 	element_mixins_test.html \
 	enumerable_test.html \
 	event_test.html \
 	form_test.html \
@@ -25,10 +24,9 @@ include $(topsrcdir)/config/rules.mk
 	number_test.html \
 	position_test.html \
 	range_test.html \
 	selector_test.html \
 	string_test.html \
 	unit_test.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/scriptaculous/Makefile.in
+++ b/dom/tests/mochitest/ajax/scriptaculous/Makefile.in
@@ -12,17 +12,14 @@ relativesrcdir	= dom/tests/mochitest/aja
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	lib \
 	src \
 	test/unit \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	manifest.json \
 	test_Scriptaculous.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/scriptaculous/lib/Makefile.in
+++ b/dom/tests/mochitest/ajax/scriptaculous/lib/Makefile.in
@@ -9,16 +9,13 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/scriptaculous/lib
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	prototype.js \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/scriptaculous/src/Makefile.in
+++ b/dom/tests/mochitest/ajax/scriptaculous/src/Makefile.in
@@ -9,23 +9,20 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/scriptaculous/src
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	builder.js \
 	controls.js \
 	dragdrop.js \
 	effects.js \
 	scriptaculous.js \
 	slider.js \
 	sound.js \
 	unittest.js \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/ajax/scriptaculous/test/unit/Makefile.in
+++ b/dom/tests/mochitest/ajax/scriptaculous/test/unit/Makefile.in
@@ -9,19 +9,17 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/ajax/scriptaculous/test/unit
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS	= \
 	$(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 	_ajax_inplaceeditor_result.html \
 	_ajax_inplaceeditor_text.html \
 	_ajax_updater_result.html \
 	_autocomplete_result.html \
 	_autocomplete_result_nobr.html \
 	ajax_autocompleter_test.html \
 	ajax_inplaceeditor_test.html \
 	bdd_test.html \
@@ -33,10 +31,9 @@ include $(topsrcdir)/config/rules.mk
 	loading_test.html \
 	position_clone_test.html \
 	slider_test.html \
 	sortable_test.html \
 	string_test.html \
 	unit_test.html \
 	$(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/bugs/Makefile.in
+++ b/dom/tests/mochitest/bugs/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/bugs
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_bug42976.html \
 		test_bug49312.html \
 		iframe_bug49312.html \
 		test_bug132255.html \
 		test_bug159849.html \
 		test_bug265203.html \
 		test_bug291377.html \
 		file_bug291653.html \
@@ -127,10 +126,9 @@ include $(topsrcdir)/config/rules.mk
 		test_bug740811.html \
 		test_bug743615.html \
 		utils_bug743615.js \
 		worker_bug743615.js \
 		test_bug750051.html \
 		test_bug755320.html \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/chrome/Makefile.in
+++ b/dom/tests/mochitest/chrome/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/tests/mochitest/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_MozEnteredDomFullscreen_event.xul \
 		MozEnteredDomFullscreen_chrome.xul \
 		test_fullscreen.xul \
 		fullscreen.xul \
 		test_fullscreen_preventdefault.xul \
 		fullscreen_preventdefault.xul \
 		focus_window2.xul \
 		focus_frameset.html \
@@ -45,16 +44,15 @@ include $(topsrcdir)/config/rules.mk
 		test_moving_nodeList.xul \
 		test_callback_wrapping.xul \
 		window_callback_wrapping.xul \
 		test_sandbox_postMessage.html \
 		test_sandbox_bindings.xul \
 		$(NULL)
 
 ifeq (WINNT,$(OS_ARCH))
-_TEST_FILES += \
+MOCHITEST_CHROME_FILES += \
 		test_sizemode_attribute.xul \
 		sizemode_attribute.xul \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level0/Makefile.in
+++ b/dom/tests/mochitest/dom-level0/Makefile.in
@@ -5,26 +5,24 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level0
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_crossdomainprops.html \
 		file_crossdomainprops_inner.html \
 		test_setting_document.domain_to_shortened_ipaddr.html \
 		child_ip_address.html \
 		test_setting_document.domain_idn.html \
 		idn_child.html \
 		file_location.html \
 		test_location.html \
 		test_innerWidthHeight_script.html \
 		innerWidthHeight_script.html \
 		test_location_setters.html \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level1-core/Makefile.in
+++ b/dom/tests/mochitest/dom-level1-core/Makefile.in
@@ -8,19 +8,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level1-core
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = files
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES_A	= \
+MOCHITEST_FILES_A	= \
 		DOMTestCase.js \
 		activity-home.css \
 		exclusions.js \
 		test_attrcreatedocumentfragment.html \
 		test_attrcreatetextnode.html \
 		test_attrcreatetextnode2.html \
 		test_attrdefaultvalue.html \
 		test_attreffectivevalue.html \
@@ -77,17 +75,17 @@ include $(topsrcdir)/config/rules.mk
 		test_characterdatareplacedatanomodificationallowederrEE.html \
 		test_characterdatasetdatanomodificationallowederr.html \
 		test_characterdatasetdatanomodificationallowederrEE.html \
 		test_characterdatasetnodevalue.html \
 		test_characterdatasubstringexceedsvalue.html \
 		test_characterdatasubstringvalue.html \
 		$(NULL)
 
-_TEST_FILES_B	= \
+MOCHITEST_FILES_B	= \
 		test_commentgetcomment.html \
 		test_documentcreateattribute.html \
 		test_documentcreatecdatasection.html \
 		test_documentcreatecomment.html \
 		test_documentcreatedocumentfragment.html \
 		test_documentcreateelement.html \
 		test_documentcreateelementcasesensitive.html \
 		test_documentcreateelementdefaultattr.html \
@@ -153,17 +151,17 @@ include $(topsrcdir)/config/rules.mk
 		test_elementsetattributenomodificationallowederr.html \
 		test_elementsetattributenomodificationallowederrEE.html \
 		test_elementwrongdocumenterr.html \
 		test_entitygetentityname.html \
 		test_entitygetpublicid.html \
 		test_entitygetpublicidnull.html \
 		$(NULL)
 
-_TEST_FILES_C	= \
+MOCHITEST_FILES_C	= \
 		test_hc_attrappendchild1.html \
 		test_hc_attrappendchild2.html \
 		test_hc_attrappendchild3.html \
 		test_hc_attrappendchild4.html \
 		test_hc_attrappendchild5.html \
 		test_hc_attrappendchild6.html \
 		test_hc_attrchildnodes1.html \
 		test_hc_attrchildnodes2.html \
@@ -194,17 +192,17 @@ include $(topsrcdir)/config/rules.mk
 		test_hc_attrreplacechild1.html \
 		test_hc_attrreplacechild2.html \
 		test_hc_attrsetvalue1.html \
 		test_hc_attrsetvalue2.html \
 		test_hc_attrspecifiedvalue.html \
 		test_hc_attrspecifiedvaluechanged.html \
 		$(NULL)
 
-_TEST_FILES_D	= \
+MOCHITEST_FILES_D	= \
 		test_hc_characterdataappenddata.html \
 		test_hc_characterdataappenddatagetdata.html \
 		test_hc_characterdatadeletedatabegining.html \
 		test_hc_characterdatadeletedataend.html \
 		test_hc_characterdatadeletedataexceedslength.html \
 		test_hc_characterdatadeletedatagetlengthanddata.html \
 		test_hc_characterdatadeletedatamiddle.html \
 		test_hc_characterdatagetdata.html \
@@ -277,17 +275,17 @@ include $(topsrcdir)/config/rules.mk
 		test_hc_elementreplaceexistingattributegevalue.html \
 		test_hc_elementretrieveallattributes.html \
 		test_hc_elementretrieveattrvalue.html \
 		test_hc_elementretrievetagname.html \
 		test_hc_elementsetattributenodenull.html \
 		test_hc_elementwrongdocumenterr.html \
 		$(NULL)
 
-_TEST_FILES_E	= \
+MOCHITEST_FILES_E	= \
 		test_hc_entitiesremovenameditem1.html \
 		test_hc_entitiessetnameditem1.html \
 		test_hc_namednodemapchildnoderange.html \
 		test_hc_namednodemapgetnameditem.html \
 		test_hc_namednodemapinuseattributeerr.html \
 		test_hc_namednodemapnotfounderr.html \
 		test_hc_namednodemapnumberofnodes.html \
 		test_hc_namednodemapremovenameditem.html \
@@ -395,17 +393,17 @@ include $(topsrcdir)/config/rules.mk
 		test_hc_textparseintolistofelements.html \
 		test_hc_textsplittextfour.html \
 		test_hc_textsplittextone.html \
 		test_hc_textsplittextthree.html \
 		test_hc_textsplittexttwo.html \
 		test_hc_textwithnomarkup.html \
 		$(NULL)
 
-_TEST_FILES_F	= \
+MOCHITEST_FILES_F	= \
 		test_namednodemapchildnoderange.html \
 		test_namednodemapgetnameditem.html \
 		test_namednodemapinuseattributeerr.html \
 		test_namednodemapnotfounderr.html \
 		test_namednodemapnumberofnodes.html \
 		test_namednodemapremovenameditem.html \
 		test_namednodemapremovenameditemgetvalue.html \
 		test_namednodemapremovenameditemreturnnodevalue.html \
@@ -498,17 +496,17 @@ include $(topsrcdir)/config/rules.mk
 		test_nodelistindexgetlength.html \
 		test_nodelistindexgetlengthofemptylist.html \
 		test_nodelistindexnotzero.html \
 		test_nodelistreturnfirstitem.html \
 		test_nodelistreturnlastitem.html \
 		test_nodelisttraverselist.html \
 		$(NULL)
 
-_TEST_FILES_G	= \
+MOCHITEST_FILES_G	= \
 		test_nodenotationnodeattributes.html \
 		test_nodenotationnodename.html \
 		test_nodenotationnodetype.html \
 		test_nodenotationnodevalue.html \
 		test_nodeparentnode.html \
 		test_nodeparentnodenull.html \
 		test_nodeprocessinginstructionnodeattributes.html \
 		test_nodeprocessinginstructionnodename.html \
@@ -565,29 +563,11 @@ include $(topsrcdir)/config/rules.mk
 		test_textsplittexttwo.html \
 		test_textwithnomarkup.html \
 		$(NULL)
 
 # test_PIsetdatanomodificationallowederrEE.html was originally
 # test_processinginstructionsetdatanomodificationallowederrEE.html, but that
 # name is too long for Windows little brain.
 
-# work around command-line length limits by splitting into groups
-libs:: 	$(_TEST_FILES_A)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_B)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_C)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+MOCHITEST_FILES_PARTS := $(foreach part,A B C D E F G,MOCHITEST_FILES_$(part))
 
-libs::	$(_TEST_FILES_D)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_E)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_F)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_G)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level1-core/files/Makefile.in
+++ b/dom/tests/mochitest/dom-level1-core/files/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level1-core/files
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		hc_nodtdstaff.html \
 		hc_nodtdstaff.xhtml \
 		hc_staff.html \
 		hc_staff.xhtml \
 		staff.dtd \
 		staff.xml \
 		svgunit.js \
 		xhtml-special.ent \
@@ -29,10 +28,9 @@ include $(topsrcdir)/config/rules.mk
 		hc_staff.xml \
 		staff.svg \
 		svgtest.js \
 		xhtml-lat1.ent \
 		xhtml-symbol.ent \
 		xhtml1-strict.dtd \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level2-core/Makefile.in
+++ b/dom/tests/mochitest/dom-level2-core/Makefile.in
@@ -8,19 +8,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level2-core
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = files
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES_A	= \
+MOCHITEST_FILES_A	= \
 		DOMTestCase.js \
 		exclusions.js \
 		test_attrgetownerelement01.html \
 		test_attrgetownerelement02.html \
 		test_attrgetownerelement03.html \
 		test_attrgetownerelement04.html \
 		test_attrgetownerelement05.html \
 		test_createAttributeNS01.html \
@@ -59,17 +57,17 @@ include $(topsrcdir)/config/rules.mk
 		test_documentgetelementbyid01.html \
 		test_documentgetelementsbytagnameNS01.html \
 		test_documentgetelementsbytagnameNS02.html \
 		test_documentgetelementsbytagnameNS03.html \
 		test_documentgetelementsbytagnameNS04.html \
 		test_documentgetelementsbytagnameNS05.html \
 		$(NULL)
 
-_TEST_FILES_B	= \
+MOCHITEST_FILES_B	= \
 		test_documentimportnode01.html \
 		test_documentimportnode02.html \
 		test_documentimportnode03.html \
 		test_documentimportnode04.html \
 		test_documentimportnode05.html \
 		test_documentimportnode06.html \
 		test_documentimportnode07.html \
 		test_documentimportnode08.html \
@@ -97,17 +95,17 @@ include $(topsrcdir)/config/rules.mk
 		test_domimplementationcreatedocumenttype02.html \
 		test_domimplementationcreatedocumenttype04.html \
 		test_domimplementationfeaturecore.html \
 		test_domimplementationfeaturexmlversion2.html \
 		test_domimplementationhasfeature01.html \
 		test_domimplementationhasfeature02.html \
 		$(NULL)
 
-_TEST_FILES_C	= \
+MOCHITEST_FILES_C	= \
 		test_elementgetattributenodens01.html \
 		test_elementgetattributenodens02.html \
 		test_elementgetattributenodens03.html \
 		test_elementgetattributens02.html \
 		test_elementgetelementsbytagnamens02.html \
 		test_elementgetelementsbytagnamens04.html \
 		test_elementgetelementsbytagnamens05.html \
 		test_elementhasattribute01.html \
@@ -144,17 +142,17 @@ include $(topsrcdir)/config/rules.mk
 		test_getElementsByTagNameNS02.html \
 		test_getElementsByTagNameNS03.html \
 		test_getElementsByTagNameNS04.html \
 		test_getElementsByTagNameNS05.html \
 		test_getElementsByTagNameNS06.html \
 		test_getElementsByTagNameNS07.html \
 		$(NULL)
 
-_TEST_FILES_D	= \
+MOCHITEST_FILES_D	= \
 		test_getElementsByTagNameNS08.html \
 		test_getElementsByTagNameNS09.html \
 		test_getElementsByTagNameNS10.html \
 		test_getElementsByTagNameNS11.html \
 		test_getElementsByTagNameNS12.html \
 		test_getElementsByTagNameNS13.html \
 		test_getElementsByTagNameNS14.html \
 		test_getNamedItemNS01.html \
@@ -202,17 +200,17 @@ include $(topsrcdir)/config/rules.mk
 		test_isSupported09.html \
 		test_isSupported10.html \
 		test_isSupported11.html \
 		test_isSupported12.html \
 		test_isSupported13.html \
 		test_isSupported14.html \
 		$(NULL)
 
-_TEST_FILES_E	= \
+MOCHITEST_FILES_E	= \
 		test_localName01.html \
 		test_localName02.html \
 		test_localName03.html \
 		test_localName04.html \
 		test_namednodemapgetnameditemns01.html \
 		test_namednodemapgetnameditemns02.html \
 		test_namednodemapgetnameditemns03.html \
 		test_namednodemapgetnameditemns04.html \
@@ -253,17 +251,17 @@ include $(topsrcdir)/config/rules.mk
 		test_nodehasattributes04.html \
 		test_nodeissupported01.html \
 		test_nodeissupported02.html \
 		test_nodeissupported03.html \
 		test_nodeissupported04.html \
 		test_nodeissupported05.html \
 		$(NULL)
 
-_TEST_FILES_F	= \
+MOCHITEST_FILES_F	= \
 		test_nodenormalize01.html \
 		test_normalize01.html \
 		test_ownerDocument01.html \
 		test_ownerElement01.html \
 		test_ownerElement02.html \
 		test_prefix01.html \
 		test_prefix02.html \
 		test_prefix03.html \
@@ -291,26 +289,11 @@ include $(topsrcdir)/config/rules.mk
 		test_setNamedItemNS01.html \
 		test_setNamedItemNS02.html \
 		test_setNamedItemNS03.html \
 		test_setNamedItemNS04.html \
 		test_setNamedItemNS05.html \
 		test_systemId01.html \
 		$(NULL)
 
-# work around nsinstall limits on windows by splitting into groups
-libs:: 	$(_TEST_FILES_A)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_B)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+MOCHITEST_FILES_PARTS := $(foreach part,A B C D E F,MOCHITEST_FILES_$(part))
 
-libs::	$(_TEST_FILES_C)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: 	$(_TEST_FILES_D)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_E)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs::	$(_TEST_FILES_F)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level2-core/files/Makefile.in
+++ b/dom/tests/mochitest/dom-level2-core/files/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level2-core/files
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		hc_staff.html \
 		hc_staff.svg \
 		hc_staff.xhtml \
 		hc_staff.xml \
 		internalSubset01.js \
 		nodtdstaff.svg \
 		nodtdstaff.xml \
 		staff.dtd \
@@ -34,10 +33,9 @@ include $(topsrcdir)/config/rules.mk
 		xhtml-lat1.ent \
 		xhtml-special.ent \
 		xhtml-symbol.ent \
 		xhtml1-frameset.dtd \
 		xhtml1-strict.dtd \
 		xhtml1-transitional.dtd \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level2-html/Makefile.in
+++ b/dom/tests/mochitest/dom-level2-html/Makefile.in
@@ -8,19 +8,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level2-html
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = files
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES_A	= \
+MOCHITEST_FILES_A	= \
 		DOMTestCase.js \
 		test_anchor01.html \
 		test_anchor02.html \
 		test_anchor03.html \
 		test_anchor04.html \
 		test_anchor05.html \
 		test_anchor06.html \
 		test_area01.html \
@@ -96,17 +94,17 @@ include $(topsrcdir)/config/rules.mk
 		test_HTMLCollection10.html \
 		test_HTMLCollection11.html \
 		test_HTMLCollection12.html \
 		$(NULL)
 
 # This test is failing on all platforms -- bug 471139
 #		test_HTMLDocument12.html \
 #
-_TEST_FILES_B	= \
+MOCHITEST_FILES_B	= \
 		test_HTMLDirectoryElement01.html \
 		test_HTMLDivElement01.html \
 		test_HTMLDlistElement01.html \
 		test_HTMLDocument01.html \
 		test_HTMLDocument02.html \
 		test_HTMLDocument03.html \
 		test_HTMLDocument04.html \
 		test_HTMLDocument05.html \
@@ -271,17 +269,17 @@ include $(topsrcdir)/config/rules.mk
 		test_HTMLElement93.html \
 		test_HTMLElement94.html \
 		test_HTMLElement95.html \
 		test_HTMLElement96.html \
 		test_HTMLElement97.html \
 		test_HTMLElement98.html \
 		test_HTMLElement99.html \
 		$(NULL)
-_TEST_FILES_C	= \
+MOCHITEST_FILES_C	= \
 		test_HTMLFieldSetElement01.html \
 		test_HTMLFieldSetElement02.html \
 		test_HTMLFontElement01.html \
 		test_HTMLFontElement02.html \
 		test_HTMLFontElement03.html \
 		test_HTMLFormElement01.html \
 		test_HTMLFormElement02.html \
 		test_HTMLFormElement03.html \
@@ -386,17 +384,17 @@ include $(topsrcdir)/config/rules.mk
 		test_HTMLMetaElement03.html \
 		test_HTMLMetaElement04.html \
 		test_HTMLModElement01.html \
 		test_HTMLModElement02.html \
 		test_HTMLModElement03.html \
 		test_HTMLModElement04.html \
 		$(NULL)
 
-_TEST_FILES_D	= \
+MOCHITEST_FILES_D	= \
 		test_HTMLObjectElement01.html \
 		test_HTMLObjectElement02.html \
 		test_HTMLObjectElement03.html \
 		test_HTMLObjectElement04.html \
 		test_HTMLObjectElement05.html \
 		test_HTMLObjectElement06.html \
 		test_HTMLObjectElement07.html \
 		test_HTMLObjectElement08.html \
@@ -620,17 +618,17 @@ include $(topsrcdir)/config/rules.mk
 		test_HTMLTextAreaElement12.html \
 		test_HTMLTextAreaElement13.html \
 		test_HTMLTextAreaElement14.html \
 		test_HTMLTextAreaElement15.html \
 		test_HTMLTitleElement01.html \
 		test_HTMLUListElement01.html \
 		test_HTMLUListElement02.html \
 		$(NULL)
-_TEST_FILES_E	= \
+MOCHITEST_FILES_E	= \
 		test_object01.html \
 		test_object02.html \
 		test_object03.html \
 		test_object04.html \
 		test_object05.html \
 		test_object06.html \
 		test_object07.html \
 		test_object08.html \
@@ -692,35 +690,25 @@ include $(topsrcdir)/config/rules.mk
                 test_hasFeature01.html \
 		test_hasFeature02.html \
 		test_hasFeature03.html \
 		test_hasFeature04.html \
 		test_hasFeature05.html \
 		test_hasFeature06.html \
 		$(NULL)
 
-_TEST_FILES_F	= \
+MOCHITEST_FILES_F	= \
 		test_HTMLAppletElement01.html \
 		test_HTMLAppletElement02.html \
 		test_HTMLAppletElement03.html \
 		test_HTMLAppletElement04.html \
 		test_HTMLAppletElement05.html \
 		test_HTMLAppletElement06.html \
 		test_HTMLAppletElement07.html \
 		test_HTMLAppletElement08.html \
 		test_HTMLAppletElement09.html \
 		test_HTMLAppletElement10.html \
 		test_HTMLAppletElement11.html \
 		$(NULL)
 
-# work around nsinstall limits on windows by splitting into groups
-libs:: 	$(_TEST_FILES_A)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: 	$(_TEST_FILES_B)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: 	$(_TEST_FILES_C)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: 	$(_TEST_FILES_D)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: 	$(_TEST_FILES_E)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-#libs:: 	$(_TEST_FILES_F)
-#	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+MOCHITEST_FILES_PARTS := $(foreach part,A B C D E,MOCHITEST_FILES_$(part))
+
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/dom-level2-html/files/Makefile.in
+++ b/dom/tests/mochitest/dom-level2-html/files/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/dom-level2-html/files
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		anchor.html \
 		anchor.xhtml \
 		anchor.xml \
 		anchor2.html \
 		anchor2.xhtml \
 		anchor2.xml \
 		applet.html \
 		applet.xhtml \
@@ -215,16 +214,15 @@ include $(topsrcdir)/config/rules.mk
 		w3c_main.png \
 		xhtml-lat1.ent \
 		xhtml-special.ent \
 		xhtml-symbol.ent \
 		xhtml1-frameset.dtd \
 		xhtml1-strict.dtd \
 		xhtml1-transitional.dtd \
 		$(NULL)
-_TEST_FILES_J   = \
+MOCHITEST_FILES_J   = \
 		applets/org/w3c/domts/DOMTSApplet.class \
 		$(NULL)
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: $(_TEST_FILES_J)
+include $(topsrcdir)/config/rules.mk
+libs:: $(MOCHITEST_FILES_J)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/applets/org/w3c/domts
 
--- a/dom/tests/mochitest/general/Makefile.in
+++ b/dom/tests/mochitest/general/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = dom/tests/mochitest/general
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		file_MozEnteredDomFullscreen.html \
 		test_outerHTML.html \
 		test_outerHTML.xhtml \
 		497633.html \
 		historyframes.html \
 		test_497898.html \
 		test_bug504220.html \
 		test_bug628069_1.html \
@@ -44,19 +43,15 @@ include $(topsrcdir)/config/rules.mk
 		test_for_of.html \
 		test_focus_legend_noparent.html \
 		file_clonewrapper.html \
 		file_moving_nodeList.html \
 		test_performance_now.html \
 		test_interfaces.html \
 		$(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_innerScreen.xul \
 		test_offsets.xul \
 		test_offsets.js \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/geolocation/Makefile.in
+++ b/dom/tests/mochitest/geolocation/Makefile.in
@@ -5,19 +5,17 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/geolocation
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_allowCurrent.html \
 		test_allowWatch.html \
 		test_cancelCurrent.html \
 		test_cancelWatch.html \
 		test_clearWatch.html \
 		test_clearWatch_invalid.html \
 		test_manyCurrentConcurrent.html \
 		test_manyCurrentSerial.html \
@@ -30,11 +28,9 @@ include $(topsrcdir)/config/rules.mk
 		test_timerRestartWatch.html \
 		test_worseAccuracyDoesNotBlockCallback.html \
 		geolocation.html \
 		geolocation_common.js  \
 		network_geolocation.sjs \
 		windowTest.html \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/localstorage/Makefile.in
+++ b/dom/tests/mochitest/localstorage/Makefile.in
@@ -6,19 +6,17 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/localstorage
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
     frameBug624047.html \
     frameChromeSlave.html \
     frameKeySync.html \
     frameMasterEqual.html \
     frameMasterNotEqual.html \
     frameSlaveEqual.html \
     frameSlaveNotEqual.html \
     frameReplace.html \
@@ -53,17 +51,14 @@ include $(topsrcdir)/config/rules.mk
     test_localStorageQuotaPrivateBrowsing.html \
     test_localStorageQuotaSessionOnly.html \
     test_localStorageQuotaSessionOnly2.html \
     test_localStorageKeyOrder.html \
     test_removeOwnersAPI.html \
     test_removeOwnersAPISessionOnly.html \
     test_storageConstructor.html \
     $(NULL)
-    
-_CHROME_FILES = \
+
+MOCHITEST_CHROME_FILES = \
     test_localStorageFromChrome.xhtml \
     $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs::	$(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/notification/Makefile.in
+++ b/dom/tests/mochitest/notification/Makefile.in
@@ -5,20 +5,16 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/notification
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_basic_notification.html \
 		test_basic_notification_click.html \
 		test_leak_windowClose.html \
 		notification_common.js \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/orientation/Makefile.in
+++ b/dom/tests/mochitest/orientation/Makefile.in
@@ -5,18 +5,14 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/orientation
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		bug507902-frame.html \
 		test_bug507902.html \
 		$(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/pointerlock/Makefile.in
+++ b/dom/tests/mochitest/pointerlock/Makefile.in
@@ -5,19 +5,17 @@
 DEPTH	= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir	= @srcdir@
 VPATH	= @srcdir@
 relativesrcdir	= dom/tests/mochitest/pointerlock
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		test_pointerlock-api.html \
 		pointerlock_utils.js \
 		file_approval.html \
 		file_pointerlock-api.html \
 		file_pointerlockerror.html \
 		file_escapeKey.html \
 		file_withoutDOM.html \
 		file_removedFromDOM.html \
@@ -30,10 +28,9 @@ include $(topsrcdir)/config/rules.mk
 		file_retargetMouseEvents.html \
 		file_targetOutOfFocus.html \
 		file_screenClientXYConst.html \
 		file_suppressSomeMouseEvents.html \
 		file_locksvgelement.html \
 		iframe_differentDOM.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/sessionstorage/Makefile.in
+++ b/dom/tests/mochitest/sessionstorage/Makefile.in
@@ -6,32 +6,27 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/sessionstorage
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
     frameReplace.html \
     frameEqual.html \
     frameNotEqual.html \
     file_http.html \
     file_https.html \
     test_sessionStorageBase.html \
     test_sessionStorageClone.html \
     test_sessionStorageReplace.html \
     test_sessionStorageHttpHttps.html \
     interOriginSlave.js \
     interOriginTest.js \
     $(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
     test_sessionStorageFromChrome.xhtml \
     $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs::	$(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/storageevent/Makefile.in
+++ b/dom/tests/mochitest/storageevent/Makefile.in
@@ -6,28 +6,25 @@
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/storageevent
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
     frameLocalStorageMaster.html \
     frameLocalStorageSlaveEqual.html \
     frameLocalStorageSlaveNotEqual.html \
     frameSessionStorageMasterEqual.html \
     frameSessionStorageMasterNotEqual.html \
     frameSessionStorageSlaveEqual.html \
     frameSessionStorageSlaveNotEqual.html \
     test_storageLocalStorageEventCheckNoPropagation.html \
     test_storageLocalStorageEventCheckPropagation.html \
     test_storageSessionStorageEventCheckPropagation.html \
     test_storageSessionStorageEventCheckNoPropagation.html \
     interOriginFrame.js \
     interOriginTest2.js \
     $(NULL)
 
-libs::	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/webapps/Makefile.in
+++ b/dom/tests/mochitest/webapps/Makefile.in
@@ -9,25 +9,21 @@ VPATH	 = @srcdir@
 relativesrcdir	= dom/tests/mochitest/webapps
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
     apps \
     $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_CHROME_FILES	= \
     test_bug_765063.xul \
     test_install_app.xul \
     test_list_api.xul \
     test_install_errors.xul \
     test_cross_domain.xul \
     test_install_utf8.xul \
     test_install_receipts.xul \
     jshelper.js \
     apphelper.js \
     $(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/webapps/apps/Makefile.in
+++ b/dom/tests/mochitest/webapps/apps/Makefile.in
@@ -5,19 +5,17 @@
 DEPTH	 = ../../../../..
 topsrcdir	 = @top_srcdir@
 srcdir	= @srcdir@
 VPATH	 = @srcdir@
 relativesrcdir	= dom/tests/mochitest/webapps/apps
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES	= \
+MOCHITEST_CHROME_FILES	= \
     bug_765063.xul \
     include.html \
     wild_crazy.webapp \
     wild_crazy.webapp^headers^ \
     super_crazy.webapp \
     super_crazy.webapp^headers^ \
     missing_required_field.webapp \
     missing_required_field.webapp^headers^ \
@@ -25,11 +23,9 @@ include $(topsrcdir)/config/rules.mk
     json_syntax_error.webapp^headers^ \
     no_delegated_install.webapp \
     no_delegated_install.webapp^headers^ \
     bad_content_type.webapp \
     manifest_with_bom.webapp \
     manifest_with_bom.webapp^headers^ \
     $(NULL)
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
+include $(topsrcdir)/config/rules.mk
--- a/dom/tests/mochitest/whatwg/Makefile.in
+++ b/dom/tests/mochitest/whatwg/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= dom/tests/mochitest/whatwg
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES	= \
+MOCHITEST_FILES	= \
 		browserFu.js \
 		test_MessageEvent.html \
 		test_postMessage.html \
 		postMessage_helper.html \
 		test_postMessage_joined.html \
 		postMessage_joined_helper.html \
 		postMessage_joined_helper2.html \
 		test_postMessage_onOther.html \
@@ -48,17 +47,13 @@ include $(topsrcdir)/config/rules.mk
 		file_bug500328_1.html \
 		file_bug500328_2.html \
 		test_document_scripts.html \
 		test_postMessage_structured_clone.html \
 		postMessage_structured_clone_helper.js \
 		postMessage_structured_clone_helper.html \
 		$(NULL)
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_postMessage_chrome.html \
 		$(NULL)		
 
-libs:: 	$(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/dom/workers/test/Makefile.in
+++ b/dom/workers/test/Makefile.in
@@ -10,19 +10,17 @@ VPATH            = @srcdir@
 relativesrcdir   = dom/workers/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   extensions \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_404.html \
   test_atob.html \
   atob_worker.js \
   test_blobWorkers.html \
   test_clearTimeouts.html \
   clearTimeouts_worker.js \
   test_close.html \
   close_worker.js \
@@ -89,23 +87,23 @@ include $(topsrcdir)/config/rules.mk
   test_workersDisabled.html \
   workersDisabled_worker.js \
   test_xhr_implicit_cancel.html \
   xhr_implicit_cancel_worker.js \
   test_xhr_timeout.html \
   test_blobConstructor.html \
   $(NULL)
 
-_SUBDIR_TEST_FILES = \
+_SUBDIRMOCHITEST_FILES = \
   relativeLoad_sub_worker.js \
   relativeLoad_sub_worker2.js \
   relativeLoad_sub_import.js \
   $(NULL)
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
   test_chromeWorker.xul \
   test_chromeWorkerJSM.xul \
   test_extension.xul \
   test_extensionBootstrap.xul \
   test_file.xul \
   test_fileSlice.xul \
   test_fileBlobPosting.xul \
   test_filePosting.xul \
@@ -128,16 +126,12 @@ include $(topsrcdir)/config/rules.mk
   WorkerTest_subworker.js \
   chromeWorker_worker.js \
   chromeWorker_subworker.js \
   test_workersDisabled.xul \
   workersDisabled_worker.js \
   dom_worker_helper.js \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_SUBDIR_TEST_FILES)
+libs:: $(_SUBDIRMOCHITEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/subdir
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/editor/composer/test/Makefile.in
+++ b/editor/composer/test/Makefile.in
@@ -5,30 +5,25 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = editor/composer/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug348497.html \
 		test_bug384147.html \
 		test_bug389350.html \
 		test_bug519928.html \
 		bug678842_subframe.html \
 		test_bug738440.html \
 		$(NULL)
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug434998.xul \
 		test_bug338427.html \
 		test_bug678842.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/editor/libeditor/base/tests/Makefile.in
+++ b/editor/libeditor/base/tests/Makefile.in
@@ -5,35 +5,30 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = editor/libeditor/base/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug408231.html \
 		test_bug502673.html \
 		test_bug514156.html \
 		test_bug567213.html \
 		file_bug586662.html \
 		test_bug586662.html \
 		test_bug599983.html \
 		test_bug742261.html \
 		$(NULL)
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_selection_move_commands.xul \
                 test_bug46555.html \
 		test_bug646194.xul \
 		test_dragdrop.html \
 		test_bug599983.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/editor/libeditor/html/tests/Makefile.in
+++ b/editor/libeditor/html/tests/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = editor/libeditor/html/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		green.png \
 		test_bug290026.html \
 		test_bug291780.html \
 		test_bug316447.html \
 		test_bug332636.html \
 		test_bug332636.html^headers^ \
 		test_bug372345.html \
 		test_bug404320.html \
@@ -78,41 +77,38 @@ include $(topsrcdir)/config/rules.mk
 		file_select_all_without_body.html \
 		test_root_element_replacement.html \
 		test_bug738366.html \
 		test_bug757371.html \
 		test_bug767684.html \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_TEST_FILES +=  test_spellcheck_pref.html \
+MOCHITEST_FILES +=  test_spellcheck_pref.html \
 		$(NULL)
 endif
 
 _DATA_FILES = \
 		data/cfhtml-chromium.txt \
 		data/cfhtml-firefox.txt \
 		data/cfhtml-ie.txt \
 		data/cfhtml-ooo.txt \
 		data/cfhtml-nocontext.txt \
 		$(NULL)
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_contenteditable_text_input_handling.html \
 		test_bug366682.html \
 		test_bug489202.xul \
 		test_bug490879.xul \
 		test_bug607584.xul \
 		test_bug616590.xul \
 		test_bug635636.html \
 		green.png \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
+
+libs::
 	(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - browserscope 2> /dev/null) | (cd $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) && tar -xf -)
 
 libs:: $(_DATA_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/data
-
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/editor/libeditor/text/tests/Makefile.in
+++ b/editor/libeditor/text/tests/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = editor/libeditor/text/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug318065.html \
 		test_bug471722.html \
 		test_bug527935.html \
 		test_bug569988.html \
 		test_bug590554.html \
 		test_bug596001.html \
 		test_bug596333.html \
 		test_bug596506.html \
@@ -36,25 +35,21 @@ include $(topsrcdir)/config/rules.mk
 		test_bug740784.html \
 		test_bug757771.html \
 		test_dom_input_event_on_texteditor.html \
 		$(NULL)
 
 # disables the key handling test on gtk2 because gtk2 overrides some key events
 # on our editor, and the combinations depend on the system.
 ifneq ($(MOZ_WIDGET_TOOLKIT),gtk2)
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_texteditor_keyevent_handling.html \
 		$(NULL)
 endif
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug471319.html \
 		test_bug483651.html \
 		test_bug636465.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/embedding/test/Makefile.in
+++ b/embedding/test/Makefile.in
@@ -5,23 +5,21 @@
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = embedding/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 	test_bug293834.html \
 	bug293834_form.html \
 	320x240.ogv \
 	test_bug449141.html \
 	bug449141_page.html \
 	test_bug499115.html \
 	test_nsFind.html \
 	test_window_open_units.html \
 	$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/extensions/cookie/test/Makefile.in
+++ b/extensions/cookie/test/Makefile.in
@@ -8,17 +8,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = extensions/cookie/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE          = test_cookies
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
   test_samedomain.html \
   file_testcommon.js \
   file_domain_inner.html \
   file_domain_inner_inner.html \
   test_differentdomain.html \
   test_different_domain_in_hierarchy.html \
   file_domain_hierarchy_inner.html \
   file_domain_hierarchy_inner_inner.html \
@@ -47,26 +47,20 @@ MODULE          = test_cookies
   test_same_base_domain_3.html \
   test_same_base_domain_4.html \
   file_localhost_inner.html \
   test_same_base_domain_5.html \
   test_same_base_domain_6.html \
   file_loopback_inner.html \
   $(NULL)
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_test_favicon.js \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
 XPCSHELL_TESTS = unit
 
 # FIXME/bug 575918: out-of-process xpcshell is broken on OS X
 ifneq ($(OS_ARCH),Darwin)
 XPCSHELL_TESTS += unit_ipc
 endif
 
 include $(topsrcdir)/config/rules.mk
--- a/extensions/spellcheck/tests/chrome/Makefile.in
+++ b/extensions/spellcheck/tests/chrome/Makefile.in
@@ -8,15 +8,12 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = extensions/spellcheck/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = base map
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES = 	test_add_remove_dictionaries.xul \
+MOCHITEST_CHROME_FILES = 	test_add_remove_dictionaries.xul \
 				$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/extensions/spellcheck/tests/chrome/base/Makefile.in
+++ b/extensions/spellcheck/tests/chrome/base/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = extensions/spellcheck/tests/chrome/base
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	base_utf.dic \
+MOCHITEST_CHROME_FILES = 	base_utf.dic \
 				base_utf.aff \
 				$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/extensions/spellcheck/tests/chrome/map/Makefile.in
+++ b/extensions/spellcheck/tests/chrome/map/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = extensions/spellcheck/tests/chrome/map
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	maputf.dic \
+MOCHITEST_CHROME_FILES = 	maputf.dic \
 				maputf.aff \
 				$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/extensions/universalchardet/tests/Makefile.in
+++ b/extensions/universalchardet/tests/Makefile.in
@@ -5,21 +5,19 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-include $(topsrcdir)/config/rules.mk
-
 relativesrcdir = extensions/universalchardet/tests
 
-_TEST_FILES =	\
+MOCHITEST_CHROME_FILES =	\
 		CharsetDetectionTests.js \
 		bug9357_text.html \
 		test_bug9357.html \
 		bug171813_text.html \
 		test_bug171813.html \
 		bug306272_text.html \
 		test_bug306272.html \
 		bug421271_text.html \
@@ -40,10 +38,9 @@ relativesrcdir = extensions/universalcha
 		bug631751le_text.html \
 		test_bug631751le.html \
 		bug631751be_text.html \
 		test_bug631751be.html \
 		bug638318_text.html \
 		test_bug638318.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/gfx/tests/Makefile.in
+++ b/gfx/tests/Makefile.in
@@ -11,17 +11,17 @@ relativesrcdir = gfx/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= gfx
 MOZILLA_INTERNAL_API = 1
 
 XPCSHELL_TESTS = unit
 
-_TEST_FILES = $(addprefix mochitest/, \
+MOCHITEST_FILES = $(addprefix mochitest/, \
 	test_bug509244.html \
 	test_bug513439.html \
 	test_acceleration.html \
 )
 
 # CPP_UNIT_TESTS disabled for now because they dont work in libxul builds.
 #ifndef BUILD_STATIC_LIBS
 #
@@ -76,13 +76,8 @@ endif
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
 OS_LIBS		+= -framework Cocoa
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 OS_LIBS		+= $(MOZ_PANGO_LIBS) $(XLIBS)
 CXXFLAGS	+= $(MOZ_PANGO_CFLAGS)
 endif
-
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") \
-	    $(DEPTH)/_tests/testing/mochitest/tests/gfx
--- a/image/test/mochitest/Makefile.in
+++ b/image/test/mochitest/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = image/test/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =   imgutils.js \
+MOCHITEST_FILES =   imgutils.js \
                 lime100x100.svg \
                 test_bug399925.html \
                 bug399925.gif \
                 schrep.png \
                 bug468160.sjs \
                 test_bug468160.html \
                 red.png \
                 test_bug466586.html \
@@ -62,17 +61,17 @@ include $(topsrcdir)/config/rules.mk
 		error-early.png \
 		test_drawDiscardedImage.html \
                 $(NULL)
 
 # Tests disabled due to intermittent orange
 # test_bug435296.html disabled - See bug 578591
 # test_bug478398.html disabled - See bug 579139
 
-_CHROME_FILES = imgutils.js \
+MOCHITEST_CHROME_FILES = imgutils.js \
                 animationPolling.js \
                 lime-anim-100x100.svg \
                 animation.svg \
                 test_animSVGImage.html \
                 test_animation.html \
                 test_animation2.html \
                 animated-gif-finalframe.gif \
                 animated-gif.gif \
@@ -90,13 +89,9 @@ include $(topsrcdir)/config/rules.mk
                 test_undisplayed_iframe.html \
                 iframe.html \
                 ref-iframe.html \
                 test_net_failedtoprocess.html \
                 invalid.jpg \
                 damon.jpg \
                 $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/intl/uconv/tests/Makefile.in
+++ b/intl/uconv/tests/Makefile.in
@@ -27,21 +27,19 @@ XPCSHELL_TESTS	= unit
 #ifeq ($(OS_ARCH),WINNT)
 #CPPSRCS		+= convperf.cpp
 #endif
 #
 #SIMPLE_PROGRAMS	= $(CPPSRCS:.cpp=$(BIN_SUFFIX))
 
 relativesrcdir	= intl/uconv/tests
 
-_TEST_FILES =	\
+MOCHITEST_FILES =	\
 		test_bug335816.html \
 		test_long_doc.html \
 		test_singlebyte_overconsumption.html \
 		test_unicode_noncharacterescapes.html \
 		test_unicode_noncharacters_gb18030.html \
 		test_unicode_noncharacters_utf8.html \
 		test_utf8_overconsumption.html \
 		$(NULL)
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
 include $(topsrcdir)/config/rules.mk
--- a/js/jsd/test/Makefile.in
+++ b/js/jsd/test/Makefile.in
@@ -8,17 +8,15 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = js/jsd/test
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = jsdebug
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug507448.html bug507448.js \
+MOCHITEST_FILES = 	test_bug507448.html bug507448.js \
 		test_bug617870-callhooks.html test-bug617870-callhooks.js jsd-test.js \
 		test_bug638178-execlines.html test-bug638178-execlines.js \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/js/src/config/makefiles/mochitest.mk
@@ -0,0 +1,60 @@
+# -*- makefile -*-
+# vim:set ts=8 sw=8 sts=8 noet:
+#
+# 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/.
+
+ifndef INCLUDED_TESTS_MOCHITEST_MK #{
+
+ifdef relativesrcdir
+  mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(relativesrcdir)
+else
+  mochitestdir = $(DEPTH)/_tests/testing/mochitest/$1/$(subst $(topsrcdir),,$(srcdir))
+endif
+
+define mochitest-libs-rule-template
+libs:: $$($(1))
+	$$(INSTALL) $$(foreach f,$$^,"$$(f)") $$(call mochitestdir,$(2))
+endef
+
+# Provide support for modules with such a large number of tests that
+# installing them with a single $(INSTALL) invocation would overflow
+# command-line length limits on some operating systems.
+ifdef MOCHITEST_FILES_PARTS
+ifdef MOCHITEST_FILES
+$(error You must define only one of MOCHITEST_FILES_PARTS or MOCHITEST_FILES)
+endif
+$(foreach part,$(MOCHITEST_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),tests)))
+endif
+
+ifdef MOCHITEST_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_FILES,tests))
+endif
+
+ifdef MOCHITEST_CHROME_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_CHROME_FILES,chrome))
+endif
+
+ifdef MOCHITEST_BROWSER_FILES_PARTS
+ifdef MOCHITEST_BROWSER_FILES
+$(error You must define only one of MOCHITEST_BROWSER_FILES_PARTS or MOCHITEST_BROWSER_FILES)
+endif
+$(foreach part,$(MOCHITEST_BROWSER_FILES_PARTS),$(eval $(call mochitest-libs-rule-template,$(part),browser)))
+endif
+
+ifdef MOCHITEST_BROWSER_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_BROWSER_FILES,browser))
+endif
+
+ifdef MOCHITEST_A11Y_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_A11Y_FILES,a11y))
+endif
+
+ifdef MOCHITEST_WEBAPPRT_CHROME_FILES
+$(eval $(call mochitest-libs-rule-template,MOCHITEST_WEBAPPRT_CHROME_FILES,webapprtChrome))
+endif
+
+INCLUDED_TESTS_MOCHITEST_MK := 1
+
+endif #} INCLUDED_TESTS_MOCHITEST_MK
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -84,16 +84,20 @@ ifdef ENABLE_TESTS
 # that changes to tests may not be updated and code could assume to pass
 # locally against non-current test code.
 DIRS += $(TEST_DIRS)
 
 ifndef INCLUDED_TESTS_XPCSHELL_MK #{
   include $(topsrcdir)/config/makefiles/xpcshell.mk
 endif #}
 
+ifndef INCLUDED_TESTS_MOCHITEST_MK #{
+  include $(topsrcdir)/config/makefiles/mochitest.mk
+endif #}
+
 ifdef CPP_UNIT_TESTS
 
 # Compile the tests to $(DIST)/bin.  Make lots of niceties available by default
 # through TestHarness.h, by modifying the list of includes and the libs against
 # which stuff links.
 CPPSRCS += $(CPP_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(CPP_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 INCLUDES += -I$(DIST)/include/testing
--- a/js/xpconnect/tests/chrome/Makefile.in
+++ b/js/xpconnect/tests/chrome/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = js/xpconnect/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug448587.xul \
 		test_bug500931.xul \
 		bug503926.xul \
 		test_bug503926.xul \
 		test_bug533596.xul \
 		test_doublewrappedcompartments.xul \
 		test_evalInSandbox.xul \
 		file_evalInSandbox.html \
@@ -55,10 +54,9 @@ include $(topsrcdir)/config/rules.mk
 
 # Disabled until this test gets updated to test the new proxy based
 # wrappers.
 #		test_wrappers-2.xul \
 
 # Disabled due to apparent conservative stack scanner false positives on Linux64 debug.
 #		test_watchpoints.xul \
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/js/xpconnect/tests/mochitest/Makefile.in
+++ b/js/xpconnect/tests/mochitest/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = js/xpconnect/tests/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	bug500931_helper.html \
+MOCHITEST_FILES =	bug500931_helper.html \
 		inner.html \
 		bug92773_helper.html \
 		bug504877_helper.html \
 		bug571849_helper.html \
 		chrome_wrappers_helper.html \
 		file_doublewrappedcompartments.html \
 		file_evalInSandbox.html \
 		file_wrappers-2.html \
@@ -68,29 +67,22 @@ include $(topsrcdir)/config/rules.mk
 		file_nodelists.html \
 		file_bug706301.html \
 		file_exnstack.html \
 		file_expandosharing.html \
 		file_bug760131.html \
 		file_empty.html \
 		$(NULL)
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_bug361111.xul \
 		test_bug760131.html \
 		$(NULL)
 
 ifneq ($(OS_TARGET),Android)
 ifndef MOZ_PLATFORM_MAEMO
-_TEST_FILES +=	test_bug657267.html \
+MOCHITEST_FILES +=	test_bug657267.html \
 		bug657267.jar
 endif
 endif
 
-
-		#test_bug484107.html \
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -20,21 +20,17 @@ PARALLEL_DIRS += \
 
 BARE_UNIT_TESTS = \
 		TestPoisonArea.cpp \
 		$(NULL)
 
 CPPSRCS += $(BARE_UNIT_TESTS)
 SIMPLE_PROGRAMS += $(BARE_UNIT_TESTS:.cpp=$(BIN_SUFFIX))
 
-include $(topsrcdir)/config/rules.mk
-
-DEFINES += -D_IMPL_NS_LAYOUT
-
-_TEST_FILES =	\
+MOCHITEST_FILES =	\
 		border_radius_hit_testing_iframe.html \
 		test_preserve3d_sorting_hit_testing.html \
 		preserve3d_sorting_hit_testing_iframe.html \
 		test_image_layers.html \
 		image_rgrg-256x256.png \
 		image_rrgg-256x256.png \
 		bug369950-subframe.xml \
 		test_after_paint_pref.html \
@@ -154,26 +150,26 @@ DEFINES += -D_IMPL_NS_LAYOUT
 		test_bug725426.html \
 		test_bug731777.html \
 		test_bug761572.html \
 		$(NULL)
 
 # Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208
 ifeq (,$(filter windows,$(MOZ_WIDGET_TOOLKIT)))
 # THESE TESTS (BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		bidi_numeral_test.js \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug332655-1.html \
 		test_bug332655-2.html \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug441782-1a.html \
 		test_bug441782-1b.html \
 		test_bug441782-1c.html \
 		test_bug441782-1d.html \
 		test_bug441782-1e.html \
 		bug441782-1.html \
 		bug441782-1-ref.html \
 		test_bug441782-2a.html \
@@ -201,17 +197,17 @@ ifeq (,$(filter windows,$(MOZ_WIDGET_TOO
 		test_bug441782-5b.html \
 		test_bug441782-5c.html \
 		test_bug441782-5d.html \
 		test_bug441782-5e.html \
 		bug441782-5.html \
 		bug441782-5-ref.html \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug467672-1a.html \
 		test_bug467672-1b.html \
 		test_bug467672-1c.html \
 		test_bug467672-1d.html \
 		test_bug467672-1e.html \
 		test_bug467672-1f.html \
 		test_bug467672-1g.html \
 		bug467672-1.html \
@@ -249,21 +245,21 @@ ifeq (,$(filter windows,$(MOZ_WIDGET_TOO
 		test_bug467672-5d.html \
 		test_bug467672-5e.html \
 		test_bug467672-5f.html \
 		test_bug467672-5g.html \
 		bug467672-5.html \
 		bug467672-5-ref.html \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug499538-1.html \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug570378-arabic-1a.html \
 		test_bug570378-arabic-1b.html \
 		test_bug570378-arabic-1c.html \
 		test_bug570378-arabic-1d.html \
 		test_bug570378-arabic-1e.html \
 		bug570378-arabic-1.html \
 		bug570378-arabic-1-ref.html \
 		test_bug570378-arabic-2a.html \
@@ -337,37 +333,36 @@ ifeq (,$(filter windows,$(MOZ_WIDGET_TOO
 		test_bug570378-persian-5e.html \
 		test_bug570378-persian-5f.html \
 		test_bug570378-persian-5g.html \
 		bug570378-persian-5.html \
 		bug570378-persian-5-ref.html \
                 test_bug749186.html \
 		$(NULL)
 # THESE TESTS (ABOVE AND BELOW) DO NOT RUN ON WINDOWS
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_bug644768.html \
 		$(NULL)
 # THESE TESTS (ABOVE) DO NOT RUN ON WINDOWS
 endif
 
 # test_flush_on_paint.html fails frequently on Mac, bug 688128
 ifeq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
 # THESE TESTS (BELOW) DO NOT RUN ON MAC
-_TEST_FILES += \
+MOCHITEST_FILES += \
 		test_flush_on_paint.html \
 		$(NULL)
 # THESE TESTS (ABOVE) DO NOT RUN ON MAC
 endif
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	browser_bug617076.js \
 	$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
+
+DEFINES += -D_IMPL_NS_LAYOUT
 
 check::
 	@$(EXIT_ON_ERROR) \
 	  for f in $(subst .cpp,$(BIN_SUFFIX),$(BARE_UNIT_TESTS)); do \
 	    $(RUN_TEST_PROGRAM) $(DIST)/bin/$$f; \
 	  done
--- a/layout/base/tests/chrome/Makefile.in
+++ b/layout/base/tests/chrome/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = layout/base/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 	paint_listener.js \
 	test_bug370436.html \
 	test_bug396367-1.html \
 	test_bug396367-2.html \
 	test_bug420499.xul \
 	test_bug495648.xul \
 	bug495648.rdf \
 	test_bug504311.xul \
@@ -41,15 +40,14 @@ include $(topsrcdir)/config/rules.mk
 	     printpreview_bug396024_helper.xul \
 	test_printpreview_bug482976.xul \
 	     printpreview_bug482976_helper.xul \
 	test_transformed_scrolling_repaints.html \
 	test_transformed_scrolling_repaints_2.html \
 	$(NULL)
 
 ifdef MOZ_DEBUG
-_CHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
 	test_leaf_layers_partition_browser_window.xul \
 	$(NULL)
 endif
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/forms/test/Makefile.in
+++ b/layout/forms/test/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/forms/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	test_bug231389.html \
+MOCHITEST_FILES =	test_bug231389.html \
 		test_bug287446.html \
 		     bug287446_subframe.html \
 		test_bug345267.html \
 		test_bug348236.html \
 		test_bug353539.html \
 		test_bug365410.html \
 		test_bug378670.html \
 		test_bug402198.html \
@@ -42,20 +41,16 @@ include $(topsrcdir)/config/rules.mk
 		test_bug36619.html \
 		test_bug620936.html \
 		test_bug595310.html \
 		test_bug644542.html \
 		test_bug672810.html \
 		test_bug704049.html \
 		$(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug536567.html \
 		     bug536567_subframe.html \
 		test_bug665540.html \
 		     bug665540_window.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/generic/test/Makefile.in
+++ b/layout/generic/test/Makefile.in
@@ -5,21 +5,20 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/generic/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # in the list below, we make sure that the tests that require focus
 # run before test_plugin_clipping, which can steal focus for its window.
-_TEST_FILES = \
+MOCHITEST_FILES = \
   bug344830_testembed.svg \
   plugin_clipping_helper.xhtml \
   plugin_clipping_helper2.xhtml \
   plugin_clipping_helper_transformed.xhtml \
   plugin_clipping_helper_table.xhtml \
   plugin_clipping_lib.js \
   plugin_focus_helper.html \
   test_bug240933.html \
@@ -95,27 +94,23 @@ include $(topsrcdir)/config/rules.mk
   test_bug719503.html \
   test_bug719515.html \
   test_bug719518.html \
   test_bug719523.html \
   test_bug735641.html \
   test_bug748961.html \
   $(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
   frame_selection_underline.xhtml \
   frame_selection_underline-ref.xhtml \
   frame_selection_underline.css \
   test_selection_underline.html \
   test_bug632379.xul \
   test_bug508115.xul \
   test_bug469613.xul \
   test_bug469774.xul \
   test_backspace_delete.xul \
   test_bug514732-2.xul \
   file_bug514732_window.xul \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/inspector/tests/Makefile.in
+++ b/layout/inspector/tests/Makefile.in
@@ -5,23 +5,21 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= layout/inspector/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_FILES =\
 		test_bug462787.html \
 		test_bug462789.html \
 		test_bug522601.xhtml \
 		test_bug536379.html \
 		test_bug536379-2.html \
 		test_bug557726.html \
 		test_bug609549.xhtml \
 		test_isinheritableproperty.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/inspector/tests/chrome/Makefile.in
+++ b/layout/inspector/tests/chrome/Makefile.in
@@ -5,24 +5,22 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= layout/inspector/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES =\
+MOCHITEST_CHROME_FILES =\
 		test_bug467669.xul \
 		test_bug467669.css \
 		test_bug695639.xul \
 		test_bug695639.css \
 		GentiumPlus-R.woff \
 		test_bug708874.xul \
 		test_bug708874.css \
 		test_bug727834.xul \
 		test_bug727834.css \
 		$(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/mathml/tests/Makefile.in
+++ b/layout/mathml/tests/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/mathml/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_FILES =\
 	test_bug706406.html \
 	$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/style/test/Makefile.in
+++ b/layout/style/test/Makefile.in
@@ -28,33 +28,17 @@ HOST_SIMPLE_PROGRAMS	= $(addprefix host_
 # it buildable again.
 #
 # TestCSSPropertyLookup.cpp needs the internal XPCOM APIs and so cannot
 # be built with libxul enabled.
 #
 #CPP_UNIT_TESTS = TestCSSPropertyLookup.cpp
 #LIBS += ../nsCSSKeywords.$(OBJ_SUFFIX) ../nsCSSProps.$(OBJ_SUFFIX) $(XPCOM_LIBS)
 
-include $(topsrcdir)/config/rules.mk
-
-DEFINES += -DMOZILLA_INTERNAL_API -D_IMPL_NS_LAYOUT
-
-# FIXME: We don't seem to do auto-generated dependencies here.
-host_ListCSSProperties.$(OBJ_SUFFIX): $(srcdir)/../nsCSSPropList.h
-TestCSSPropertyLookup.$(OBJ_SUFFIX): $(srcdir)/../nsCSSProps.h $(srcdir)/../nsCSSKeywords.h
-
-css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_longhand.js Makefile
-	$(RM) $@
-	./host_ListCSSProperties$(HOST_BIN_SUFFIX) > $@
-	cat $(srcdir)/css_properties_like_longhand.js >> $@
-
-GARBAGE += css_properties.js
-
-
-_TEST_FILES =	test_acid3_test46.html \
+MOCHITEST_FILES =	test_acid3_test46.html \
 		test_animations.html \
 		test_any_dynamic.html \
 		test_at_rule_parse_serialize.html \
 		test_bug73586.html \
 		test_bug74880.html \
 		test_bug98997.html \
 		test_bug160403.html \
 		test_bug200089.html \
@@ -215,25 +199,32 @@ endif
 		$(topsrcdir)/layout/reftests/svg/pseudo-classes-02.svg \
 		$(topsrcdir)/layout/reftests/svg/pseudo-classes-02-ref.svg \
 		$(topsrcdir)/layout/reftests/svg/as-image/lime100x100.svg \
 		$(topsrcdir)/layout/reftests/svg/as-image/svg-image-visited-1-helper.svg \
 		$(topsrcdir)/layout/reftests/svg/as-image/svg-image-visited-2-helper.svg \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug453896.js \
 		bug453896_iframe.html \
 		media_queries_iframe.html \
 		$(NULL)
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
+
+DEFINES += -DMOZILLA_INTERNAL_API -D_IMPL_NS_LAYOUT
+
+# FIXME: We don't seem to do auto-generated dependencies here.
+host_ListCSSProperties.$(OBJ_SUFFIX): $(srcdir)/../nsCSSPropList.h
+TestCSSPropertyLookup.$(OBJ_SUFFIX): $(srcdir)/../nsCSSProps.h $(srcdir)/../nsCSSKeywords.h
+
+css_properties.js: host_ListCSSProperties$(HOST_BIN_SUFFIX) css_properties_like_longhand.js Makefile
+	$(RM) $@
+	./host_ListCSSProperties$(HOST_BIN_SUFFIX) > $@
+	cat $(srcdir)/css_properties_like_longhand.js >> $@
+
+GARBAGE += css_properties.js
 
 libs:: $(_VISITED_REFTEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/css-visited/
-
-ifneq (mobile,$(MOZ_BUILD_APP))
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-endif
--- a/layout/style/test/chrome/Makefile.in
+++ b/layout/style/test/chrome/Makefile.in
@@ -4,29 +4,24 @@
 
 DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = layout/style/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
     test_bug535806.xul \
     bug535806-css.css \
     bug535806-html.html \
     bug535806-xul.xul \
     test_hover.html \
     test_moz_document_rules.html \
     hover_helper.html \
     $(NULL)
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
     moz_document_helper.html \
     $(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/tables/test/Makefile.in
+++ b/layout/tables/test/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/tables/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug337124.html \
 		test_bug541668_table_event_delivery.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/xul/base/test/Makefile.in
+++ b/layout/xul/base/test/Makefile.in
@@ -5,34 +5,29 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/xul/base/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug511075.html \
+MOCHITEST_FILES = 	test_bug511075.html \
 		test_splitter.xul \
 		$(NULL)
 
-_CHROME_FILES =	test_bug381167.xhtml \
+MOCHITEST_CHROME_FILES =	test_bug381167.xhtml \
 		test_bug393970.xul \
 		test_bug477754.xul \
 		test_stack.xul \
 		$(NULL)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_TEST_FILES = 	test_resizer_incontent.xul
+MOCHITEST_FILES = 	test_resizer_incontent.xul
 
-_CHROME_FILES +=	test_resizer.xul \
+MOCHITEST_CHROME_FILES +=	test_resizer.xul \
 		window_resizer.xul \
 		window_resizer_element.xul \
 		$(NULL)
 endif
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/layout/xul/test/Makefile.in
+++ b/layout/xul/test/Makefile.in
@@ -5,39 +5,32 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = layout/xul/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =\
+MOCHITEST_FILES =\
 		test_bug386386.html \
 		test_bug394800.xhtml \
 		test_bug563416.html \
 		$(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug159346.xul \
 		test_bug372685.xul \
 		test_bug398982-1.xul \
 		test_bug398982-2.xul \
 		test_bug703150.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		browser_bug703210.js \
 		browser_bug706743.js \
 		$(NULL)
+endif
 
-libs::	$(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-endif
+include $(topsrcdir)/config/rules.mk
--- a/mobile/xul/chrome/tests/Makefile.in
+++ b/mobile/xul/chrome/tests/Makefile.in
@@ -6,19 +6,18 @@ DEPTH     = ../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = mobile/chrome/tests
 TESTXPI  = $(CURDIR)/$(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/addons
 ADDONSRC = $(srcdir)/addons
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
   head.js \
   remote_autocomplete.js \
   remote_contentpopup.js \
   remote_head.js \
   remote_focus.js \
   remote_forms.js \
   remote_formsZoom.js \
   remote_vkb.js \
@@ -72,34 +71,33 @@ include $(topsrcdir)/config/rules.mk
   browser_localerepository.js \
   browser_localerepository_pref.js \
   browser_localerepository_buildid.js \
   locales_list.sjs \
   mock_autocomplete.json\
   $(NULL)
 
 ifneq ($(OS_TARGET),Android)
-_BROWSER_FILES += \
+MOCHITEST_BROWSER_FILES += \
   browser_autocomplete.html \
   browser_autocomplete.js \
   browser_bookmarks_star.js \
   browser_bookmarks_tags.js \
   browser_click_content.html \
   browser_click_content.js \
   browser_contentpopup.html \
   browser_contentpopup.js \
   browser_navigation.js \
   $(NULL)
 ifndef MOZ_PLATFORM_MAEMO
-_BROWSER_FILES +=  browser_sidebars.js
+MOCHITEST_BROWSER_FILES +=  browser_sidebars.js
 endif
 endif
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
 libs::
 	rm -rf $(TESTXPI)
 	$(NSINSTALL) -D $(TESTXPI)
 	if [ -d $(ADDONSRC) ]; then \
 		$(EXIT_ON_ERROR) \
 		for dir in $(ADDONSRC)/*; do \
 			base=`basename $$dir` ; \
--- a/modules/libjar/test/chrome/Makefile.in
+++ b/modules/libjar/test/chrome/Makefile.in
@@ -5,21 +5,19 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = modules/libjar/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug386153.html    \
 		signed.zip             \
 		unsigned.zip           \
 		signed-badca.zip       \
 		signed-tampered.zip    \
 		signed-added.zip       \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/modules/libjar/test/mochitest/Makefile.in
+++ b/modules/libjar/test/mochitest/Makefile.in
@@ -5,19 +5,17 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = modules/libjar/test/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_bug403331.html    \
 		bug403331.zip          \
 		bug403331.zip^headers^ \
 		openredirect.sjs       \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/netwerk/test/browser/Makefile.in
+++ b/netwerk/test/browser/Makefile.in
@@ -4,16 +4,14 @@
 
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = netwerk/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	                  browser_NetUtil.js \
 	                  $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/parser/htmlparser/tests/mochitest/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/Makefile.in
@@ -11,19 +11,18 @@ relativesrcdir  = parser/htmlparser/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 		dir_bug534293 \
 		html5lib_tree_construction \
 		$(NULL)
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	parser_datreader.js \
+MOCHITEST_FILES =	parser_datreader.js \
 		parser_web_testrunner.js \
 		html5_tree_construction_exceptions.js \
 		test_html5_tree_construction.html \
 		test_html5_tree_construction_part2.html \
 		test_bug102699.html \
 		file_bug102699.sjs \
 		test_bug174351.html \
 	 	test_bug339350.xhtml \
@@ -76,25 +75,24 @@ include $(topsrcdir)/config/rules.mk
 		test_bug715739.html \
 		test_bug717180.html \
 		file_bug717180.html \
 		$(NULL)
 
 # Test disabled on mobile. See bug 737020.
 ifneq ($(OS_TARGET),Android)
 ifndef MOZ_PLATFORM_MAEMO
-		_TEST_FILES += test_bug709083.html
+		MOCHITEST_FILES += test_bug709083.html
 endif
 endif
 
 # Disabled test due to orange on Linux
 #		test_bug568470.html \
 #		file_bug568470.sjs \
 #		file_bug568470-script.sjs \
 
 # Disable test due to frequent orange on Mac
 #		test_bug534293.html \
 
 # Disabled due to frequent orange (bug 739354)
 #		test_bug672453.html \
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/parser/htmlparser/tests/mochitest/dir_bug534293/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/dir_bug534293/Makefile.in
@@ -5,15 +5,13 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = parser/htmlparser/tests/mochitest/dir_bug534293
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	file_bug534293.sjs \
+MOCHITEST_FILES =	file_bug534293.sjs \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/Makefile.in
@@ -10,19 +10,18 @@ VPATH		= @srcdir@
 relativesrcdir  = parser/htmlparser/tests/mochitest/html5lib_tree_construction
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
 		scripted \
 		$(NULL)
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	adoption01.dat \
+MOCHITEST_FILES =	adoption01.dat \
 		adoption02.dat \
 		comments01.dat \
 		doctype01.dat \
 		entities01.dat \
 		entities02.dat \
 		html5test-com.dat \
 		inbody01.dat \
 		isindex.dat \
@@ -57,10 +56,9 @@ include $(topsrcdir)/config/rules.mk
 		tests8.dat \
 		tests9.dat \
 		tests_innerHTML_1.dat \
 		tricky01.dat \
 		webkit01.dat \
 		webkit02.dat \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/parser/htmlparser/tests/mochitest/html5lib_tree_construction/scripted/Makefile.in
+++ b/parser/htmlparser/tests/mochitest/html5lib_tree_construction/scripted/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = parser/htmlparser/tests/mochitest/html5lib_tree_construction/scripted
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	adoption01.dat \
+MOCHITEST_FILES =	adoption01.dat \
 		webkit01.dat \
 		ark.dat \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/security/manager/ssl/tests/mochitest/bugs/Makefile.in
+++ b/security/manager/ssl/tests/mochitest/bugs/Makefile.in
@@ -5,26 +5,22 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= security/ssl/bugs
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
         test_bug480509.html \
         test_bug483440.html \
         test_bug484111.html \
         $(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
         test_bug413909.html \
         test_bug480619.html \
         test_bug644006.html \
         $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/security/manager/ssl/tests/mochitest/mixedcontent/Makefile.in
+++ b/security/manager/ssl/tests/mochitest/mixedcontent/Makefile.in
@@ -5,19 +5,18 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= security/ssl/mixedcontent
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
         alloworigin.sjs \
         backward.html \
         bug329869.js \
         bug383369step2.html \
         bug383369step3.html \
         download.auto \
         download.auto^headers^ \
         emptyimage.sjs \
@@ -67,11 +66,9 @@ include $(topsrcdir)/config/rules.mk
         test_unsecureRedirect.html \
         unsecureIframe.html \
         unsecurePictureDup.html \
         $(NULL)
 
 #        test_dynUnsecureRedirect.html \ intermitently fails, quit often, bug 487402
 #        test_unsecureIframeMetaRedirect.html \ also intermittently fails, less often, bug 487632
 
-
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/security/manager/ssl/tests/mochitest/stricttransportsecurity/Makefile.in
+++ b/security/manager/ssl/tests/mochitest/stricttransportsecurity/Makefile.in
@@ -4,24 +4,22 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= security/ssl/stricttransportsecurity
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 	plain_bootstrap.html \
 	plain_bootstrap.html^headers^ \
 	subdom_bootstrap.html \
 	subdom_bootstrap.html^headers^ \
 	nosts_bootstrap.html \
 	nosts_bootstrap.html^headers^ \
 	verify.sjs \
 	test_stricttransportsecurity.html \
 	test_sts_privatebrowsing.html \
 	$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/services/aitc/tests/Makefile.in
+++ b/services/aitc/tests/Makefile.in
@@ -8,18 +8,16 @@ srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir = services/aitc/tests
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_services_aitc
 XPCSHELL_TESTS = unit
 
-include $(topsrcdir)/config/rules.mk
 
-_browser_files = \
+MOCHITEST_BROWSER_FILES = \
   mochitest/head.js \
   mochitest/browser_id_simple.js \
   mochitest/file_browser_id_mock.html \
   $(NULL)
 
-libs:: $(_browser_files)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/testing/mochitest/tests/browser/Makefile.in
+++ b/testing/mochitest/tests/browser/Makefile.in
@@ -4,19 +4,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = testing/mochitest/tests/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	                  head.js \
 	                  browser_head.js \
 	                  browser_pass.js \
 	                  browser_async.js \
 	                  browser_privileges.js \
 	                  browser_popupNode.js \
 	                  browser_popupNode_check.js \
 			  browser_sanityException.js \
@@ -28,10 +27,9 @@ include $(topsrcdir)/config/rules.mk
 #	                  browser_fail_async_throw.js \
 #	                  browser_fail_fp.js \
 #	                  browser_fail_pf.js \
 #	                  browser_fail_throw.js \
 #	                  browser_fail_timeout.js \
 # Disabled because it would take too long, useful to check functionality though.
 #	                  browser_requestLongerTimeout.js \
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/aboutmemory/tests/Makefile.in
+++ b/toolkit/components/aboutmemory/tests/Makefile.in
@@ -5,21 +5,19 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/aboutmemory/tests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_aboutcompartments.xul \
 		test_aboutmemory.xul \
 		test_aboutmemory2.xul \
 		test_memoryReporters.xul \
 		test_sqliteMultiReporter.xul \
 		$(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
--- a/toolkit/components/alerts/test/Makefile.in
+++ b/toolkit/components/alerts/test/Makefile.in
@@ -9,18 +9,14 @@ srcdir    = @srcdir@
 VPATH   = @srcdir@
 relativesrcdir  = toolkit/components/alerts/test
 
 include $(DEPTH)/config/autoconf.mk
 
 # Mochitest tests
 # Synchronous tests like test_alerts.html must come before
 # asynchronous tests like test_alerts_noobserve.html!
-MOCHI_TESTS = \
+MOCHITEST_FILES = \
 		test_alerts.html \
 		test_alerts_noobserve.html \
 		$(NULL)
 
-
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(MOCHI_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/toolkit/components/ctypes/tests/Makefile.in
+++ b/toolkit/components/ctypes/tests/Makefile.in
@@ -24,17 +24,18 @@ CPPSRCS = jsctypes-test.cpp \
 LOCAL_INCLUDES = \
     -I$(topsrcdir)/js/src/ctypes \
     $(NULL)
 
 EXTRA_DSO_LDOPTS += $(MOZALLOC_LIB)
 
 XPCSHELL_TESTS = unit
 
-_CHROME_TEST_FILES = \
+# should be MOCHITEST_CHROME_FILES, see bug 770938
+MOCHITEST_CHROME_TESTS = \
   xpcshellTestHarnessAdaptor.js \
   ctypes_worker.js \
   test_ctypes.xul \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
 xpctestdir = $(testxpcobjdir)/$(relativesrcdir)/unit
@@ -49,17 +50,17 @@ libs:: unit/test_jsctypes.js.in
 	$(PYTHON) $(MOZILLA_DIR)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) \
 	  $^ > $(xpctestdir)/test_jsctypes.js
 	$(INSTALL) $(SHARED_LIBRARY) $(xpctestdir)
 	$(INSTALL) $(SHARED_LIBRARY) $(DEPTH)/_tests/testing/mochitest/chrome/libraries
 	$(INSTALL) $(xpctestdir)/test_jsctypes.js $(chrometestdir)
 	$(INSTALL) $(xpctestdir)/$(SHARED_LIBRARY) $(chrometestdir)
 	$(RM) $(xpctestdir)/test_jsctypes.js.in
 
-libs:: $(_CHROME_TEST_FILES)
+libs:: $(MOCHITEST_CHROME_TESTS)
 	$(INSTALL) $(foreach f,$^,"$f") $(chrometestdir)
 
 GARBAGE += \
     $(xpctestdir)/test_jsctypes.js \
     $(xpctestdir)/$(SHARED_LIBRARY) \
     $(chrometestdir)/test_jsctypes.js \
     $(chrometestdir)/$(SHARED_LIBRARY) \
     $(NULL)
--- a/toolkit/components/downloads/test/browser/Makefile.in
+++ b/toolkit/components/downloads/test/browser/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = toolkit/components/downloads/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_nsIDownloadManagerUI.js \
   $(NULL)
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/feeds/test/Makefile.in
+++ b/toolkit/components/feeds/test/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/feeds/test
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_bug675492.xul    \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/osfile/tests/mochi/Makefile.in
+++ b/toolkit/components/osfile/tests/mochi/Makefile.in
@@ -1,19 +1,18 @@
 DEPTH           = ../../../../..
 topsrcdir       = @top_srcdir@
 srcdir          = @srcdir@
 VPATH           = @srcdir@
 relativesrcdir  = toolkit/components/osfile/tests/mochi
 
 MODULE          = osfile
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
         test_osfile_back.xul \
         worker_test_osfile_unix.js \
         worker_test_osfile_win.js \
         test_osfile_front.xul \
         worker_test_osfile_front.js \
          $(NULL)
 
  include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/passwordmgr/test/Makefile.in
+++ b/toolkit/components/passwordmgr/test/Makefile.in
@@ -17,17 +17,17 @@ DIRS = \
     $(NULL)
 endif
 
 # Module name for xpcshell tests.
 MODULE = test_passwordmgr
 XPCSHELL_TESTS = unit
 
 # Mochitest tests
-MOCHI_TESTS = \
+MOCHITEST_FILES = \
     test_basic_form.html \
     test_basic_form_html5.html \
     test_basic_form_2.html \
     test_basic_form_0pw.html \
     test_basic_form_1pw.html \
     test_basic_form_1pw_2.html \
     test_basic_form_2pw_1.html \
     test_basic_form_2pw_2.html \
@@ -51,19 +51,16 @@ MOCHI_TESTS = \
     test_maxforms_2.html \
     test_maxforms_3.html \
     test_notifications.html \
     test_privbrowsing.html \
     test_prompt_async.html \
     test_xhr.html \
     test_xml_load.html \
     test_zzz_finish.html \
-    $(NULL)
-
-MOCHI_CONTENT = \
     pwmgr_common.js \
     prompt_common.js \
     notification_common.js \
     authenticate.sjs \
     formsubmit.sjs \
     subtst_privbrowsing_1.html \
     subtst_privbrowsing_2.html \
     subtst_privbrowsing_3.html \
@@ -78,21 +75,18 @@ MOCHI_CONTENT = \
     subtst_notifications_7.html \
     subtst_notifications_8.html \
     subtst_notifications_9.html \
     subtst_notifications_10.html \
     subtst_prompt_async.html \
     $(NULL)
 
 ifneq ($(OS_TARGET),Linux)
-MOCHI_TESTS += \
+MOCHITEST_FILES += \
     test_prompt.html \
     $(NULL)
 endif
 
 # This test doesn't pass because we can't ensure a cross-platform
 # event that occurs between DOMContentLoaded and Pageload
 # test_bug_221634.html
 
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/toolkit/components/passwordmgr/test/browser/Makefile.in
+++ b/toolkit/components/passwordmgr/test/browser/Makefile.in
@@ -5,18 +5,16 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/passwordmgr/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_passwordmgrdlg.js \
   browser_passwordmgr_sort.js \
   browser_passwordmgrcopypwd.js \
   $(NULL)
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/perf/Makefile.in
+++ b/toolkit/components/perf/Makefile.in
@@ -22,22 +22,14 @@ LIBXUL_LIBRARY = 1
 EXPORT_LIBRARY = 1
 IS_COMPONENT = 1
 
 CPPSRCS = \
     PerfMeasurement.cpp \
     $(NULL)
 
 ifdef ENABLE_TESTS
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
     test_pm.xul \
     $(NULL)
-
-chrometestdir = \
-  $(DEPTH)/_tests/testing/mochitest/chrome/toolkit/components/$(MODULE)
 endif
 
 include $(topsrcdir)/config/rules.mk
-
-ifdef ENABLE_TESTS
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(chrometestdir)
-endif
--- a/toolkit/components/places/tests/Makefile.in
+++ b/toolkit/components/places/tests/Makefile.in
@@ -26,17 +26,17 @@ XPCSHELL_TESTS = \
   $(NULL)
 
 # Files in the main "tests" folder.
 XPCSHELL_TESTS_COMMON = \
   head_common.js \
   $(NULL)
 
 # Simple MochiTests
-MOCHI_TESTS = \
+MOCHITEST_FILES = \
 	mochitest/test_bug_411966.html \
 	mochitest/test_bug_461710.html \
 	$(NULL)
 
 DIRS = \
 	chrome \
 	mochitest/bug_411966 \
 	mochitest/bug_461710 \
@@ -47,13 +47,10 @@ ifneq (mobile,$(MOZ_BUILD_APP))
 endif
 
 TOOL_DIRS = \
   cpp \
   $(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
-libs:: $(MOCHI_TESTS)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
 libs:: $(XPCSHELL_TESTS_COMMON)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/xpcshell/$(relativesrcdir)
--- a/toolkit/components/places/tests/browser/Makefile.in
+++ b/toolkit/components/places/tests/browser/Makefile.in
@@ -5,47 +5,42 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/places/tests/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	head.js \
 	browser_bug399606.js \
 	browser_bug646422.js \
 	browser_bug680727.js \
 	browser_notfound.js \
 	browser_redirect.js \
 	browser_visituri.js \
 	browser_visituri_nohistory.js \
 	browser_visituri_privatebrowsing.js \
 	browser_settitle.js \
 	$(NULL)
 
 # These are files that need to be loaded via the HTTP proxy server
 # Access them through http://example.com/
-_HTTP_FILES = \
+MOCHITEST_FILES = \
 	bug_399606/399606-httprefresh.html \
 	bug_399606/399606-location.reload.html \
 	bug_399606/399606-location.replace.html \
 	bug_399606/399606-window.location.href.html \
 	bug_399606/399606-window.location.html \
 	bug_399606/399606-history.go-0.html \
 	redirect.sjs \
 	redirect-target.html \
 	settitle/title1.html \
 	settitle/title2.html \
 	visituri/begin.html \
 	visituri/redirect_twice.sjs \
 	visituri/redirect_once.sjs \
 	visituri/final.html \
 	$(NULL)
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/places/tests/chrome/Makefile.in
+++ b/toolkit/components/places/tests/chrome/Makefile.in
@@ -5,37 +5,32 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/places/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_HTTP_FILES	= \
+MOCHITEST_FILES	= \
 		sample_feed.atom \
 		bad_links.atom \
 		rss_as_html.rss \
 		rss_as_html.rss^headers^ \
 		link-less-items.rss \
 		link-less-items-no-site-uri.rss \
 		$(NULL)
 
-_CHROME_FILES	= \
+MOCHITEST_CHROME_FILES	= \
 		test_371798.xul \
 		test_342484.xul \
 		test_341972a.xul \
 		test_341972b.xul \
 		test_favicon_annotations.xul \
 		test_303567.xul \
 		test_381357.xul \
 		test_history_post.xul \
 		history_post.sjs \
 		test_reloadLivemarks.xul \
 		$(NULL)
 
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/places/tests/mochitest/bug_411966/Makefile.in
+++ b/toolkit/components/places/tests/mochitest/bug_411966/Makefile.in
@@ -5,22 +5,20 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = toolkit/components/places/tests/bug_411966
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_HTTP_FILES	= \
+MOCHITEST_FILES	= \
 		redirect.js \
 		TypedPage.htm \
 		ClickedPage.htm \
 		ClickedPage.htm^headers^ \
 		TempRedirectPage.htm \
 		TempRedirectPage.htm^headers^ \
 		PermRedirectPage.htm \
 		$(NULL)
 
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/places/tests/mochitest/bug_461710/Makefile.in
+++ b/toolkit/components/places/tests/mochitest/bug_461710/Makefile.in
@@ -5,19 +5,17 @@
 
 DEPTH		= ../../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = toolkit/components/places/tests/bug_461710
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_HTTP_FILES	= \
+MOCHITEST_FILES	= \
 		visited_page.html \
 		link_page.html \
 		link_page-2.html \
 		link_page-3.html \
 		$(NULL)
 
-libs:: $(_HTTP_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/prompts/test/Makefile.in
+++ b/toolkit/components/prompts/test/Makefile.in
@@ -10,26 +10,20 @@ VPATH          = @srcdir@
 relativesrcdir = toolkit/components/prompts/test
 
 include $(DEPTH)/config/autoconf.mk
 
 # Module name for xpcshell tests.
 MODULE = test_prompter
 
 # Mochitest tests
-MOCHI_TESTS = \
+MOCHITEST_FILES = \
     test_modal_select.html \
     test_modal_prompts.html \
     test_bug619644.html \
     test_bug620145.html \
     test_bug625187.html \
-    $(NULL)
-
-MOCHI_CONTENT = \
     prompt_common.js \
     bug619644_inner.html \
     bug625187_iframe.html \
     $(NULL)
 
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/toolkit/components/satchel/test/Makefile.in
+++ b/toolkit/components/satchel/test/Makefile.in
@@ -12,29 +12,23 @@ relativesrcdir  = toolkit/components/sat
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = test_satchel
 
 XPCSHELL_TESTS = \
   unit \
   $(NULL)
 
-MOCHI_TESTS = \
+MOCHITEST_FILES = \
 		test_bug_511615.html \
 		test_form_autocomplete.html \
 		test_form_autocomplete_with_list.html \
 		test_form_submission.html \
 		test_form_submission_cap.html \
 		test_form_submission_cap2.html \
 		test_privbrowsing.html \
-		$(NULL)
-
-MOCHI_CONTENT = \
 		satchel_common.js \
 		subtst_form_submission_1.html \
 		subtst_privbrowsing.html \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
 
-libs:: $(MOCHI_TESTS) $(MOCHI_CONTENT)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-
--- a/toolkit/components/social/test/browser/Makefile.in
+++ b/toolkit/components/social/test/browser/Makefile.in
@@ -7,21 +7,19 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/social/test/browser
 
 MODULE = test_socialapi
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
 		head.js \
 		data.json \
 		worker_xhr.js \
 		browser_frameworker.js \
 		worker_relative.js \
 		relative_import.js \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/startup/tests/browser/Makefile.in
+++ b/toolkit/components/startup/tests/browser/Makefile.in
@@ -4,19 +4,17 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/startup/tests/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
 	browser_bug511456.js \
 	browser_bug537449.js \
 	browser_crash_detection.js \
 	beforeunload.html \
 	$(NULL)
 
-libs:: $(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/url-classifier/tests/mochitest/Makefile.in
+++ b/toolkit/components/url-classifier/tests/mochitest/Makefile.in
@@ -7,24 +7,22 @@ DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/components/url-classifier/tests/mochitest
 
 MODULE = test_url-classifier
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
 		test_classifier.html \
 		test_classifier_worker.html \
 		classifierFrame.html \
 		workerFrame.html \
 		cleanWorker.js \
 		evil.js \
 		evilWorker.js \
 		evil.css \
 		import.css \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/viewsource/test/Makefile.in
+++ b/toolkit/components/viewsource/test/Makefile.in
@@ -9,16 +9,14 @@ topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = toolkit/components/viewsource/test
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = browser
 
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES   = \
+MOCHITEST_CHROME_FILES   = \
                 test_428653.xul \
                 $(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/components/viewsource/test/browser/Makefile.in
+++ b/toolkit/components/viewsource/test/browser/Makefile.in
@@ -4,22 +4,20 @@
 
 DEPTH     = ../../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir  = toolkit/components/viewsource/test/browser
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_CHROME_FILES   = \
+MOCHITEST_BROWSER_FILES   = \
                 browser_bug699356.js \
                 browser_bug713810.js \
                 browser_contextmenu.js \
                 browser_gotoline.js \
                 browser_viewsourceprefs.js \
                 browser_viewsourceprefs_nonhtml.js \
                 head.js \
                 $(NULL)
 
-libs:: $(_BROWSER_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/browser/Makefile.in
+++ b/toolkit/content/tests/browser/Makefile.in
@@ -11,23 +11,21 @@ relativesrcdir = toolkit/content/tests/b
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = \
   common \
   data \
   $(NULL)
 
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser_keyevents_during_autoscrolling.js \
   browser_bug295977_autoscroll_overflow.js \
   browser_bug594509.js \
   browser_Geometry.js \
   browser_InlineSpellChecker.js \
   browser_save_resend_postdata.js \
   browser_browserDrop.js \
   browser_Services.js \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/browser/common/Makefile.in
+++ b/toolkit/content/tests/browser/common/Makefile.in
@@ -5,16 +5,14 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = toolkit/content/tests/browser/common
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_COMMON_FILES = \
+MOCHITEST_BROWSER_FILES = \
   mockTransfer.js \
   $(NULL)
 
-libs:: $(_COMMON_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/browser/data/Makefile.in
+++ b/toolkit/content/tests/browser/data/Makefile.in
@@ -5,17 +5,15 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = toolkit/content/tests/browser/data
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_DATA_FILES = \
+MOCHITEST_BROWSER_FILES = \
   post_form_inner.sjs \
   post_form_outer.sjs \
   $(NULL)
 
-libs:: $(_DATA_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/chrome/Makefile.in
+++ b/toolkit/content/tests/chrome/Makefile.in
@@ -8,19 +8,18 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/content/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
 
 DIRS = rtltest rtlchrome
 
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	findbar_window.xul \
+MOCHITEST_CHROME_FILES = 	findbar_window.xul \
 		test_findbar.xul \
 		test_bug253481.xul \
 		bug263683_window.xul \
 		test_bug263683.xul \
 		bug304188_window.xul \
 		test_bug304188.xul \
 		bug331215_window.xul \
 		test_bug331215.xul \
@@ -154,24 +153,23 @@ include $(topsrcdir)/config/rules.mk
 		test_mousescroll.xul \
 		test_mousecapture.xul \
 		test_arrowpanel.xul \
 		$(NULL)
 
 # test_panel_focus.xul won't work if the Full Keyboard Access preference is set to
 # textboxes and lists only, so skip this test on Mac
 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-_TEST_FILES += test_panel_focus.xul \
+MOCHITEST_CHROME_FILES += test_panel_focus.xul \
                window_panel_focus.xul \
                test_chromemargin.xul \
                window_chromemargin.xul
 else
-_TEST_FILES += test_autocomplete_mac_caret.xul
+MOCHITEST_CHROME_FILES += test_autocomplete_mac_caret.xul
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-_TEST_FILES += 	$(warning test_cursorsnap.xul temporarily disabled) \
+MOCHITEST_CHROME_FILES += 	$(warning test_cursorsnap.xul temporarily disabled) \
 		window_cursorsnap_dialog.xul \
 		window_cursorsnap_wizard.xul
 endif
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/content/tests/widgets/Makefile.in
+++ b/toolkit/content/tests/widgets/Makefile.in
@@ -5,24 +5,23 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/content/tests/widgets
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 _CHROME_FILES = \
 		popup_shared.js \
 		tree_shared.js \
 		$(NULL)
 
-_TEST_FILES =	\
+MOCHITEST_FILES =	\
 		test_contextmenu_nested.xul \
 		test_tree_column_reorder.xul \
 		tree_shared.js \
 		test_mousecapture_area.html \
 		popup_shared.js \
 		test_videocontrols.html \
 		test_videocontrols_video_direction.html \
 		test_videocontrols_audio_direction.html \
@@ -41,31 +40,27 @@ include $(topsrcdir)/config/rules.mk
 		videocontrols_direction-2e.html \
 		videocontrols_direction_test.js \
 		use_large_cache.js \
 		$(topsrcdir)/content/media/test/audio.wav \
 		$(topsrcdir)/content/media/test/seek_with_sound.ogg \
 		videomask.css \
 		$(NULL)
 
-_CHROME_TEST_FILES = \
+MOCHITEST_CHROME_FILES = \
 		test_editor_currentURI.xul \
 		$(NULL)
 
 ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
-_TEST_FILES += test_menubar_gtk.xul \
+MOCHITEST_FILES += test_menubar_gtk.xul \
                window_menubar_gtk.xul
 else
 ifneq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-_TEST_FILES += test_menubar.xul \
+MOCHITEST_FILES += test_menubar.xul \
                window_menubar.xul
 endif
 endif
 
 libs:: $(_CHROME_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)/../chrome
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
 
-libs:: $(_CHROME_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
--- a/toolkit/crashreporter/test/Makefile.in
+++ b/toolkit/crashreporter/test/Makefile.in
@@ -43,24 +43,24 @@ EXTRA_DSO_LDOPTS += $(LIBS_DIR) $(MOZ_CO
 
 EXTRA_JS_MODULES = CrashTestUtils.jsm
 
 include $(topsrcdir)/config/rules.mk
 
 DEFINES += -DSHARED_LIBRARY=$(SHARED_LIBRARY) -DNOMINMAX
 
 ifneq (mobile,$(MOZ_BUILD_APP))
-_BROWSER_FILES = \
+MOCHITEST_BROWSER_FILES = \
   browser/head.js \
   browser/crashreport.sjs \
   browser/browser_aboutCrashes.js \
   browser/browser_bug471404.js \
   browser/browser_aboutCrashesResubmit.js \
   $(NULL)
 
-libs::  $(_BROWSER_FILES)
+libs::  $(MOCHITEST_BROWSER_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/browser
 endif
 
 libs:: $(SHARED_LIBRARY) $(EXTRA_JS_MODULES)
 	$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit/
 	$(INSTALL) $^ $(DEPTH)/_tests/xpcshell/$(relativesrcdir)/unit_ipc/
 
--- a/toolkit/identity/tests/chrome/Makefile.in
+++ b/toolkit/identity/tests/chrome/Makefile.in
@@ -4,24 +4,22 @@
 
 DEPTH          = ../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = toolkit/identity/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
 		sandbox_content.html \
 		sandbox_content_alert.html \
 		sandbox_content_framed.html \
 		sandbox_content_perms.html \
 		sandbox_content_popup.html \
 		sandbox_content_redirect.html \
 		sandbox_content_redirect.html^headers^ \
 		sandbox_content.sjs \
 		test_sandbox.xul \
 		$(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/downloads/tests/chrome/Makefile.in
+++ b/toolkit/mozapps/downloads/tests/chrome/Makefile.in
@@ -5,22 +5,21 @@
 
 DEPTH          = ../../../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = toolkit/mozapps/downloads/tests/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
 # temporarily disabled test (bug 483200)
 #  test_retention_is_0_closes.xul \
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
   test_basic_functionality.xul \
   test_cleanup_search.xul \
   test_clear_button_disabled.xul \
   test_close_download_manager.xul \
   test_delete_key_removes.xul \
   test_destinationURI_annotation.xul \
   test_esc_key_closes_clears.xul \
   test_multi_select.xul \
@@ -40,22 +39,21 @@ include $(topsrcdir)/config/rules.mk
   test_close_on_last_window.xul \
   unknownContentType_dialog_layout_data.txt \
   unknownContentType_dialog_layout_data.txt^headers^ \
   unknownContentType_dialog_layout_data.pif \
   unknownContentType_dialog_layout_data.pif^headers^ \
   utils.js \
   $(NULL)
 ifneq (,$(filter cocoa, $(MOZ_WIDGET_TOOLKIT)))
-_CHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
   test_backspace_key_removes.xul \
   $(NULL)
 endif
 
 ifeq ($(OS_ARCH),WINNT)
-_CHROME_FILES += \
+MOCHITEST_CHROME_FILES += \
   test_taskbarprogress_downloadstates.xul \
   test_taskbarprogress_service.xul \
   $(NULL)
 endif
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/extensions/test/browser/Makefile.in
+++ b/toolkit/mozapps/extensions/test/browser/Makefile.in
@@ -7,17 +7,17 @@ topsrcdir = @top_srcdir@
 srcdir = @srcdir@
 VPATH = @srcdir@
 relativesrcdir  = toolkit/mozapps/extensions/test/browser
 ADDONSRC = $(srcdir)/addons
 TESTXPI = $(CURDIR)/$(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)/addons
 
 include $(DEPTH)/config/autoconf.mk
 
-_MAIN_TEST_FILES = \
+MOCHITEST_BROWSER_MAIN = \
   head.js \
   browser_about.js \
   browser_bug523784.js \
   browser_bug557943.js \
   browser_bug562797.js \
   browser_bug562854.js \
   browser_bug562890.js \
   browser_bug562899.js \
@@ -56,33 +56,33 @@ include $(DEPTH)/config/autoconf.mk
   browser_updateid.js \
   browser_purchase.js \
   browser_openDialog.js \
   browser_types.js \
   browser_inlinesettings.js \
   browser_tabsettings.js \
   $(NULL)
 
-_TEST_FILES = \
+MOCHITEST_BROWSER_SECONDARY = \
   head.js \
   browser_addonrepository_performance.js \
   browser_bug557956.js \
   browser_bug616841.js \
   browser_checkAddonCompatibility.js \
   browser_hotfix.js \
   browser_installssl.js \
   browser_newaddon.js \
   browser_select_compatoverrides.js \
   browser_select_confirm.js \
   browser_select_selection.js \
   browser_select_update.js \
   browser_updatessl.js \
   $(NULL)
 
-_TEST_RESOURCES = \
+MOCHITEST_BROWSER_RESOURCES = \
   addon_about.xul \
   addon_prefs.xul \
   browser_bug557956.rdf \
   browser_bug557956_8_2.xpi \
   browser_bug557956_9_2.xpi \
   browser_bug557956.xml \
   browser_bug591465.xml \
   browser_bug593535.xml \
@@ -103,28 +103,23 @@ include $(DEPTH)/config/autoconf.mk
   unsigned_hotfix.rdf \
   unsigned_hotfix.xpi \
   more_options.xul \
   options.xul \
   redirect.sjs \
   releaseNotes.xhtml \
   $(NULL)
 
+MOCHITEST_BROWSER_FILES_PARTS = $(foreach s,MAIN SECONDARY RESOURCES,MOCHITEST_BROWSER_$(s))
+
 include $(topsrcdir)/config/rules.mk
 
-libs:: $(_MAIN_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+libs:: $(MOCHITEST_BROWSER_MAIN)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)-window
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
-libs:: $(_TEST_RESOURCES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
-
 libs::
 	rm -rf $(TESTXPI)
 	$(NSINSTALL) -D $(TESTXPI)
 	if [ -d $(ADDONSRC) ]; then \
 		$(EXIT_ON_ERROR) \
 		for dir in $(ADDONSRC)/*; do \
 			base=`basename $$dir` ; \
 			(cd $$dir && zip $(TESTXPI)/$$base.xpi *) \
--- a/toolkit/mozapps/extensions/test/mochitest/Makefile.in
+++ b/toolkit/mozapps/extensions/test/mochitest/Makefile.in
@@ -5,15 +5,13 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/mozapps/extensions/test/mochitest
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	test_bug609794.html \
+MOCHITEST_FILES =	test_bug609794.html \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/extensions/test/xpinstall/Makefile.in
+++ b/toolkit/mozapps/extensions/test/xpinstall/Makefile.in
@@ -4,22 +4,20 @@
 
 DEPTH		= ../../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/mozapps/extensions/test/xpinstall
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
-
 
 # browser_bug672485.js is disabled due to a leak. See bug 682410.
 
-_BROWSER_FILES = head.js \
+MOCHITEST_BROWSER_FILES = head.js \
                  browser_unsigned_url.js \
                  browser_unsigned_trigger.js \
                  browser_unsigned_trigger_iframe.js \
                  browser_whitelist.js \
                  browser_whitelist2.js \
                  browser_whitelist3.js \
                  browser_whitelist4.js \
                  browser_whitelist5.js \
@@ -92,10 +90,9 @@ include $(topsrcdir)/config/rules.mk
                  cookieRedirect.sjs \
                  hashRedirect.sjs \
                  bug540558.html \
                  bug638292.html \
                  bug645699.html \
                  redirect.sjs \
                  $(NULL)
 
-libs::	$(_BROWSER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/mozapps/shared/test/chrome/Makefile.in
+++ b/toolkit/mozapps/shared/test/chrome/Makefile.in
@@ -5,16 +5,14 @@
 DEPTH     = ../../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir = toolkit/mozapps/shared/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES = \
   test_bug544442_checkCert.xul \
   $(NULL)
 
+
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
--- a/toolkit/mozapps/update/test/chrome/Makefile.in
+++ b/toolkit/mozapps/update/test/chrome/Makefile.in
@@ -5,21 +5,21 @@
 DEPTH     = ../../../../..
 topsrcdir = @top_srcdir@
 srcdir    = @srcdir@
 VPATH     = @srcdir@
 relativesrcdir = toolkit/mozapps/update/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
 
-_OTHER_FILES = \
+MOCHITEST_CHROME_FILES = \
   ../unit/data/simple_no_pib.mar \
   $(NULL)
 
-_CHROME_FILES = \
+MOCHITEST_CHROME_FILES += \
   test_0011_check_basic.xul \
   test_0012_check_basic_license.xul \
   test_0013_check_incompat_basic.xul \
   test_0015_check_incompat_basic_addons.xul \
   test_0014_check_incompat_basic_license.xul \
   test_0016_check_incompat_basic_license_addons.xul \
   test_0021_check_billboard.xul \
   test_0022_check_billboard_license.xul \
@@ -70,21 +70,16 @@ include $(DEPTH)/config/autoconf.mk
   test_0141_notify_invalidCertAttrs_noUpdate.xul \
   test_0142_notify_invalidCertAttrs_hasUpdate.xul \
   test_0151_notify_backgroundCheckError.xul \
   test_0900_deprecatedUpdateFormat_minor.xul \
   test_0901_deprecatedUpdateFormat_major.xul \
   test_9999_cleanup.xul \
   $(NULL)
 
+
 include $(topsrcdir)/config/rules.mk
 
-libs:: $(_OTHER_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
-
 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
--- a/toolkit/profile/test/Makefile.in
+++ b/toolkit/profile/test/Makefile.in
@@ -6,16 +6,14 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir = toolkit/profile/test
 
 include $(DEPTH)/config/autoconf.mk
 
-_CHROME_FILES   = \
+MOCHITEST_CHROME_FILES   = \
                 test_create_profile.xul \
                 $(NULL)
 
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/themes/pinstripe/mochitests/Makefile.in
+++ b/toolkit/themes/pinstripe/mochitests/Makefile.in
@@ -5,15 +5,13 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = toolkit/themes/pinstripe/mochitests
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = 	test_bug510426.xul \
+MOCHITEST_FILES = 	test_bug510426.xul \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/toolkit/xre/test/Makefile.in
+++ b/toolkit/xre/test/Makefile.in
@@ -15,12 +15,10 @@ MODULE = test_xulapp
 ifeq ($(OS_ARCH),WINNT)
 DIRS += win
 endif
 
 MOCHITEST_FILES = \
   test_fpuhandler.html \
   $(NULL)
 
+
 include $(topsrcdir)/config/rules.mk
-
-libs:: $(MOCHITEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
--- a/uriloader/exthandler/tests/mochitest/Makefile.in
+++ b/uriloader/exthandler/tests/mochitest/Makefile.in
@@ -4,20 +4,18 @@
 
 DEPTH		= ../../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir	= uriloader/exthandler/tests/mochitest 
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES =	\
+MOCHITEST_FILES =	\
 		test_handlerApps.xhtml \
 		test_unsafeBidiChars.xhtml \
 		handlerApps.js \
 		handlerApp.xhtml \
 		unsafeBidiFileName.sjs \
 		$(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/webapprt/test/chrome/Makefile.in
+++ b/webapprt/test/chrome/Makefile.in
@@ -4,20 +4,18 @@
 
 DEPTH          = ../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = webapprt/test/chrome
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_BROWSER_TEST_FILES = \
+MOCHITEST_WEBAPPRT_CHROME_FILES = \
   head.js \
   install.html \
   browser_sample.js \
     sample.webapp \
     sample.html \
   $(NULL)
 
-libs:: $(_BROWSER_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/webapprtChrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/webapprt/test/content/Makefile.in
+++ b/webapprt/test/content/Makefile.in
@@ -4,19 +4,17 @@
 
 DEPTH          = ../../..
 topsrcdir      = @top_srcdir@
 srcdir         = @srcdir@
 VPATH          = @srcdir@
 relativesrcdir = webapprt/test/content
 
 include $(DEPTH)/config/autoconf.mk
-include $(topsrcdir)/config/rules.mk
 
-_TEST_FILES = \
+MOCHITEST_FILES = \
   helpers.js \
   webapprt_sample.html \
     sample.webapp \
     sample.html \
   $(NULL)
 
-libs:: $(_TEST_FILES)
-	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk
--- a/widget/tests/Makefile.in
+++ b/widget/tests/Makefile.in
@@ -25,21 +25,17 @@ endif
 # Test disabled because it requires the internal API.  Re-enabling this test is
 # bug 652123.
 #CPP_UNIT_TESTS += TestChromeMargin.cpp  \
 #                 $(NULL)
 endif
 
 CPP_UNIT_TESTS += TestAppShellSteadyState.cpp
 
-include $(topsrcdir)/config/rules.mk
-
-_TEST_FILES =
-
-_CHROME_FILES =	test_bug343416.xul \
+MOCHITEST_CHROME_FILES =	test_bug343416.xul \
 		test_bug429954.xul \
 		window_bug429954.xul \
 		test_bug444800.xul \
 		test_bug462106.xul \
 		test_bug478536.xul \
 		window_bug478536.xul \
 		test_bug517396.xul \
 		test_bug538242.xul \
@@ -55,21 +51,21 @@ include $(topsrcdir)/config/rules.mk
 		test_plugin_scroll_consistency.html \
 		test_composition_text_querycontent.xul \
 		window_composition_text_querycontent.xul \
 		test_input_events_on_deactive_window.xul \
 		test_position_on_resize.xul \
 		empty_window.xul \
 		test_sizemode_events.xul \
 		$(NULL)
-		
+
 # test_bug413277.html mac-only based on 604789, 605178
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
-_CHROME_FILES += native_menus_window.xul \
+MOCHITEST_CHROME_FILES += native_menus_window.xul \
                test_native_menus.xul \
                native_mouse_mac_window.xul \
                test_native_mouse_mac.xul \
                test_bug413277.html \
                test_bug428405.xul \
                test_bug466599.xul \
                test_bug485118.xul \
                test_bug522217.xul \
@@ -81,37 +77,31 @@ ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa)
                bug586713_window.xul \
                test_key_event_counts.xul \
                test_bug596600.xul \
                test_bug673301.xul \
                $(NULL)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
-_CHROME_FILES  += taskbar_previews.xul \
+MOCHITEST_CHROME_FILES  += taskbar_previews.xul \
 		window_state_windows.xul \
 		taskbar_progress.xul \
 		test_chrome_context_menus_win.xul \
 		test_plugin_input_event.html \
 		chrome_context_menus_win.xul \
 		test_mouse_scroll.xul \
 		window_mouse_scroll_win.html \
 		$(NULL)
 
-_TEST_FILES +=	test_bug565392.html \
+MOCHITEST_FILES =	test_bug565392.html \
 		test_picker_no_crash.html \
 		window_picker_no_crash_child.html \
 		$(NULL)
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
-_TEST_FILES += 	plugin_scroll_invalidation.html \
+MOCHITEST_FILES = 	plugin_scroll_invalidation.html \
 		test_plugin_scroll_invalidation.html \
 		$(NULL)
 endif
 
-ifdef _TEST_FILES
-libs:: $(_TEST_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
-endif
-
-libs:: $(_CHROME_FILES)
-	$(INSTALL) $^ $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+include $(topsrcdir)/config/rules.mk