Bug 1043963 - Collapse test-only moz.build files under dom/ into ancestor moz.build files; r=ted
authorMs2ger <ms2ger@gmail.com>
Sat, 26 Jul 2014 08:17:24 +0200
changeset 210568 416e7822ac496093b5d576a87336e4a9a42cd2cc
parent 210567 a58ffa57fba5ad1750e4d75aa1fc96d310ce6cd4
child 210569 c1354624b6fe89690992b5758cf8dec4d02be0dd
push idunknown
push userunknown
push dateunknown
reviewersted
bugs1043963
milestone34.0a1
Bug 1043963 - Collapse test-only moz.build files under dom/ into ancestor moz.build files; r=ted There is very little benefit to having another layer of moz.build files, and removing them will speed up the build a minimal amount. It also paves the way for removing TEST_DIRS, which could simplify the build system somewhat.
dom/activities/moz.build
dom/activities/tests/moz.build
dom/alarm/moz.build
dom/alarm/test/moz.build
dom/archivereader/moz.build
dom/archivereader/test/moz.build
dom/asmjscache/moz.build
dom/asmjscache/test/moz.build
dom/base/moz.build
dom/base/test/moz.build
dom/battery/moz.build
dom/battery/test/moz.build
dom/camera/moz.build
dom/camera/test/moz.build
dom/cellbroadcast/moz.build
dom/cellbroadcast/tests/moz.build
dom/contacts/moz.build
dom/contacts/tests/moz.build
dom/crypto/moz.build
dom/crypto/test/moz.build
dom/downloads/moz.build
dom/downloads/tests/moz.build
dom/encoding/moz.build
dom/icc/moz.build
dom/icc/tests/moz.build
dom/identity/moz.build
dom/identity/tests/moz.build
dom/indexedDB/moz.build
dom/indexedDB/test/moz.build
dom/indexedDB/test/unit/moz.build
dom/inputmethod/mochitest/moz.build
dom/inputmethod/moz.build
dom/ipc/moz.build
dom/ipc/tests/moz.build
dom/media/moz.build
dom/media/tests/identity/moz.build
dom/media/tests/ipc/moz.build
dom/media/tests/mochitest/moz.build
dom/messages/moz.build
dom/messages/test/moz.build
dom/mobileconnection/moz.build
dom/mobileconnection/tests/moz.build
dom/mobileid/moz.build
dom/mobileid/test/moz.build
dom/mobilemessage/moz.build
dom/mobilemessage/tests/moz.build
dom/network/moz.build
dom/network/tests/moz.build
dom/nfc/moz.build
dom/nfc/tests/moz.build
dom/payment/moz.build
dom/payment/tests/moz.build
dom/permission/moz.build
dom/permission/tests/moz.build
dom/phonenumberutils/moz.build
dom/phonenumberutils/tests/moz.build
dom/power/moz.build
dom/power/test/moz.build
dom/promise/moz.build
dom/promise/tests/moz.build
dom/resourcestats/moz.build
dom/resourcestats/tests/moz.build
dom/settings/moz.build
dom/settings/tests/moz.build
dom/src/json/moz.build
dom/src/json/test/moz.build
dom/src/jsurl/moz.build
dom/src/jsurl/test/moz.build
dom/system/moz.build
dom/system/tests/moz.build
dom/tests/mochitest/ajax/moz.build
dom/tests/mochitest/beacon/moz.build
dom/tests/mochitest/bugs/moz.build
dom/tests/mochitest/dom-level0/moz.build
dom/tests/mochitest/gamepad/Makefile.in
dom/tests/mochitest/gamepad/moz.build
dom/tests/mochitest/general/moz.build
dom/tests/mochitest/geolocation/moz.build
dom/tests/mochitest/localstorage/moz.build
dom/tests/mochitest/moz.build
dom/tests/mochitest/notification/moz.build
dom/tests/mochitest/orientation/moz.build
dom/tests/mochitest/sessionstorage/moz.build
dom/tests/mochitest/storageevent/moz.build
dom/tests/mochitest/webcomponents/moz.build
dom/tests/moz.build
dom/workers/moz.build
dom/workers/test/moz.build
dom/workers/test/serviceworkers/moz.build
dom/xbl/moz.build
dom/xbl/test/moz.build
dom/xslt/moz.build
dom/xslt/tests/buster/moz.build
dom/xslt/tests/mochitest/moz.build
--- a/dom/activities/moz.build
+++ b/dom/activities/moz.build
@@ -1,9 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
 
