Bug 1369801 - dt-addon-xpcshell: load devtools addon for xpcshell tests;r=bgrins
MozReview-Commit-ID: 4EyclGKca0t
--- a/devtools/client/aboutdebugging/test/xpcshell.ini
+++ b/devtools/client/aboutdebugging/test/xpcshell.ini
@@ -1,7 +1,7 @@
[DEFAULT]
tags = devtools
-head = xpcshell-head.js
+head = ../../../shared/tests/shared-xpcshell-head.js xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_addon_path.js]
--- a/devtools/client/animationinspector/test/unit/xpcshell.ini
+++ b/devtools/client/animationinspector/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../../shared/tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_findOptimalTimeInterval.js]
[test_formatStopwatchTime.js]
[test_getCssPropertyName.js]
[test_timeScale.js]
[test_timeScale_dimensions.js]
--- a/devtools/client/inspector/grids/test/unit/xpcshell.ini
+++ b/devtools/client/inspector/grids/test/unit/xpcshell.ini
@@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
firefox-appdir = browser
-head = head.js
+head = ../../../../../shared/tests/shared-xpcshell-head.js head.js
[test_compare_fragments_geometry.js]
--- a/devtools/client/memory/test/unit/xpcshell.ini
+++ b/devtools/client/memory/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools devtools-memory
-head = head.js ../../../framework/test/shared-redux-head.js
+head = ../../../../shared/tests/shared-xpcshell-head.js head.js ../../../framework/test/shared-redux-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_action_diffing_01.js]
[test_action_diffing_02.js]
[test_action_diffing_03.js]
[test_action_diffing_04.js]
[test_action_diffing_05.js]
--- a/devtools/client/performance/test/unit/xpcshell.ini
+++ b/devtools/client/performance/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head.js
+head = ../../../../shared/tests/shared-xpcshell-head.js head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_frame-utils-01.js]
[test_frame-utils-02.js]
[test_marker-blueprint.js]
[test_marker-utils.js]
[test_profiler-categories.js]
--- a/devtools/client/responsive.html/test/unit/xpcshell.ini
+++ b/devtools/client/responsive.html/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head.js ../../../framework/test/shared-redux-head.js
+head = ../../../../shared/tests/shared-xpcshell-head.js head.js ../../../framework/test/shared-redux-head.js
firefox-appdir = browser
[test_add_device.js]
[test_add_device_type.js]
[test_add_viewport.js]
[test_change_device.js]
[test_change_display_pixel_ratio.js]
[test_change_location.js]
--- a/devtools/client/shared/redux/middleware/test/xpcshell.ini
+++ b/devtools/client/shared/redux/middleware/test/xpcshell.ini
@@ -1,9 +1,9 @@
[DEFAULT]
tags = devtools
-head = head.js
+head = ../../../../../shared/tests/shared-xpcshell-head.js head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_middleware-task-01.js]
[test_middleware-task-02.js]
[test_middleware-task-03.js]
--- a/devtools/client/shared/test/unit/xpcshell.ini
+++ b/devtools/client/shared/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../../shared/tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
../helper_color_data.js
[test_advanceValidate.js]
[test_attribute-parsing-01.js]
--- a/devtools/client/shared/vendor/stringvalidator/tests/unit/xpcshell.ini
+++ b/devtools/client/shared/vendor/stringvalidator/tests/unit/xpcshell.ini
@@ -1,8 +1,8 @@
[DEFAULT]
tags = devtools
-head = head_stringvalidator.js
+head = ../../../../../../shared/tests/shared-xpcshell-head.js head_stringvalidator.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_sanitizers.js]
[test_validators.js]
--- a/devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini
+++ b/devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini
@@ -1,7 +1,7 @@
[DEFAULT]
tags = devtools
-head = head_tern.js
+head = ../../../../../shared/tests/shared-xpcshell-head.js head_tern.js
firefox-appdir = browser
[test_autocompletion.js]
[test_import_tern.js]
--- a/devtools/client/webconsole/net/test/unit/xpcshell.ini
+++ b/devtools/client/webconsole/net/test/unit/xpcshell.ini
@@ -1,8 +1,8 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../../../shared/tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_json-utils.js]
[test_net-utils.js]
--- a/devtools/platform/tests/unit/xpcshell.ini
+++ b/devtools/platform/tests/unit/xpcshell.ini
@@ -1,6 +1,7 @@
[DEFAULT]
tags = devtools
+head = ../../../shared/tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_nsjsinspector.js]
--- a/devtools/server/tests/unit/xpcshell.ini
+++ b/devtools/server/tests/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head_dbg.js
+head = ../../../shared/tests/shared-xpcshell-head.js head_dbg.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
babel_and_browserify_script_with_source_map.js
source-map-data/sourcemapped.coffee
source-map-data/sourcemapped.map
post_init_global_actors.js
--- a/devtools/shared/acorn/tests/unit/xpcshell.ini
+++ b/devtools/shared/acorn/tests/unit/xpcshell.ini
@@ -1,9 +1,9 @@
[DEFAULT]
tags = devtools
-head = head_acorn.js
+head = ../../../tests/shared-xpcshell-head.js head_acorn.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_import_acorn.js]
[test_same_ast.js]
[test_lenient_parser.js]
--- a/devtools/shared/discovery/tests/unit/xpcshell.ini
+++ b/devtools/shared/discovery/tests/unit/xpcshell.ini
@@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../tests/shared-xpcshell-head.js
firefox-appdir = browser
[test_discovery.js]
--- a/devtools/shared/heapsnapshot/tests/unit/xpcshell.ini
+++ b/devtools/shared/heapsnapshot/tests/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools heapsnapshot devtools-memory
-head = head_heapsnapshot.js
+head = ../../../tests/shared-xpcshell-head.js head_heapsnapshot.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
Census.jsm
dominator-tree-worker.js
heap-snapshot-worker.js
Match.jsm
--- a/devtools/shared/jsbeautify/tests/unit/xpcshell.ini
+++ b/devtools/shared/jsbeautify/tests/unit/xpcshell.ini
@@ -1,7 +1,7 @@
[DEFAULT]
tags = devtools
-head = head_jsbeautify.js
+head = ../../../tests/shared-xpcshell-head.js head_jsbeautify.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test.js]
--- a/devtools/shared/moz.build
+++ b/devtools/shared/moz.build
@@ -1,16 +1,20 @@
# -*- Mode: python; 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/.
include('../templates.mozbuild')
+TEST_HARNESS_FILES.xpcshell.devtools.shared.tests += [
+ 'tests/shared-xpcshell-head.js',
+]
+
DIRS += [
'acorn',
'apps',
'client',
'css',
'discovery',
'fronts',
'gcli',
--- a/devtools/shared/performance/test/xpcshell.ini
+++ b/devtools/shared/performance/test/xpcshell.ini
@@ -1,7 +1,7 @@
[DEFAULT]
tags = devtools
-head = head.js
+head = ../../../shared/tests/shared-xpcshell-head.js head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test_perf-utils-allocations-to-samples.js]
--- a/devtools/shared/platform/content/test/xpcshell.ini
+++ b/devtools/shared/platform/content/test/xpcshell.ini
@@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../tests/shared-xpcshell-head.js
firefox-appdir = browser
[test_stack.js]
--- a/devtools/shared/pretty-fast/tests/unit/xpcshell.ini
+++ b/devtools/shared/pretty-fast/tests/unit/xpcshell.ini
@@ -1,7 +1,7 @@
[DEFAULT]
tags = devtools
-head = head_pretty-fast.js
+head = ../../../tests/shared-xpcshell-head.js head_pretty-fast.js
firefox-appdir = browser
skip-if = toolkit == 'android'
[test.js]
--- a/devtools/shared/qrcode/tests/unit/xpcshell.ini
+++ b/devtools/shared/qrcode/tests/unit/xpcshell.ini
@@ -1,6 +1,6 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../tests/shared-xpcshell-head.js
firefox-appdir = browser
[test_encode.js]
--- a/devtools/shared/security/tests/unit/xpcshell.ini
+++ b/devtools/shared/security/tests/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head_dbg.js
+head = ../../../tests/shared-xpcshell-head.js head_dbg.js
firefox-appdir = browser
support-files=
testactors.js
[test_encryption.js]
[test_oob_cert_auth.js]
skip-if = (toolkit == 'android' && !debug) # Bug 1141544: Re-enable when buildbot tests are gone
new file mode 100644
--- /dev/null
+++ b/devtools/shared/tests/shared-xpcshell-head.js
@@ -0,0 +1,30 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+(() => {
+ const {interfaces: Ci, utils: Cu} = Components;
+ const {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+
+ // Load our bootstrap extension manifest so we can access our chrome/resource URIs.
+ const EXTENSION_ID = "devtools@mozilla.org";
+ let extensionDir = Services.dirsvc.get("GreD", Ci.nsIFile);
+ extensionDir.append("browser");
+ extensionDir.append("features");
+ extensionDir.append(EXTENSION_ID);
+ // If the unpacked extension doesn't exist, use the packed version.
+ // Typically running tests on a local build will rely on the unpacked version
+ // while running tests against a packaged Firefox build (on try for instance) will
+ // rely on the xpi.
+ if (!extensionDir.exists()) {
+ extensionDir = extensionDir.parent;
+ extensionDir.append(EXTENSION_ID + ".xpi");
+ }
+ Components.manager.addBootstrappedManifestLocation(extensionDir);
+
+ // Load devtools preferences that should normally be loaded by bootstrap.js
+ let {DevToolsPreferences} =
+ Cu.import("chrome://devtools/content/preferences/DevToolsPreferences.jsm", {});
+ DevToolsPreferences.loadPrefs();
+})();
--- a/devtools/shared/tests/unit/xpcshell.ini
+++ b/devtools/shared/tests/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head_devtools.js
+head = ../shared-xpcshell-head.js head_devtools.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
exposeLoader.js
[test_assert.js]
[test_csslexer.js]
[test_css-properties-db.js]
--- a/devtools/shared/transport/tests/unit/xpcshell.ini
+++ b/devtools/shared/transport/tests/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head = head_dbg.js
+head = ../../../tests/shared-xpcshell-head.js head_dbg.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
testactors.js
testactors-no-bulk.js
[test_bulk_error.js]
--- a/devtools/shared/webconsole/test/unit/xpcshell.ini
+++ b/devtools/shared/webconsole/test/unit/xpcshell.ini
@@ -1,11 +1,11 @@
[DEFAULT]
tags = devtools
-head =
+head = ../../../tests/shared-xpcshell-head.js
firefox-appdir = browser
skip-if = toolkit == 'android'
support-files =
[test_js_property_provider.js]
[test_network_helper.js]
[test_security-info-certificate.js]
[test_security-info-parser.js]