mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 1425463 - Expose Console API to JSM - xpcshell test, r=smaug
This commit is contained in:
parent
797ef68515
commit
4d402775e1
@ -44,5 +44,6 @@ LOCAL_INCLUDES += [
|
||||
|
||||
MOCHITEST_MANIFESTS += [ 'tests/mochitest.ini' ]
|
||||
MOCHITEST_CHROME_MANIFESTS += [ 'tests/chrome.ini' ]
|
||||
XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
31
dom/console/tests/xpcshell/test_basic.js
Normal file
31
dom/console/tests/xpcshell/test_basic.js
Normal file
@ -0,0 +1,31 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
add_task(async function() {
|
||||
do_check_true("console" in this);
|
||||
|
||||
let p = new Promise(resolve => {
|
||||
function consoleListener() {
|
||||
Services.obs.addObserver(this, "console-api-log-event");
|
||||
}
|
||||
|
||||
consoleListener.prototype = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
let obj = aSubject.wrappedJSObject;
|
||||
do_check_true(obj.arguments[0] === 42, "Message received!");
|
||||
do_check_true(obj.ID === "jsm", "The ID is JSM");
|
||||
do_check_true(obj.innerID.endsWith("test_basic.js"), "The innerID matches");
|
||||
|
||||
Services.obs.removeObserver(this, "console-api-log-event");
|
||||
resolve();
|
||||
}
|
||||
};
|
||||
|
||||
new consoleListener();
|
||||
});
|
||||
|
||||
console.log(42);
|
||||
await p;
|
||||
});
|
5
dom/console/tests/xpcshell/xpcshell.ini
Normal file
5
dom/console/tests/xpcshell/xpcshell.ini
Normal file
@ -0,0 +1,5 @@
|
||||
[DEFAULT]
|
||||
head =
|
||||
support-files =
|
||||
|
||||
[test_basic.js]
|
Loading…
x
Reference in New Issue
Block a user