diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /addon-sdk/source/test/addons/main/main.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'addon-sdk/source/test/addons/main/main.js')
-rw-r--r-- | addon-sdk/source/test/addons/main/main.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/addon-sdk/source/test/addons/main/main.js b/addon-sdk/source/test/addons/main/main.js new file mode 100644 index 000000000..6cab5d005 --- /dev/null +++ b/addon-sdk/source/test/addons/main/main.js @@ -0,0 +1,37 @@ +/* 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/. */ +'use strict'; + +const { setTimeout } = require('sdk/timers'); + +var mainStarted = false; + +exports.main = function main(options, callbacks) { + mainStarted = true; + + let tests = {}; + + tests.testMainArguments = function(assert) { + assert.ok(!!options, 'options argument provided to main'); + assert.ok('loadReason' in options, 'loadReason is in options provided by main'); + assert.equal(typeof callbacks.print, 'function', 'callbacks.print is a function'); + assert.equal(typeof callbacks.quit, 'function', 'callbacks.quit is a function'); + + // Re-enable when bug 1251664 is fixed + //assert.equal(options.loadReason, 'install', 'options.loadReason is install'); + } + + require('sdk/test/runner').runTestsFromModule({exports: tests}); +} + +// this causes a fail if main does not start +setTimeout(function() { + if (mainStarted) + return; + + // main didn't start, fail.. + require("sdk/test/runner").runTestsFromModule({exports: { + testFail: assert => assert.fail('Main did not start..') + }}); +}, 500); |