-TEST_DIRS += ['tests']
+XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
deleted file mode 100644
--- a/dom/activities/tests/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
--- a/dom/alarm/moz.build
+++ b/dom/alarm/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 XPIDL_SOURCES += [
     'nsIAlarmHalService.idl',
 ]
 
 XPIDL_MODULE = 'dom_alarm'
 
 EXPORTS.mozilla.dom.alarm += [
     'AlarmHalService.h',
@@ -30,8 +28,10 @@ EXTRA_JS_MODULES += [
     'AlarmService.jsm',
 ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/alarm/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/archivereader/moz.build
+++ b/dom/archivereader/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS.mozilla.dom.archivereader += [
     'ArchiveEvent.h',
     'ArchiveReader.h',
     'ArchiveReaderCommon.h',
     'ArchiveRequest.h',
     'ArchiveZipEvent.h',
     'ArchiveZipFile.h',
 ]
@@ -25,8 +23,10 @@ UNIFIED_SOURCES += [
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../base',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/archivereader/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/asmjscache/moz.build
+++ b/dom/asmjscache/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS.mozilla.dom.asmjscache += [
     'AsmJSCache.h'
 ]
 
 SOURCES += [
     'AsmJSCache.cpp'
 ]
 
@@ -20,8 +18,10 @@ IPDL_SOURCES += [
 
 FAIL_ON_WARNINGS = True
 
 MSVC_ENABLE_PGO = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/asmjscache/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 XPIDL_SOURCES += [
     'nsIConsoleAPIStorage.idl',
     'nsIDOMDOMCursor.idl',
     'nsIDOMDOMRequest.idl',
     'nsIEntropyCollector.idl',
     'nsIScriptChannel.idl',
     'nsISiteSpecificUserAgent.idl',
     'nsISlowScriptDebug.idl',
@@ -184,8 +182,11 @@ LOCAL_INCLUDES += [
 ]
 
 for var in ('MOZ_B2G_RIL', 'MOZ_B2G_FM'):
     if CONFIG[var]:
         DEFINES[var] = True
 
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     DEFINES['HAVE_SIDEBAR'] = True
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
deleted file mode 100644
--- a/dom/base/test/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
--- a/dom/battery/moz.build
+++ b/dom/battery/moz.build
@@ -1,22 +1,22 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS.mozilla.dom.battery += [
     'Constants.h',
     'Types.h',
 ]
 
 SOURCES += [
     'BatteryManager.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/battery/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/camera/moz.build
+++ b/dom/camera/moz.build
@@ -1,16 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-    TEST_DIRS += ['test']
+    MOCHITEST_MANIFESTS += ['test/mochitest.ini']
 
 EXPORTS += [
     'CameraCommon.h',
     'CameraPreferences.h',
     'DOMCameraManager.h',
 ]
 
 SOURCES += [
deleted file mode 100644
--- a/dom/camera/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/cellbroadcast/moz.build
+++ b/dom/cellbroadcast/moz.build
@@ -1,8 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
-TEST_DIRS += ['tests']
deleted file mode 100644
--- a/dom/cellbroadcast/tests/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
--- a/dom/contacts/moz.build
+++ b/dom/contacts/moz.build
@@ -1,17 +1,18 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 # Disable the tests on Android for now (bug 927869)
 if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
-    TEST_DIRS += ['tests']
+    MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
+    MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
 
 EXTRA_COMPONENTS += [
     'ContactManager.js',
     'ContactManager.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'fallback/ContactDB.jsm',
deleted file mode 100644
--- a/dom/contacts/tests/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
--- a/dom/crypto/moz.build
+++ b/dom/crypto/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS.mozilla.dom += [
     'AesKeyAlgorithm.h',
     'BasicSymmetricKeyAlgorithm.h',
     'CryptoBuffer.h',
     'CryptoKey.h',
     'CryptoKeyPair.h',
     'HmacKeyAlgorithm.h',
     'KeyAlgorithm.h',
@@ -37,8 +35,9 @@ FAIL_ON_WARNINGS = True
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '/security/manager/ssl/src',
 ]
 
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/crypto/test/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
--- a/dom/downloads/moz.build
+++ b/dom/downloads/moz.build
@@ -1,10 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 if CONFIG["MOZ_B2G"]:
-    TEST_DIRS += ['tests']
+    MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
 
 PARALLEL_DIRS += ['src']
deleted file mode 100644
--- a/dom/downloads/tests/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
--- a/dom/encoding/moz.build
+++ b/dom/encoding/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS.mozilla.dom += [
     'EncodingUtils.h',
     'FallbackEncoding.h',
     'TextDecoder.h',
     'TextEncoder.h',
 ]
 
 UNIFIED_SOURCES += [
@@ -29,8 +27,15 @@ LOCAL_INCLUDES += [
 
 GENERATED_FILES += [
     'domainsfallbacks.properties.h',
     'encodingsgroups.properties.h',
     'labelsencodings.properties.h',
     'localesfallbacks.properties.h',
     'nonparticipatingdomains.properties.h',
 ]
+
+MOCHITEST_MANIFESTS += [
+    'test/mochitest.ini',
+    'test/unit/mochitest.ini',
+]
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
+XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
--- a/dom/icc/moz.build
+++ b/dom/icc/moz.build
@@ -1,8 +1,7 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
-TEST_DIRS += ['tests']
deleted file mode 100644
--- a/dom/icc/tests/moz.build
+++ /dev/null
@@ -1,6 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
--- a/dom/identity/moz.build
+++ b/dom/identity/moz.build
@@ -1,18 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXTRA_COMPONENTS += [
     'Identity.manifest',
     'nsDOMIdentity.js',
     'nsIDService.js',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'DOMIdentity.jsm',
 ]
 
+MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
deleted file mode 100644
--- a/dom/identity/tests/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_CHROME_MANIFESTS += ['mochitest/chrome.ini']
-
--- a/dom/indexedDB/moz.build
+++ b/dom/indexedDB/moz.build
@@ -1,16 +1,16 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['ipc']
-TEST_DIRS += ['test']
+TEST_DIRS += ['test/extensions']
 
 EXPORTS.mozilla.dom.indexedDB += [
     'Client.h',
     'DatabaseInfo.h',
     'FileInfo.h',
     'FileManager.h',
     'FileSnapshot.h',
     'IDBCursor.h',
@@ -75,8 +75,15 @@ LOCAL_INCLUDES += [
     '/content/base/src',
     '/db/sqlite3/src',
     '/dom/base',
     '/dom/quota',
     '/dom/src/storage',
     '/xpcom/build',
 ]
 
+MOCHITEST_MANIFESTS += [
+    'test/mochitest.ini',
+    'test/unit/mochitest.ini',
+]
+BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
+XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
deleted file mode 100644
--- a/dom/indexedDB/test/moz.build
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += ['extensions']
-
-TEST_DIRS += ['unit']
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-BROWSER_CHROME_MANIFESTS += ['browser.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/indexedDB/test/unit/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/inputmethod/mochitest/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/inputmethod/moz.build
+++ b/dom/inputmethod/moz.build
@@ -1,18 +1,18 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['mochitest']
-
 EXTRA_COMPONENTS += [
     'InputMethod.manifest',
     'MozKeyboard.js',
 ]
 
 EXTRA_JS_MODULES += [
     'Keyboard.jsm',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
+
+MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXPORTS += [
     'nsICachedFileDescriptorListener.h',
     'PCOMContentPermissionRequestChild.h',
 ]
 
 EXPORTS.mozilla.dom.ipc += [
     'Blob.h',
     'nsIRemoteBlob.h',
@@ -142,8 +140,10 @@ for var in ('MOZ_PERMISSIONS', 'MOZ_CHIL
 
 if CONFIG['ENABLE_TESTS']:
     LOCAL_INCLUDES += [
       'ipc/glue',
     ]
 
 JAR_MANIFESTS += ['jar.mn']
 
+MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
deleted file mode 100644
--- a/dom/ipc/tests/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -12,17 +12,18 @@ if CONFIG['MOZ_WEBRTC']:
         '/media/webrtc/trunk',
     ]
 
     if CONFIG['GNU_CXX']:
         CXXFLAGS += [
             '-Wno-unused-local-typedefs', # Workaround until we fix bug 1020661
         ]
 
-TEST_DIRS += ['tests/mochitest', 'tests/ipc', 'tests/identity']
+    MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
+    WEBRTC_SIGNALLING_TEST_MANIFESTS += ['tests/mochitest/steeplechase.ini']
 
 XPIDL_SOURCES += [
     'nsIDOMMediaStream.idl',
     'nsIDOMNavigatorUserMedia.idl',
     'nsIMediaManager.idl',
 ]
 
 XPIDL_MODULE = 'dom_media'
@@ -67,8 +68,13 @@ LOCAL_INCLUDES += [
     '../base',
     '../camera',
     '/caps',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += [
+    'tests/identity/mochitest.ini',
+    'tests/ipc/mochitest.ini',
+]
deleted file mode 100644
--- a/dom/media/tests/identity/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/media/tests/ipc/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
deleted file mode 100644
--- a/dom/media/tests/mochitest/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-if CONFIG ['MOZ_WEBRTC']:
-    MOCHITEST_MANIFESTS += ['mochitest.ini']
-    WEBRTC_SIGNALLING_TEST_MANIFESTS += ['steeplechase.ini']
-
--- a/dom/messages/moz.build
+++ b/dom/messages/moz.build
@@ -1,19 +1,19 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 PARALLEL_DIRS += ['interfaces']
 
 EXTRA_COMPONENTS += [
     'SystemMessageInternal.js',
     'SystemMessageManager.js',
     'SystemMessageManager.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'SystemMessagePermissionsChecker.jsm',
 ]
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/messages/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/mobileconnection/moz.build
+++ b/dom/mobileconnection/moz.build
@@ -1,8 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
-TEST_DIRS += ['tests']
+
+MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
deleted file mode 100644
--- a/dom/mobileconnection/tests/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
--- a/dom/mobileid/moz.build
+++ b/dom/mobileid/moz.build
@@ -1,9 +1,9 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
 
-TEST_DIRS += ['test']
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/mobileid/test/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
--- a/dom/mobilemessage/moz.build
+++ b/dom/mobilemessage/moz.build
@@ -1,9 +1,10 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 DIRS += ['interfaces', 'src']
-TEST_DIRS += ['tests']
 
+MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
+XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
deleted file mode 100644
--- a/dom/mobilemessage/tests/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
-
-if CONFIG['ENABLE_TESTS']:
-        XPCSHELL_TESTS_MANIFESTS += ['xpcshell/xpcshell.ini']
-
--- a/dom/network/moz.build
+++ b/dom/network/moz.build
@@ -1,8 +1,17 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces', 'src']
-TEST_DIRS += ['tests']
+
+XPCSHELL_TESTS_MANIFESTS += [
+    'tests/unit/xpcshell.ini',
+    'tests/unit_ipc/xpcshell.ini',
+]
+
+if CONFIG['tests/MOZ_B2G_RIL']:
+    XPCSHELL_TESTS_MANIFESTS += ['tests/unit_stats/xpcshell.ini']
+
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
deleted file mode 100644
--- a/dom/network/tests/moz.build
+++ /dev/null
@@ -1,12 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini', 'unit_ipc/xpcshell.ini']
-
-if CONFIG['MOZ_B2G_RIL']:
-    XPCSHELL_TESTS_MANIFESTS += ['unit_stats/xpcshell.ini']
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
--- a/dom/nfc/moz.build
+++ b/dom/nfc/moz.build
@@ -12,13 +12,11 @@ if CONFIG['MOZ_NFC']:
     SOURCES += [
         'MozNDEFRecord.cpp',
     ]
     EXTRA_COMPONENTS += [
       'nsNfc.js',
       'nsNfc.manifest',
     ]
 
-TEST_DIRS += ['tests']
-
 FAIL_ON_WARNINGS = True
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/dom/nfc/tests/moz.build
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
--- a/dom/payment/moz.build
+++ b/dom/payment/moz.build
@@ -1,20 +1,19 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['interfaces']
 
-TEST_DIRS += ['tests']
-
 EXTRA_JS_MODULES += [
     'Payment.jsm',
 ]
 
 EXTRA_COMPONENTS += [
     'Payment.js',
     'Payment.manifest',
     'PaymentFlowInfo.js',
 ]
 
+XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
deleted file mode 100644
--- a/dom/payment/tests/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
--- a/dom/permission/moz.build
+++ b/dom/permission/moz.build
@@ -1,18 +1,35 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXTRA_COMPONENTS += [
     'PermissionPromptService.js',
     'PermissionPromptService.manifest',
     'PermissionSettings.js',
     'PermissionSettings.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'PermissionSettings.jsm',
 ]
+
+XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
+
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
+
+if CONFIG['MOZ_B2G_RIL']:
+    MOCHITEST_MANIFESTS += ['tests/mochitest-ril.ini']
+
+if CONFIG['MOZ_B2G_FM']:
+    MOCHITEST_MANIFESTS += ['tests/mochitest-fm.ini']
+
+if CONFIG['MOZ_B2G_BT']:
+    MOCHITEST_MANIFESTS += ['tests/mochitest-bt.ini']
+
+if CONFIG['MOZ_WEBSMS_BACKEND']:
+    MOCHITEST_MANIFESTS += ['tests/mochitest-websms.ini']
+
+if CONFIG['MOZ_TIME_MANAGER']:
+    MOCHITEST_MANIFESTS += ['tests/mochitest-time.ini']
deleted file mode 100644
--- a/dom/permission/tests/moz.build
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-if CONFIG['MOZ_B2G_RIL']:
-    MOCHITEST_MANIFESTS += ['mochitest-ril.ini']
-
-if CONFIG['MOZ_B2G_FM']:
-    MOCHITEST_MANIFESTS += ['mochitest-fm.ini']
-
-if CONFIG['MOZ_B2G_BT']:
-    MOCHITEST_MANIFESTS += ['mochitest-bt.ini']
-
-if CONFIG['MOZ_WEBSMS_BACKEND']:
-    MOCHITEST_MANIFESTS += ['mochitest-websms.ini']
-
-if CONFIG['MOZ_TIME_MANAGER']:
-    MOCHITEST_MANIFESTS += ['mochitest-time.ini']
-
--- a/dom/phonenumberutils/moz.build
+++ b/dom/phonenumberutils/moz.build
@@ -1,23 +1,24 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXTRA_COMPONENTS += [
     'PhoneNumberService.js',
     'PhoneNumberService.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'mcc_iso3166_table.jsm',
     'PhoneNumber.jsm',
     'PhoneNumberMetaData.jsm',
     'PhoneNumberNormalizer.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'PhoneNumberUtils.jsm',
 ]
+
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
deleted file mode 100644
--- a/dom/phonenumberutils/tests/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
--- a/dom/power/moz.build
+++ b/dom/power/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 XPIDL_SOURCES += [
     'nsIDOMWakeLockListener.idl',
     'nsIPowerManagerService.idl',
 ]
 
 XPIDL_MODULE = 'dom_power'
 
 EXPORTS.mozilla.dom += [
@@ -29,8 +27,11 @@ UNIFIED_SOURCES += [
     'WakeLock.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
+BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
deleted file mode 100644
--- a/dom/power/test/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-BROWSER_CHROME_MANIFESTS += ['browser.ini']
-
--- a/dom/promise/moz.build
+++ b/dom/promise/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXPORTS.mozilla.dom += [
     'Promise.h',
     'PromiseDebugging.h',
     'PromiseNativeHandler.h',
     'PromiseWorkerProxy.h',
 ]
 
 UNIFIED_SOURCES += [
@@ -22,8 +20,10 @@ UNIFIED_SOURCES += [
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '../base',
     '../workers',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
deleted file mode 100644
--- a/dom/promise/tests/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/resourcestats/moz.build
+++ b/dom/resourcestats/moz.build
@@ -9,11 +9,14 @@ EXTRA_COMPONENTS += [
     'ResourceStatsManager.manifest',
 ]
 
 EXTRA_JS_MODULES += [
     'ResourceStatsDB.jsm',
     'ResourceStatsService.jsm',
 ]
 
-TEST_DIRS += ['tests']
+FINAL_LIBRARY = 'xul'
 
-FINAL_LIBRARY = 'xul'
+if CONFIG['MOZ_B2G_RIL']:
+    XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
+
+MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
deleted file mode 100644
--- a/dom/resourcestats/tests/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-if CONFIG['MOZ_B2G_RIL']:
-    XPCSHELL_TESTS_MANIFESTS += ['xpcshell/xpcshell.ini']
-
-MOCHITEST_MANIFESTS += ['mochitest/mochitest.ini']
--- a/dom/settings/moz.build
+++ b/dom/settings/moz.build
@@ -1,24 +1,26 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['tests']
-
 EXTRA_COMPONENTS += [
     'SettingsManager.js',
     'SettingsManager.manifest',
 ]
 
 if CONFIG['MOZ_B2G']:
     EXTRA_COMPONENTS += [
         'SettingsService.js',
         'SettingsService.manifest',
     ]
 
+    MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
+
 EXTRA_JS_MODULES += [
     'SettingsChangeNotifier.jsm',
     'SettingsDB.jsm',
     'SettingsQueue.jsm',
 ]
+
+MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
deleted file mode 100644
--- a/dom/settings/tests/moz.build
+++ /dev/null
@@ -1,11 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-if CONFIG['MOZ_B2G']:
-    MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
--- a/dom/src/json/moz.build
+++ b/dom/src/json/moz.build
@@ -1,23 +1,24 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS += [
     'nsJSON.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsJSON.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     '/content/base/src',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/src/json/test/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/src/jsurl/moz.build
+++ b/dom/src/jsurl/moz.build
@@ -1,24 +1,24 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 EXPORTS += [
     'nsJSProtocolHandler.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsJSProtocolHandler.cpp',
 ]
 
 FAIL_ON_WARNINGS = True
 
 LOCAL_INCLUDES += [
     "/dom/base",
     "/netwerk/base/src",
 ]
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
deleted file mode 100644
--- a/dom/src/jsurl/test/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/system/moz.build
+++ b/dom/system/moz.build
@@ -1,29 +1,27 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
 
-if toolkit in ('qt'):
+if toolkit == 'qt':
     DIRS += ['qt']
 elif toolkit == 'windows':
     DIRS += ['windows']
 elif toolkit == 'cocoa':
     DIRS += ['mac']
 elif toolkit == 'android':
     DIRS += ['android']
 elif toolkit == 'gonk':
     DIRS += ['gonk']
 
-TEST_DIRS += ['tests']
-
 XPIDL_SOURCES += [
     'nsIOSFileConstantsService.idl',
 ]
 
 XPIDL_MODULE = 'dom_system'
 
 EXPORTS += [
     'nsDeviceSensors.h',
@@ -52,8 +50,10 @@ FINAL_LIBRARY = 'xul'
 LOCAL_INCLUDES += [
     '/dom/base',
     '/dom/bindings',
     '/js/xpconnect/loader',
 ]
 
 DEFINES['DLL_PREFIX'] = '"%s"' % CONFIG['DLL_PREFIX']
 DEFINES['DLL_SUFFIX'] = '"%s"' % CONFIG['DLL_SUFFIX']
+
+MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
deleted file mode 100644
--- a/dom/system/tests/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/ajax/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += [
-    'jquery/mochitest.ini',
-    'lib/mochitest.ini',
-    'mochikit/mochitest.ini',
-    'mochikit/tests/mochitest.ini',
-    'offline/mochitest.ini',
-    'prototype/mochitest.ini',
-    'scriptaculous/mochitest.ini',
-]
-
deleted file mode 100644
--- a/dom/tests/mochitest/beacon/moz.build
+++ /dev/null
@@ -1,9 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/bugs/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/dom-level0/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/gamepad/Makefile.in
+++ /dev/null
@@ -1,6 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-relativesrcdir	= dom/tests/mochitest/gamepad
-
deleted file mode 100644
--- a/dom/tests/mochitest/gamepad/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/general/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/geolocation/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/localstorage/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/moz.build
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += [
-    'dom-level0',
-    'ajax',
-    'beacon',
-    'bugs',
-    'general',
-    'geolocation',
-    'localstorage',
-    'orientation',
-    'sessionstorage',
-    'storageevent',
-    'notification',
-    'webcomponents',
-]
-
-if CONFIG['MOZ_GAMEPAD']:
-   DIRS += ['gamepad']
-
-MOCHITEST_MANIFESTS += [
-    'crypto/mochitest.ini',
-    'dom-level1-core/mochitest.ini',
-    'dom-level2-core/mochitest.ini',
-    'dom-level2-html/mochitest.ini',
-    'webapps/mochitest.ini',
-    'whatwg/mochitest.ini',
-]
-
-MOCHITEST_CHROME_MANIFESTS += [
-    'chrome/chrome.ini',
-    'webapps/chrome.ini',
-    'whatwg/chrome.ini',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk2':
-    # Bug 788164.
-    MOCHITEST_MANIFESTS += [
-        'pointerlock/mochitest.ini',
-    ]
-
-if CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
-   MOCHITEST_MANIFESTS += [
-      'crypto/mochitest-no-legacy.ini',
-   ]
-else:
-   MOCHITEST_MANIFESTS += [
-      'crypto/mochitest-legacy.ini',
-   ]
deleted file mode 100644
--- a/dom/tests/mochitest/notification/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
deleted file mode 100644
--- a/dom/tests/mochitest/orientation/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/sessionstorage/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/storageevent/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
deleted file mode 100644
--- a/dom/tests/mochitest/webcomponents/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
--- a/dom/tests/moz.build
+++ b/dom/tests/moz.build
@@ -1,10 +1,65 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-DIRS += ['mochitest']
+MOCHITEST_MANIFESTS += [
+    'mochitest/ajax/jquery/mochitest.ini',
+    'mochitest/ajax/lib/mochitest.ini',
+    'mochitest/ajax/mochikit/mochitest.ini',
+    'mochitest/ajax/mochikit/tests/mochitest.ini',
+    'mochitest/ajax/offline/mochitest.ini',
+    'mochitest/ajax/prototype/mochitest.ini',
+    'mochitest/ajax/scriptaculous/mochitest.ini',
+    'mochitest/beacon/mochitest.ini',
+    'mochitest/bugs/mochitest.ini',
+    'mochitest/crypto/mochitest.ini',
+    'mochitest/dom-level0/mochitest.ini',
+    'mochitest/dom-level1-core/mochitest.ini',
+    'mochitest/dom-level2-core/mochitest.ini',
+    'mochitest/dom-level2-html/mochitest.ini',
+    'mochitest/general/mochitest.ini',
+    'mochitest/geolocation/mochitest.ini',
+    'mochitest/localstorage/mochitest.ini',
+    'mochitest/notification/mochitest.ini',
+    'mochitest/orientation/mochitest.ini',
+    'mochitest/sessionstorage/mochitest.ini',
+    'mochitest/storageevent/mochitest.ini',
+    'mochitest/webapps/mochitest.ini',
+    'mochitest/webcomponents/mochitest.ini',
+    'mochitest/whatwg/mochitest.ini',
+]
+
+MOCHITEST_CHROME_MANIFESTS += [
+    'mochitest/beacon/chrome.ini',
+    'mochitest/chrome/chrome.ini',
+    'mochitest/general/chrome.ini',
+    'mochitest/localstorage/chrome.ini',
+    'mochitest/sessionstorage/chrome.ini',
+    'mochitest/webapps/chrome.ini',
+    'mochitest/whatwg/chrome.ini',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk2':
+    # Bug 788164.
+    MOCHITEST_MANIFESTS += [
+        'mochitest/pointerlock/mochitest.ini',
+    ]
+
+if CONFIG['MOZ_DISABLE_CRYPTOLEGACY']:
+    MOCHITEST_MANIFESTS += [
+        'mochitest/crypto/mochitest-no-legacy.ini',
+    ]
+else:
+    MOCHITEST_MANIFESTS += [
+        'mochitest/crypto/mochitest-legacy.ini',
+    ]
+
+if CONFIG['MOZ_GAMEPAD']:
+    MOCHITEST_MANIFESTS += [
+        'mochitest/gamepad/mochitest.ini',
+    ]
 
 XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -1,16 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-TEST_DIRS += ['test']
-
 # Public stuff.
 EXPORTS.mozilla.dom += [
     'ServiceWorkerContainer.h',
     'WorkerPrivate.h',
     'WorkerRunnable.h',
     'WorkerScope.h',
 ]
 
@@ -71,8 +69,22 @@ LOCAL_INCLUDES += [
     '/content/base/src',
     '/xpcom/build',
     '/xpcom/threads',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
+
+TEST_DIRS += [
+    'test/extensions/bootstrap',
+    'test/extensions/traditional',
+]
+
+MOCHITEST_MANIFESTS += [
+    'test/mochitest.ini',
+    'test/serviceworkers/mochitest.ini',
+]
+
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
+
+XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
deleted file mode 100644
--- a/dom/workers/test/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DIRS += [
-    'extensions',
-    'serviceworkers',
-]
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
-XPCSHELL_TESTS_MANIFESTS += ['xpcshell/xpcshell.ini']
deleted file mode 100644
--- a/dom/workers/test/serviceworkers/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
--- a/dom/xbl/moz.build
+++ b/dom/xbl/moz.build
@@ -1,16 +1,15 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 PARALLEL_DIRS += ['builtin']
-TEST_DIRS += ['test']
 
 EXPORTS += [
     'nsBindingManager.h',
     'nsXBLBinding.h',
     'nsXBLService.h',
 ]
 
 EXPORTS.mozilla.dom += [
@@ -47,8 +46,11 @@ LOCAL_INCLUDES += [
     '/content/xul/content/src',
     '/content/xul/document/src',
     '/dom/base',
     '/dom/xml',
     '/layout/style',
 ]
 
 FINAL_LIBRARY = 'xul'
+
+MOCHITEST_MANIFESTS += ['test/mochitest.ini']
+MOCHITEST_CHROME_MANIFESTS += ['test/chrome.ini']
deleted file mode 100644
--- a/dom/xbl/test/moz.build
+++ /dev/null
@@ -1,10 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-
-MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-
--- a/dom/xslt/moz.build
+++ b/dom/xslt/moz.build
@@ -22,12 +22,11 @@ EXPORTS += [
 
 PARALLEL_DIRS += [
     'base',
     'xml',
     'xpath',
     'xslt',
 ]
 
-TEST_DIRS += [
-    'tests/buster',
-    'tests/mochitest',
-]
+if CONFIG['ENABLE_TESTS']:
+    JAR_MANIFESTS += ['tests/buster/jar.mn']
+    MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
deleted file mode 100644
--- a/dom/xslt/tests/buster/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-JAR_MANIFESTS += ['jar.mn']
\ No newline at end of file
deleted file mode 100644
--- a/dom/xslt/tests/mochitest/moz.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-MOCHITEST_MANIFESTS += ['mochitest.ini']
-