зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1371065: Part 1 - Remove external references to the add-on SDK. r=Mossop,glandium
MozReview-Commit-ID: D5KyHcg8Ujk --HG-- extra : rebase_source : 1a74ccb2963f2946a49c8bf720af595151b48fd1
This commit is contained in:
Родитель
f829523282
Коммит
e99cced382
|
@ -7,7 +7,6 @@ obj*/**
|
|||
# We ignore all these directories by default, until we get them enabled.
|
||||
# If you are enabling a directory, please add directory specific exclusions
|
||||
# below.
|
||||
addon-sdk/**
|
||||
chrome/**
|
||||
config/**
|
||||
docshell/**
|
||||
|
|
|
@ -171,8 +171,8 @@ var whitelist = [
|
|||
{file: "resource://gre/modules/Manifest.jsm"},
|
||||
// Bug 1351097
|
||||
{file: "resource://gre/modules/accessibility/AccessFu.jsm"},
|
||||
// Bug 1351637
|
||||
{file: "resource://gre/modules/sdk/bootstrap.js"},
|
||||
// Bug 1399216
|
||||
{file: "resource://gre/modules/HiddenFrame.jsm"},
|
||||
];
|
||||
|
||||
whitelist = new Set(whitelist.filter(item =>
|
||||
|
|
|
@ -1528,14 +1528,6 @@ VARIABLES = {
|
|||
"""List of manifest files defining browser chrome tests.
|
||||
"""),
|
||||
|
||||
'JETPACK_PACKAGE_MANIFESTS': (ManifestparserManifestList, list,
|
||||
"""List of manifest files defining jetpack package tests.
|
||||
"""),
|
||||
|
||||
'JETPACK_ADDON_MANIFESTS': (ManifestparserManifestList, list,
|
||||
"""List of manifest files defining jetpack addon tests.
|
||||
"""),
|
||||
|
||||
'ANDROID_INSTRUMENTATION_MANIFESTS': (ManifestparserManifestList, list,
|
||||
"""List of manifest files defining Android instrumentation tests.
|
||||
"""),
|
||||
|
|
|
@ -1256,15 +1256,6 @@ class TreeMetadataEmitter(LoggingMixin):
|
|||
|
||||
filtered = mpmanifest.tests
|
||||
|
||||
# Jetpack add-on tests are expected to be generated during the
|
||||
# build process so they won't exist here.
|
||||
if flavor != 'jetpack-addon':
|
||||
missing = [t['name'] for t in filtered if not os.path.exists(t['path'])]
|
||||
if missing:
|
||||
raise SandboxValidationError('Test manifest (%s) lists '
|
||||
'test that does not exist: %s' % (
|
||||
path, ', '.join(missing)), context)
|
||||
|
||||
out_dir = mozpath.join(install_prefix, manifest_reldir)
|
||||
if 'install-to-subdir' in defaults:
|
||||
# This is terrible, but what are you going to do?
|
||||
|
|
|
@ -206,10 +206,6 @@ class TestResolver(MozbuildObject):
|
|||
'mochitest', 'a11y'),
|
||||
'browser-chrome': os.path.join(self.topobjdir, '_tests', 'testing',
|
||||
'mochitest', 'browser'),
|
||||
'jetpack-package': os.path.join(self.topobjdir, '_tests', 'testing',
|
||||
'mochitest', 'jetpack-package'),
|
||||
'jetpack-addon': os.path.join(self.topobjdir, '_tests', 'testing',
|
||||
'mochitest', 'jetpack-addon'),
|
||||
'chrome': os.path.join(self.topobjdir, '_tests', 'testing',
|
||||
'mochitest', 'chrome'),
|
||||
'mochitest': os.path.join(self.topobjdir, '_tests', 'testing',
|
||||
|
@ -291,8 +287,6 @@ TEST_MANIFESTS = dict(
|
|||
A11Y=('a11y', 'testing/mochitest', 'a11y', True),
|
||||
BROWSER_CHROME=('browser-chrome', 'testing/mochitest', 'browser', True),
|
||||
ANDROID_INSTRUMENTATION=('instrumentation', 'instrumentation', '.', False),
|
||||
JETPACK_PACKAGE=('jetpack-package', 'testing/mochitest', 'jetpack-package', True),
|
||||
JETPACK_ADDON=('jetpack-addon', 'testing/mochitest', 'jetpack-addon', False),
|
||||
FIREFOX_UI_FUNCTIONAL=('firefox-ui-functional', 'firefox-ui', '.', False),
|
||||
FIREFOX_UI_UPDATE=('firefox-ui-update', 'firefox-ui', '.', False),
|
||||
PUPPETEER_FIREFOX=('firefox-ui-functional', 'firefox-ui', '.', False),
|
||||
|
|
|
@ -32,7 +32,6 @@ common-tests:
|
|||
- mochitest-clipboard
|
||||
- mochitest-devtools-chrome
|
||||
- mochitest-gpu
|
||||
- mochitest-jetpack
|
||||
- mochitest-media
|
||||
- mochitest-webgl
|
||||
- reftest
|
||||
|
@ -166,7 +165,6 @@ windows-tests:
|
|||
- mochitest-clipboard
|
||||
- mochitest-devtools-chrome
|
||||
- mochitest-gpu
|
||||
- mochitest-jetpack
|
||||
- mochitest-media
|
||||
- mochitest-webgl
|
||||
- reftest
|
||||
|
@ -223,7 +221,6 @@ macosx64-tests:
|
|||
- mochitest-clipboard
|
||||
- mochitest-devtools-chrome
|
||||
- mochitest-gpu
|
||||
- mochitest-jetpack
|
||||
- mochitest-media
|
||||
- mochitest-webgl
|
||||
- reftest
|
||||
|
@ -275,7 +272,6 @@ linux32-tests:
|
|||
- mochitest-chrome
|
||||
- mochitest-clipboard
|
||||
- mochitest-gpu
|
||||
- mochitest-jetpack
|
||||
- mochitest-media
|
||||
- mochitest-webgl
|
||||
- reftest
|
||||
|
|
|
@ -877,34 +877,6 @@ mochitest-gpu:
|
|||
windows10-64-asan.*: 3
|
||||
default: default
|
||||
|
||||
mochitest-jetpack:
|
||||
description: "Mochitest jetpack run"
|
||||
suite: mochitest/jetpack-package
|
||||
treeherder-symbol: tc-M(JP)
|
||||
loopback-video: true
|
||||
e10s: false
|
||||
max-run-time: 5400
|
||||
mozharness:
|
||||
mochitest-flavor: jetpack-package
|
||||
script: desktop_unittest.py
|
||||
no-read-buildbot-config: true
|
||||
chunked: false
|
||||
config:
|
||||
by-test-platform:
|
||||
windows.*:
|
||||
- unittests/win_taskcluster_unittest.py
|
||||
macosx.*:
|
||||
- unittests/mac_unittest.py
|
||||
linux.*:
|
||||
- unittests/linux_unittest.py
|
||||
- remove_executables.py
|
||||
extra-options:
|
||||
- --mochitest-suite=jetpack-package
|
||||
tier:
|
||||
by-test-platform:
|
||||
windows10-64-asan.*: 3
|
||||
default: default
|
||||
|
||||
mochitest-media:
|
||||
description: "Mochitest media run"
|
||||
suite: mochitest/mochitest-media
|
||||
|
|
|
@ -91,7 +91,6 @@ UNITTEST_ALIASES = {
|
|||
'mochitest-gpu-e10s': alias_prefix('mochitest-gpu-e10s'),
|
||||
'mochitest-clipboard': alias_prefix('mochitest-clipboard'),
|
||||
'mochitest-clipboard-e10s': alias_prefix('mochitest-clipboard-e10s'),
|
||||
'mochitest-jetpack': alias_prefix('mochitest-jetpack'),
|
||||
'mochitest-media': alias_prefix('mochitest-media'),
|
||||
'mochitest-media-e10s': alias_prefix('mochitest-media-e10s'),
|
||||
'mochitest-vg': alias_prefix('mochitest-valgrind'),
|
||||
|
|
|
@ -65,11 +65,6 @@ TEST_SUITES = {
|
|||
'mach_command': 'firefox-ui-update',
|
||||
'kwargs': {},
|
||||
},
|
||||
'jetpack': {
|
||||
'aliases': ('J',),
|
||||
'mach_command': 'jetpack-test',
|
||||
'kwargs': {},
|
||||
},
|
||||
'check-spidermonkey': {
|
||||
'aliases': ('Sm', 'sm'),
|
||||
'mach_command': 'check-spidermonkey',
|
||||
|
|
|
@ -3,10 +3,6 @@ mochikit.jar:
|
|||
content/browser-harness.xul (browser-harness.xul)
|
||||
content/browser-test.js (browser-test.js)
|
||||
content/browser-test-overlay.xul (browser-test-overlay.xul)
|
||||
content/jetpack-package-harness.js (jetpack-package-harness.js)
|
||||
content/jetpack-package-overlay.xul (jetpack-package-overlay.xul)
|
||||
content/jetpack-addon-harness.js (jetpack-addon-harness.js)
|
||||
content/jetpack-addon-overlay.xul (jetpack-addon-overlay.xul)
|
||||
content/chrome-harness.js (chrome-harness.js)
|
||||
content/mochitest-e10s-utils.js (mochitest-e10s-utils.js)
|
||||
content/shutdown-leaks-collector.js (shutdown-leaks-collector.js)
|
||||
|
|
|
@ -1,234 +0,0 @@
|
|||
/* -*- js-indent-level: 2; tab-width: 2; indent-tabs-mode: nil -*- */
|
||||
var gConfig;
|
||||
|
||||
if (Cc === undefined) {
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
}
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
|
||||
"resource://gre/modules/AddonManager.jsm");
|
||||
|
||||
// How long to wait for an add-on to uninstall before aborting
|
||||
const MAX_UNINSTALL_TIME = 10000;
|
||||
setTimeout(testInit, 0);
|
||||
|
||||
var sdkpath = null;
|
||||
|
||||
// Strip off the chrome prefix to get the actual path of the test directory
|
||||
function realPath(chrome) {
|
||||
return chrome.substring("chrome://mochitests/content/jetpack-addon/".length)
|
||||
.replace(".xpi", "");
|
||||
}
|
||||
|
||||
const chromeRegistry = Cc["@mozilla.org/chrome/chrome-registry;1"]
|
||||
.getService(Ci.nsIChromeRegistry);
|
||||
|
||||
// Installs a single add-on returning a promise for when install is completed
|
||||
function installAddon(url) {
|
||||
let chromeURL = Services.io.newURI(url);
|
||||
let file = chromeRegistry.convertChromeURL(chromeURL)
|
||||
.QueryInterface(Ci.nsIFileURL).file;
|
||||
|
||||
let addon;
|
||||
const listener = {
|
||||
onInstalling(_addon) {
|
||||
addon = _addon;
|
||||
// Set add-on's test options
|
||||
const options = {
|
||||
test: {
|
||||
iterations: 1,
|
||||
stop: false,
|
||||
keepOpen: true,
|
||||
},
|
||||
profile: {
|
||||
memory: false,
|
||||
leaks: false,
|
||||
},
|
||||
output: {
|
||||
logLevel: "verbose",
|
||||
format: "tbpl",
|
||||
},
|
||||
console: {
|
||||
logLevel: "info",
|
||||
},
|
||||
}
|
||||
setPrefs("extensions." + addon.id + ".sdk", options);
|
||||
|
||||
// If necessary override the add-ons module paths to point somewhere
|
||||
// else
|
||||
if (sdkpath) {
|
||||
let paths = {}
|
||||
for (let path of ["dev", "diffpatcher", "framescript", "method", "node", "sdk", "toolkit"]) {
|
||||
paths[path] = sdkpath + path;
|
||||
}
|
||||
setPrefs("extensions.modules." + addon.id + ".path", paths);
|
||||
}
|
||||
},
|
||||
};
|
||||
AddonManager.addAddonListener(listener);
|
||||
|
||||
return AddonManager.installTemporaryAddon(file)
|
||||
.then(() => {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
return addon;
|
||||
});
|
||||
}
|
||||
|
||||
// Uninstalls an add-on returning a promise for when it is gone
|
||||
function uninstallAddon(oldAddon) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
AddonManager.addAddonListener({
|
||||
onUninstalled: function(addon) {
|
||||
if (addon.id != oldAddon.id)
|
||||
return;
|
||||
|
||||
AddonManager.removeAddonListener(this);
|
||||
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Uninstalled test add-on " + addon.id + "\n");
|
||||
|
||||
// Some add-ons do async work on uninstall, we must wait for that to
|
||||
// complete
|
||||
setTimeout(resolve, 500);
|
||||
}
|
||||
});
|
||||
|
||||
oldAddon.uninstall();
|
||||
|
||||
// The uninstall should happen quickly, if not throw an exception
|
||||
setTimeout(() => {
|
||||
reject(new Error(`Addon ${oldAddon.id} failed to uninstall in a timely fashion.`));
|
||||
}, MAX_UNINSTALL_TIME);
|
||||
});
|
||||
}
|
||||
|
||||
// Waits for a test add-on to signal it has completed its tests
|
||||
function waitForResults() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
Services.obs.addObserver(function(subject, topic, data) {
|
||||
Services.obs.removeObserver(arguments.callee, "sdk:test:results");
|
||||
|
||||
resolve(JSON.parse(data));
|
||||
}, "sdk:test:results");
|
||||
});
|
||||
}
|
||||
|
||||
// Runs tests for the add-on available at URL.
|
||||
var testAddon = async function({ url }) {
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Installing test add-on " + realPath(url) + "\n");
|
||||
let addon = await installAddon(url);
|
||||
|
||||
let results = await waitForResults();
|
||||
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Uninstalling test add-on " + addon.id + "\n");
|
||||
await uninstallAddon(addon);
|
||||
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Testing add-on " + realPath(url) + " is complete\n");
|
||||
return results;
|
||||
};
|
||||
|
||||
// Sets a set of prefs for test add-ons
|
||||
function setPrefs(root, options) {
|
||||
Object.keys(options).forEach(id => {
|
||||
const key = root + "." + id;
|
||||
const value = options[id]
|
||||
const type = typeof(value);
|
||||
|
||||
value === null ? void(0) :
|
||||
value === undefined ? void(0) :
|
||||
type === "boolean" ? Services.prefs.setBoolPref(key, value) :
|
||||
type === "string" ? Services.prefs.setCharPref(key, value) :
|
||||
type === "number" ? Services.prefs.setIntPref(key, parseInt(value)) :
|
||||
type === "object" ? setPrefs(key, value) :
|
||||
void(0);
|
||||
});
|
||||
}
|
||||
|
||||
function testInit() {
|
||||
// Make sure to run the test harness for the first opened window only
|
||||
if (Services.prefs.prefHasUserValue("testing.jetpackTestHarness.running"))
|
||||
return;
|
||||
|
||||
Services.prefs.setBoolPref("testing.jetpackTestHarness.running", true);
|
||||
|
||||
// Get the list of tests to run
|
||||
let config = readConfig();
|
||||
getTestList(config, function(links) {
|
||||
try {
|
||||
let fileNames = [];
|
||||
let fileNameRegexp = /.+\.xpi$/;
|
||||
arrayOfTestFiles(links, fileNames, fileNameRegexp);
|
||||
|
||||
if (config.startAt || config.endAt) {
|
||||
fileNames = skipTests(fileNames, config.startAt, config.endAt);
|
||||
}
|
||||
|
||||
// Override the SDK modules if necessary
|
||||
try {
|
||||
let sdklibs = Services.prefs.getCharPref("extensions.sdk.path");
|
||||
// sdkpath is a file path, make it a URI
|
||||
let sdkfile = Cc["@mozilla.org/file/local;1"].
|
||||
createInstance(Ci.nsIFile);
|
||||
sdkfile.initWithPath(sdklibs);
|
||||
sdkpath = Services.io.newFileURI(sdkfile).spec;
|
||||
}
|
||||
catch (e) {
|
||||
// Stick with the built-in modules
|
||||
}
|
||||
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
function finish() {
|
||||
if (passed + failed == 0) {
|
||||
dump("TEST-UNEXPECTED-FAIL | jetpack-addon-harness.js | " +
|
||||
"No tests to run. Did you pass invalid test_paths?\n");
|
||||
}
|
||||
else {
|
||||
dump("Jetpack Addon Test Summary\n");
|
||||
dump("\tPassed: " + passed + "\n" +
|
||||
"\tFailed: " + failed + "\n" +
|
||||
"\tTodo: 0\n");
|
||||
}
|
||||
|
||||
if (config.closeWhenDone) {
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Shutting down.\n");
|
||||
|
||||
const appStartup = Cc['@mozilla.org/toolkit/app-startup;1'].
|
||||
getService(Ci.nsIAppStartup);
|
||||
appStartup.quit(appStartup.eAttemptQuit);
|
||||
}
|
||||
}
|
||||
|
||||
function testNextAddon() {
|
||||
if (fileNames.length == 0)
|
||||
return finish();
|
||||
|
||||
let filename = fileNames.shift();
|
||||
dump("TEST-INFO | jetpack-addon-harness.js | Starting test add-on " + realPath(filename.url) + "\n");
|
||||
testAddon(filename).then(results => {
|
||||
passed += results.passed;
|
||||
failed += results.failed;
|
||||
}).then(testNextAddon, error => {
|
||||
// If something went wrong during the test then a previous test add-on
|
||||
// may still be installed, this leaves us in an unexpected state so
|
||||
// probably best to just abandon testing at this point
|
||||
failed++;
|
||||
dump("TEST-UNEXPECTED-FAIL | jetpack-addon-harness.js | Error testing " + realPath(filename.url) + ": " + error + "\n");
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
testNextAddon();
|
||||
}
|
||||
catch (e) {
|
||||
dump("TEST-UNEXPECTED-FAIL | jetpack-addon-harness.js | error starting test harness (" + e + ")\n");
|
||||
dump(e.stack);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<overlay id="jetpackTestOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/manifestLibrary.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chunkifyTests.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/server.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/jetpack-addon-harness.js"/>
|
||||
</overlay>
|
|
@ -1,249 +0,0 @@
|
|||
/* -*- js-indent-level: 2; tab-width: 2; indent-tabs-mode: nil -*- */
|
||||
const TEST_PACKAGE = "chrome://mochitests/content/";
|
||||
|
||||
// Make sure to use the real add-on ID to get the e10s shims activated
|
||||
const TEST_ID = "mochikit@mozilla.org";
|
||||
|
||||
var gConfig;
|
||||
|
||||
if (Cc === undefined) {
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
var Cu = Components.utils;
|
||||
}
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
|
||||
setTimeout(testInit, 0);
|
||||
|
||||
// Tests a single module
|
||||
function testModule(require, { url, expected }) {
|
||||
return new Promise(resolve => {
|
||||
let path = url.substring(TEST_PACKAGE.length);
|
||||
|
||||
const { stdout } = require("sdk/system");
|
||||
|
||||
const { runTests } = require("sdk/test/harness");
|
||||
const loaderModule = require("toolkit/loader");
|
||||
const options = require("sdk/test/options");
|
||||
|
||||
function findAndRunTests(loader, nextIteration) {
|
||||
const { TestRunner } = loaderModule.main(loader, "sdk/deprecated/unit-test");
|
||||
|
||||
const NOT_TESTS = ['setup', 'teardown'];
|
||||
var runner = new TestRunner();
|
||||
|
||||
let tests = [];
|
||||
|
||||
let suiteModule;
|
||||
try {
|
||||
dump("TEST-INFO: " + path + " | Loading test module\n");
|
||||
suiteModule = loaderModule.main(loader, "tests/" + path.substring(0, path.length - 3));
|
||||
}
|
||||
catch (e) {
|
||||
// If `Unsupported Application` error thrown during test,
|
||||
// skip the test suite
|
||||
suiteModule = {
|
||||
'test suite skipped': assert => assert.pass(e.message)
|
||||
};
|
||||
}
|
||||
|
||||
for (let name of Object.keys(suiteModule).sort()) {
|
||||
if (NOT_TESTS.indexOf(name) != -1)
|
||||
continue;
|
||||
|
||||
tests.push({
|
||||
setup: suiteModule.setup,
|
||||
teardown: suiteModule.teardown,
|
||||
testFunction: suiteModule[name],
|
||||
name: path + "." + name
|
||||
});
|
||||
}
|
||||
|
||||
runner.startMany({
|
||||
tests: {
|
||||
getNext: () => Promise.resolve(tests.shift())
|
||||
},
|
||||
stopOnError: options.stopOnError,
|
||||
onDone: nextIteration
|
||||
});
|
||||
}
|
||||
|
||||
runTests({
|
||||
findAndRunTests: findAndRunTests,
|
||||
iterations: options.iterations,
|
||||
filter: options.filter,
|
||||
profileMemory: options.profileMemory,
|
||||
stopOnError: options.stopOnError,
|
||||
verbose: options.verbose,
|
||||
parseable: options.parseable,
|
||||
print: stdout.write,
|
||||
onDone: resolve
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Sets the test prefs
|
||||
function setPrefs(root, options) {
|
||||
Object.keys(options).forEach(id => {
|
||||
const key = root + "." + id;
|
||||
const value = options[id]
|
||||
const type = typeof(value);
|
||||
|
||||
value === null ? void(0) :
|
||||
value === undefined ? void(0) :
|
||||
type === "boolean" ? Services.prefs.setBoolPref(key, value) :
|
||||
type === "string" ? Services.prefs.setCharPref(key, value) :
|
||||
type === "number" ? Services.prefs.setIntPref(key, parseInt(value)) :
|
||||
type === "object" ? setPrefs(key, value) :
|
||||
void(0);
|
||||
});
|
||||
}
|
||||
|
||||
function testInit() {
|
||||
// Make sure to run the test harness for the first opened window only
|
||||
if (Services.prefs.prefHasUserValue("testing.jetpackTestHarness.running"))
|
||||
return;
|
||||
|
||||
Services.prefs.setBoolPref("testing.jetpackTestHarness.running", true);
|
||||
|
||||
// Need to set this very early, otherwise the false value gets cached in
|
||||
// DOM bindings code.
|
||||
Services.prefs.setBoolPref("dom.indexedDB.experimental", true);
|
||||
|
||||
// Get the list of tests to run
|
||||
let config = readConfig();
|
||||
getTestList(config, function(links) {
|
||||
try {
|
||||
let fileNames = [];
|
||||
let fileNameRegexp = /test-.+\.js$/;
|
||||
arrayOfTestFiles(links, fileNames, fileNameRegexp);
|
||||
|
||||
if (config.startAt || config.endAt) {
|
||||
fileNames = skipTests(fileNames, config.startAt, config.endAt);
|
||||
}
|
||||
|
||||
// The SDK assumes it is being run from resource URIs
|
||||
let chromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
|
||||
let realPath = chromeReg.convertChromeURL(Services.io.newURI(TEST_PACKAGE));
|
||||
let resProtocol = Cc["@mozilla.org/network/protocol;1?name=resource"].getService(Ci.nsIResProtocolHandler);
|
||||
resProtocol.setSubstitution("jetpack-package-tests", realPath);
|
||||
|
||||
// Set the test options
|
||||
const options = {
|
||||
test: {
|
||||
iterations: config.runUntilFailure ? config.repeat : 1,
|
||||
stop: false,
|
||||
keepOpen: true,
|
||||
},
|
||||
profile: {
|
||||
memory: false,
|
||||
leaks: false,
|
||||
},
|
||||
output: {
|
||||
logLevel: "verbose",
|
||||
format: "tbpl",
|
||||
},
|
||||
console: {
|
||||
logLevel: "info",
|
||||
},
|
||||
}
|
||||
setPrefs("extensions." + TEST_ID + ".sdk", options);
|
||||
|
||||
// Override the SDK modules if necessary
|
||||
let sdkpath = "resource://gre/modules/commonjs/";
|
||||
try {
|
||||
let sdklibs = Services.prefs.getCharPref("extensions.sdk.path");
|
||||
// sdkpath is a file path, make it a URI and map a resource URI to it
|
||||
let sdkfile = Cc["@mozilla.org/file/local;1"].
|
||||
createInstance(Ci.nsIFile);
|
||||
sdkfile.initWithPath(sdklibs);
|
||||
let sdkuri = Services.io.newFileURI(sdkfile);
|
||||
resProtocol.setSubstitution("jetpack-modules", sdkuri);
|
||||
sdkpath = "resource://jetpack-modules/";
|
||||
}
|
||||
catch (e) {
|
||||
// Stick with the built-in modules
|
||||
}
|
||||
|
||||
const paths = {
|
||||
"": sdkpath,
|
||||
"tests/": "resource://jetpack-package-tests/",
|
||||
};
|
||||
|
||||
// Create the base module loader to load the test harness
|
||||
const loaderID = "toolkit/loader";
|
||||
const loaderURI = paths[""] + loaderID + ".js";
|
||||
const loaderModule = Cu.import(loaderURI, {}).Loader;
|
||||
|
||||
const modules = {};
|
||||
|
||||
// Manually set the loader's module cache to include itself;
|
||||
// which otherwise fails due to lack of `Components`.
|
||||
modules[loaderID] = loaderModule;
|
||||
modules["@test/options"] = {};
|
||||
|
||||
let loader = loaderModule.Loader({
|
||||
id: TEST_ID,
|
||||
name: "addon-sdk",
|
||||
version: "1.0",
|
||||
loadReason: "install",
|
||||
paths: paths,
|
||||
modules: modules,
|
||||
isNative: true,
|
||||
rootURI: paths["tests/"],
|
||||
prefixURI: paths["tests/"],
|
||||
metadata: {},
|
||||
});
|
||||
|
||||
const module = loaderModule.Module(loaderID, loaderURI);
|
||||
const require = loaderModule.Require(loader, module);
|
||||
|
||||
// Wait until the add-on window is ready
|
||||
require("sdk/addon/window").ready.then(() => {
|
||||
let passed = 0;
|
||||
let failed = 0;
|
||||
|
||||
function finish() {
|
||||
if (passed + failed == 0) {
|
||||
dump("TEST-UNEXPECTED-FAIL | jetpack-package-harness.js | " +
|
||||
"No tests to run. Did you pass invalid test_paths?\n");
|
||||
}
|
||||
else {
|
||||
dump("Jetpack Package Test Summary\n");
|
||||
dump("\tPassed: " + passed + "\n" +
|
||||
"\tFailed: " + failed + "\n" +
|
||||
"\tTodo: 0\n");
|
||||
}
|
||||
|
||||
if (config.closeWhenDone) {
|
||||
require("sdk/system").exit(failed == 0 ? 0 : 1);
|
||||
}
|
||||
else {
|
||||
loaderModule.unload(loader, "shutdown");
|
||||
}
|
||||
}
|
||||
|
||||
function testNextModule() {
|
||||
if (fileNames.length == 0)
|
||||
return finish();
|
||||
|
||||
let filename = fileNames.shift();
|
||||
testModule(require, filename).then(tests => {
|
||||
passed += tests.passed;
|
||||
failed += tests.failed;
|
||||
}).then(testNextModule);
|
||||
}
|
||||
|
||||
testNextModule();
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
dump("TEST-UNEXPECTED-FAIL: jetpack-package-harness.js | error starting test harness (" + e + ")\n");
|
||||
dump(e.stack);
|
||||
}
|
||||
});
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<!-- 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/. -->
|
||||
|
||||
<overlay id="jetpackTestOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/manifestLibrary.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/chunkifyTests.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/server.js"/>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/jetpack-package-harness.js"/>
|
||||
</overlay>
|
|
@ -28,7 +28,7 @@ class ShutdownLeaks(object):
|
|||
def log(self, message):
|
||||
action = message['action']
|
||||
|
||||
# Remove 'log' when jetpack and clipboard are gone and/or structured.
|
||||
# Remove 'log' when clipboard is gone and/or structured.
|
||||
if action in ('log', 'process_output'):
|
||||
line = message['message'] if action == 'log' else message['data']
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class MochitestRunner(MozbuildObject):
|
|||
"""Runs a mochitest.
|
||||
|
||||
suite is the type of mochitest to run. It can be one of ('plain',
|
||||
'chrome', 'browser', 'a11y', 'jetpack-package', 'jetpack-addon').
|
||||
'chrome', 'browser', 'a11y').
|
||||
"""
|
||||
# runtests.py is ambiguous, so we load the file/module manually.
|
||||
if 'mochitest' not in sys.modules:
|
||||
|
@ -499,11 +499,3 @@ class DeprecatedCommands(MachCommandBase):
|
|||
@Command('mochitest-a11y', category='testing', conditions=[REMOVED])
|
||||
def mochitest_a11y(self):
|
||||
pass
|
||||
|
||||
@Command('jetpack-addon', category='testing', conditions=[REMOVED])
|
||||
def jetpack_addon(self):
|
||||
pass
|
||||
|
||||
@Command('jetpack-package', category='testing', conditions=[REMOVED])
|
||||
def jetpack_package(self):
|
||||
pass
|
||||
|
|
|
@ -59,22 +59,6 @@ ALL_FLAVORS = {
|
|||
'flavor': 'browser',
|
||||
}
|
||||
},
|
||||
'jetpack-package': {
|
||||
'suite': 'jetpack-package',
|
||||
'aliases': ('jetpack-package', 'mochitest-jetpack-package', 'jpp'),
|
||||
'enabled_apps': ('firefox',),
|
||||
'extra_args': {
|
||||
'flavor': 'jetpack-package',
|
||||
}
|
||||
},
|
||||
'jetpack-addon': {
|
||||
'suite': 'jetpack-addon',
|
||||
'aliases': ('jetpack-addon', 'mochitest-jetpack-addon', 'jpa'),
|
||||
'enabled_apps': ('firefox',),
|
||||
'extra_args': {
|
||||
'flavor': 'jetpack-addon',
|
||||
}
|
||||
},
|
||||
'a11y': {
|
||||
'suite': 'a11y',
|
||||
'aliases': ('a11y', 'mochitest-a11y', 'accessibility'),
|
||||
|
|
|
@ -50,10 +50,6 @@ TEST_HARNESS_FILES.testing.mochitest += [
|
|||
'chunkifyTests.js',
|
||||
'gen_template.pl',
|
||||
'harness.xul',
|
||||
'jetpack-addon-harness.js',
|
||||
'jetpack-addon-overlay.xul',
|
||||
'jetpack-package-harness.js',
|
||||
'jetpack-package-overlay.xul',
|
||||
'leaks.py',
|
||||
'mach_test_package_commands.py',
|
||||
'manifest.webapp',
|
||||
|
|
|
@ -853,11 +853,8 @@ class MochitestDesktop(object):
|
|||
"Mochitest specific tbpl formatter")
|
||||
self.log = commandline.setup_logging("mochitest", logger_options, {"tbpl": sys.stdout})
|
||||
|
||||
# Jetpack flavors still don't use the structured logger. We need to process their output
|
||||
# slightly differently.
|
||||
structured = not self.flavor.startswith('jetpack')
|
||||
self.message_logger = MessageLogger(
|
||||
logger=self.log, buffering=quiet, structured=structured)
|
||||
logger=self.log, buffering=quiet, structured=True)
|
||||
|
||||
# Max time in seconds to wait for server startup before tests will fail -- if
|
||||
# this seems big, it's mostly for debug machines where cold startup
|
||||
|
@ -936,7 +933,7 @@ class MochitestDesktop(object):
|
|||
if options.logFile:
|
||||
options.logFile = self.getLogFilePath(options.logFile)
|
||||
|
||||
if options.flavor in ('a11y', 'browser', 'chrome', 'jetpack-addon', 'jetpack-package'):
|
||||
if options.flavor in ('a11y', 'browser', 'chrome'):
|
||||
self.makeTestConfig(options)
|
||||
else:
|
||||
if options.autorun:
|
||||
|
@ -1028,11 +1025,6 @@ class MochitestDesktop(object):
|
|||
if options.flavor == 'browser':
|
||||
allow_js_css = True
|
||||
testPattern = re.compile(r"browser_.+\.js")
|
||||
elif options.flavor == 'jetpack-package':
|
||||
allow_js_css = True
|
||||
testPattern = re.compile(r"test-.+\.js")
|
||||
elif options.flavor == 'jetpack-addon':
|
||||
testPattern = re.compile(r".+\.xpi")
|
||||
elif options.flavor in ('a11y', 'chrome'):
|
||||
testPattern = re.compile(r"(browser|test)_.+\.(xul|html|js|xhtml)")
|
||||
else:
|
||||
|
@ -1076,7 +1068,7 @@ class MochitestDesktop(object):
|
|||
|
||||
if options.flavor in ('a11y', 'chrome'):
|
||||
testURL = "/".join([testHost, self.CHROME_PATH])
|
||||
elif options.flavor in ('browser', 'jetpack-addon', 'jetpack-package'):
|
||||
elif options.flavor == 'browser':
|
||||
testURL = "about:blank"
|
||||
if options.nested_oop:
|
||||
testURL = "/".join([testHost, self.NESTED_OOP_TEST_PATH])
|
||||
|
@ -2432,7 +2424,7 @@ toolbar#nav-bar {
|
|||
self.logPreamble(tests)
|
||||
tests = [t for t in tests if 'disabled' not in t]
|
||||
|
||||
# Until we have all green, this does not run on jetpack*, or a11y (for perf reasons)
|
||||
# Until we have all green, this does not run on a11y (for perf reasons)
|
||||
if not options.runByManifest:
|
||||
return self.runMochitests(options, [t['path'] for t in tests])
|
||||
|
||||
|
|
|
@ -202,9 +202,6 @@ config = {
|
|||
"mochitest-devtools-chrome": ["--flavor=browser", "--subsuite=devtools"],
|
||||
"mochitest-devtools-chrome-chunked": ["--flavor=browser", "--subsuite=devtools", "--chunk-by-runtime"],
|
||||
"mochitest-devtools-chrome-coverage": ["--flavor=browser", "--subsuite=devtools", "--chunk-by-runtime", "--timeout=1200"],
|
||||
"jetpack-package": ["--flavor=jetpack-package"],
|
||||
"jetpack-package-clipboard": ["--flavor=jetpack-package", "--subsuite=clipboard"],
|
||||
"jetpack-addon": ["--flavor=jetpack-addon"],
|
||||
"a11y": ["--flavor=a11y"],
|
||||
},
|
||||
# local reftest suites
|
||||
|
@ -297,7 +294,7 @@ config = {
|
|||
"default_blob_upload_servers": [
|
||||
"https://blobupload.elasticbeanstalk.com",
|
||||
],
|
||||
"unstructured_flavors": {"mochitest": ['jetpack'],
|
||||
"unstructured_flavors": {"mochitest": [],
|
||||
"xpcshell": [],
|
||||
"gtest": [],
|
||||
"mozmill": [],
|
||||
|
|
|
@ -165,9 +165,6 @@ config = {
|
|||
"mochitest-gl": ["--subsuite=webgl"],
|
||||
"mochitest-devtools-chrome": ["--flavor=browser", "--subsuite=devtools"],
|
||||
"mochitest-devtools-chrome-chunked": ["--flavor=browser", "--subsuite=devtools", "--chunk-by-runtime"],
|
||||
"jetpack-package": ["--flavor=jetpack-package"],
|
||||
"jetpack-package-clipboard": ["--flavor=jetpack-package", "--subsuite=clipboard"],
|
||||
"jetpack-addon": ["--flavor=jetpack-addon"],
|
||||
"a11y": ["--flavor=a11y"],
|
||||
},
|
||||
# local reftest suites
|
||||
|
@ -244,7 +241,7 @@ config = {
|
|||
"default_blob_upload_servers": [
|
||||
"https://blobupload.elasticbeanstalk.com",
|
||||
],
|
||||
"unstructured_flavors": {"mochitest": ['jetpack'],
|
||||
"unstructured_flavors": {"mochitest": [],
|
||||
"xpcshell": [],
|
||||
"gtest": [],
|
||||
"mozmill": [],
|
||||
|
|
|
@ -178,9 +178,6 @@ config = {
|
|||
"mochitest-devtools-chrome": ["--flavor=browser", "--subsuite=devtools"],
|
||||
"mochitest-devtools-chrome-chunked": ["--flavor=browser", "--subsuite=devtools", "--chunk-by-runtime"],
|
||||
"mochitest-metro-chrome": ["--flavor=browser", "--metro-immersive"],
|
||||
"jetpack-package": ["--flavor=jetpack-package"],
|
||||
"jetpack-package-clipboard": ["--flavor=jetpack-package", "--subsuite=clipboard"],
|
||||
"jetpack-addon": ["--flavor=jetpack-addon"],
|
||||
"a11y": ["--flavor=a11y"],
|
||||
},
|
||||
# local reftest suites
|
||||
|
|
|
@ -177,9 +177,6 @@ config = {
|
|||
"mochitest-devtools-chrome": ["--flavor=browser", "--subsuite=devtools"],
|
||||
"mochitest-devtools-chrome-chunked": ["--flavor=browser", "--subsuite=devtools", "--chunk-by-runtime"],
|
||||
"mochitest-metro-chrome": ["--flavor=browser", "--metro-immersive"],
|
||||
"jetpack-package": ["--flavor=jetpack-package"],
|
||||
"jetpack-package-clipboard": ["--flavor=jetpack-package", "--subsuite=clipboard"],
|
||||
"jetpack-addon": ["--flavor=jetpack-addon"],
|
||||
"a11y": ["--flavor=a11y"],
|
||||
},
|
||||
# local reftest suites
|
||||
|
@ -267,7 +264,7 @@ config = {
|
|||
"default_blob_upload_servers": [
|
||||
"https://blobupload.elasticbeanstalk.com",
|
||||
],
|
||||
"unstructured_flavors": {"mochitest": ['jetpack'],
|
||||
"unstructured_flavors": {"mochitest": [],
|
||||
"xpcshell": [],
|
||||
"gtest": [],
|
||||
"mozmill": [],
|
||||
|
|
|
@ -489,8 +489,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
"mochitest": [("plain.*", "mochitest"),
|
||||
("browser-chrome.*", "browser-chrome"),
|
||||
("mochitest-devtools-chrome.*", "devtools-chrome"),
|
||||
("chrome", "chrome"),
|
||||
("jetpack.*", "jetpack")],
|
||||
("chrome", "chrome")],
|
||||
"xpcshell": [("xpcshell", "xpcshell")],
|
||||
"reftest": [("reftest", "reftest"),
|
||||
("crashtest", "crashtest")]
|
||||
|
|
|
@ -91,9 +91,6 @@ REMOTE_CPPUNITTESTS = \
|
|||
cppunittests-remote:
|
||||
$(call REMOTE_CPPUNITTESTS);
|
||||
|
||||
jetpack-tests:
|
||||
cd $(topsrcdir)/addon-sdk/source && $(PYTHON) bin/cfx -b $(abspath $(browser_path)) --parseable testpkgs
|
||||
|
||||
pgo-profile-run:
|
||||
$(PYTHON) $(topsrcdir)/build/pgo/profileserver.py $(EXTRA_TEST_ARGS)
|
||||
|
||||
|
@ -108,7 +105,6 @@ stage-all: \
|
|||
stage-extensions \
|
||||
stage-mochitest \
|
||||
stage-jstests \
|
||||
stage-jetpack \
|
||||
test-packages-manifest \
|
||||
$(NULL)
|
||||
ifdef MOZ_WEBRTC
|
||||
|
@ -179,7 +175,6 @@ make-stage-dir: install-test-files
|
|||
$(NSINSTALL) -D $(PKG_STAGE)/bin/components
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/certs
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/config
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/jetpack
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/modules
|
||||
$(NSINSTALL) -D $(PKG_STAGE)/tools/mach
|
||||
|
||||
|
@ -231,9 +226,6 @@ stage-android: make-stage-dir
|
|||
$(NSINSTALL) -D $(DEPTH)/_tests/reftest/hyphenation
|
||||
$(NSINSTALL) $(wildcard $(topsrcdir)/intl/locales/*/hyphenation/*.dic) $(DEPTH)/_tests/reftest/hyphenation
|
||||
|
||||
stage-jetpack: make-stage-dir
|
||||
$(MAKE) -C $(DEPTH)/addon-sdk stage-tests-package
|
||||
|
||||
CPP_UNIT_TEST_BINS=$(wildcard $(DIST)/cppunittests/*)
|
||||
|
||||
stage-cppunittests: make-stage-dir
|
||||
|
@ -288,7 +280,6 @@ check::
|
|||
stage-mochitest \
|
||||
stage-jstests \
|
||||
stage-android \
|
||||
stage-jetpack \
|
||||
stage-steeplechase \
|
||||
stage-instrumentation-tests \
|
||||
test-packages-manifest \
|
||||
|
|
|
@ -1,15 +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/.
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["ShimWaiver"];
|
||||
|
||||
this.ShimWaiver = {
|
||||
getProperty(obj, prop) {
|
||||
let rv = obj[prop];
|
||||
if (rv instanceof Function) {
|
||||
rv = rv.bind(obj);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
};
|
|
@ -20,5 +20,4 @@ EXTRA_JS_MODULES += [
|
|||
'Prefetcher.jsm',
|
||||
'RemoteAddonsChild.jsm',
|
||||
'RemoteAddonsParent.jsm',
|
||||
'ShimWaiver.jsm'
|
||||
]
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Test that OS.File can be loaded using the CommonJS loader.
|
||||
*/
|
||||
|
||||
var { Loader } = Components.utils.import("resource://gre/modules/commonjs/toolkit/loader.js", {});
|
||||
|
||||
|
||||
add_task(async function() {
|
||||
let dataDir = Services.io.newFileURI(do_get_file("test_loader/", true)).spec + "/";
|
||||
let loader = Loader.Loader({
|
||||
paths: {"": dataDir }
|
||||
});
|
||||
|
||||
let require = Loader.Require(loader, Loader.Module("module_test_loader", "foo"));
|
||||
do_print("Require is ready");
|
||||
try {
|
||||
require("module_test_loader");
|
||||
} catch (error) {
|
||||
dump("Bootstrap error: " +
|
||||
(error.message ? error.message : String(error)) + "\n" +
|
||||
(error.stack || error.fileName + ": " + error.lineNumber) + "\n");
|
||||
|
||||
throw error;
|
||||
}
|
||||
|
||||
do_print("Require has worked");
|
||||
});
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
// Load OS.File from a module loaded with the CommonJS/addon-sdk loader
|
||||
|
||||
var {Cu} = require("chrome");
|
||||
Cu.import("resource://gre/modules/osfile.jsm");
|
|
@ -1,16 +1,12 @@
|
|||
[DEFAULT]
|
||||
head = head.js
|
||||
|
||||
support-files =
|
||||
test_loader/module_test_loader.js
|
||||
|
||||
[test_compression.js]
|
||||
[test_constants.js]
|
||||
[test_creationDate.js]
|
||||
[test_duration.js]
|
||||
[test_exception.js]
|
||||
[test_file_URL_conversion.js]
|
||||
[test_loader.js]
|
||||
[test_logging.js]
|
||||
[test_makeDir.js]
|
||||
[test_open.js]
|
||||
|
|
|
@ -142,8 +142,6 @@ DIRS += [
|
|||
if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
|
||||
DIRS += ['/toolkit/system/gnome']
|
||||
|
||||
DIRS += ['/addon-sdk']
|
||||
|
||||
if CONFIG['ENABLE_MARIONETTE']:
|
||||
DIRS += [
|
||||
'/testing/firefox-ui',
|
||||
|
|
|
@ -4,7 +4,6 @@ py2:
|
|||
include: ['.']
|
||||
exclude:
|
||||
- accessible/xpcom/AccEventGen.py
|
||||
- addon-sdk
|
||||
- browser
|
||||
- build
|
||||
- client.py
|
||||
|
|
|
@ -3,7 +3,6 @@ py3:
|
|||
description: Python 3 compatibility check
|
||||
include: ['.']
|
||||
exclude:
|
||||
- addon-sdk/source
|
||||
- browser/app
|
||||
- browser/components
|
||||
- browser/extensions
|
||||
|
|
Загрузка…
Ссылка в новой задаче