summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/mochitest/director-helpers.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/server/tests/mochitest/director-helpers.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/server/tests/mochitest/director-helpers.js')
-rw-r--r--devtools/server/tests/mochitest/director-helpers.js44
1 files changed, 44 insertions, 0 deletions
diff --git a/devtools/server/tests/mochitest/director-helpers.js b/devtools/server/tests/mochitest/director-helpers.js
new file mode 100644
index 000000000..fe1f7d394
--- /dev/null
+++ b/devtools/server/tests/mochitest/director-helpers.js
@@ -0,0 +1,44 @@
+var Cu = Components.utils;
+const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {DebuggerClient} = require("devtools/shared/client/main");
+const {DebuggerServer} = require("devtools/server/main");
+const Services = require("Services");
+
+// Always log packets when running tests.
+Services.prefs.setBoolPref("devtools.debugger.log", true);
+Services.prefs.setBoolPref("dom.mozBrowserFramesEnabled", true);
+
+SimpleTest.registerCleanupFunction(function () {
+ Services.prefs.clearUserPref("devtools.debugger.log");
+ Services.prefs.clearUserPref("dom.mozBrowserFramesEnabled");
+});
+
+const { DirectorRegistry } = require("devtools/server/actors/director-registry");
+const { DirectorRegistryFront } = require("devtools/shared/fronts/director-registry");
+
+const { DirectorManagerFront } = require("devtools/shared/fronts/director-manager");
+
+const { Task } = require("devtools/shared/task");
+
+/** *********************************
+ * director helpers functions
+ **********************************/
+
+function* newConnectedDebuggerClient(opts) {
+ var transport = DebuggerServer.connectPipe();
+ var client = new DebuggerClient(transport);
+
+ yield client.connect();
+
+ var root = yield client.listTabs();
+
+ return {
+ client: client,
+ root: root,
+ transport: transport
+ };
+}
+
+function purgeInstalledDirectorScripts() {
+ DirectorRegistry.clear();
+}