Bug 1369801 - dt-addon-xpcshell: load devtools addon for xpcshell tests draft
authorJulian Descottes <jdescottes@mozilla.com>
Fri, 16 Jun 2017 12:35:52 +0200
changeset 606665 a6c95c787d4db371d6d967ee3aaf4b3d9137a1e3
parent 606664 034df8adc31e548f15a1b6f4cd5b027079a24aa8
child 606666 78982c0608e2e9d31397c813364dd1f8dcfe591b
push id67765
push userjdescottes@mozilla.com
push dateTue, 11 Jul 2017 08:07:43 +0000
bugs1369801
milestone56.0a1
Bug 1369801 - dt-addon-xpcshell: load devtools addon for xpcshell tests MozReview-Commit-ID: ElBqJNgOWut
devtools/client/animationinspector/test/unit/xpcshell.ini
devtools/client/inspector/grids/test/unit/xpcshell.ini
devtools/client/memory/test/unit/xpcshell.ini
devtools/client/performance/test/unit/xpcshell.ini
devtools/client/responsive.html/test/unit/xpcshell.ini
devtools/client/shared/redux/middleware/test/xpcshell.ini
devtools/client/shared/test/unit/xpcshell.ini
devtools/client/shared/vendor/stringvalidator/tests/unit/xpcshell.ini
devtools/client/sourceeditor/tern/tests/unit/xpcshell.ini
devtools/client/webconsole/net/test/unit/xpcshell.ini
devtools/platform/tests/unit/xpcshell.ini
devtools/server/tests/unit/xpcshell.ini
devtools/shared/acorn/tests/unit/xpcshell.ini
devtools/shared/discovery/tests/unit/xpcshell.ini
devtools/shared/heapsnapshot/tests/unit/xpcshell.ini
devtools/shared/jsbeautify/tests/unit/xpcshell.ini
devtools/shared/moz.build
devtools/shared/performance/test/xpcshell.ini
devtools/shared/platform/content/test/xpcshell.ini
devtools/shared/pretty-fast/tests/unit/xpcshell.ini
devtools/shared/qrcode/tests/unit/xpcshell.ini
devtools/shared/security/tests/unit/xpcshell.ini
devtools/shared/tests/unit/shared-xpcshell-head.js
devtools/shared/tests/unit/xpcshell.ini
devtools/shared/transport/tests/unit/xpcshell.ini
devtools/shared/webconsole/test/unit/xpcshell.ini
--- 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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/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.unit += [
+    'tests/unit/shared-xpcshell-head.js',
+]
+
 DIRS += [
     'acorn',
     'apps',
     'client',
     'css',
     'discovery',
     'fronts',
     'gcli',
@@ -62,10 +66,10 @@ DevToolsModules(
     'plural-form.js',
     'protocol.js',
     'system.js',
     'task.js',
     'ThreadSafeDevToolsUtils.js',
     'wasm-source-map.js',
 )
 
-with Files('**'):
-    BUG_COMPONENT = ('Firefox', 'Developer Tools')
+with Files('**'):
+    BUG_COMPONENT = ('Firefox', 'Developer Tools')
--- 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/unit/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/unit/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/unit/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/unit/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/unit/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/unit/shared-xpcshell-head.js
@@ -0,0 +1,19 @@
+"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.
+  if (!extensionDir.exists()) {
+    extensionDir = extensionDir.parent;
+    extensionDir.append(EXTENSION_ID + ".xpi");
+  }
+  Components.manager.addBootstrappedManifestLocation(extensionDir);
+})();
--- 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/unit/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/unit/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]