summaryrefslogtreecommitdiffstats
path: root/devtools/client/sourceeditor/test/helper_codemirror_runner.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/sourceeditor/test/helper_codemirror_runner.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-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 'devtools/client/sourceeditor/test/helper_codemirror_runner.js')
-rw-r--r--devtools/client/sourceeditor/test/helper_codemirror_runner.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/devtools/client/sourceeditor/test/helper_codemirror_runner.js b/devtools/client/sourceeditor/test/helper_codemirror_runner.js
new file mode 100644
index 000000000..b9e458472
--- /dev/null
+++ b/devtools/client/sourceeditor/test/helper_codemirror_runner.js
@@ -0,0 +1,38 @@
+/* vim: set ts=2 et sw=2 tw=80: */
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+/* globals codemirrorSetStatus */
+
+"use strict";
+
+function runCodeMirrorTest(browser) {
+ let mm = browser.messageManager;
+ mm.addMessageListener("setStatus", function listener({data}) {
+ let {statusMsg, type, customMsg} = data;
+ codemirrorSetStatus(statusMsg, type, customMsg);
+ });
+ mm.addMessageListener("done", function listener({data}) {
+ ok(!data.failed, "CodeMirror tests all passed");
+ while (gBrowser.tabs.length > 1) {
+ gBrowser.removeCurrentTab();
+ }
+ mm = null;
+ finish();
+ });
+
+ // Interact with the content iframe, giving it a function to
+ // 1) Proxy CM test harness calls into ok() calls
+ // 2) Detecting when it finishes by checking the DOM and
+ // setting a timeout to check again if not.
+ mm.loadFrameScript("data:," +
+ "content.wrappedJSObject.mozilla_setStatus = function(statusMsg, type, customMsg) {" +
+ " sendSyncMessage('setStatus', {statusMsg: statusMsg, type: type, customMsg: customMsg});" +
+ "};" +
+ "function check() { " +
+ " var doc = content.document; var out = doc.getElementById('status'); " +
+ " if (!out || !out.classList.contains('done')) { return setTimeout(check, 100); }" +
+ " sendAsyncMessage('done', { failed: content.wrappedJSObject.failed });" +
+ "}" +
+ "check();"
+ , true);
+}