diff options
author | Matt A. Tobin <email@mattatobin.com> | 2020-02-25 15:07:00 -0500 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2020-04-14 12:55:19 +0200 |
commit | eb70e6e3d0bff11c25f14b1196025791bf2308fb (patch) | |
tree | 5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/formautofill/test/chrome/loader.js | |
parent | 32ead795290b3399d56b4708fc75b77d296f6a1a (diff) | |
download | UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.gz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.lz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.tar.xz UXP-eb70e6e3d0bff11c25f14b1196025791bf2308fb.zip |
Issue #439 - Remove tests from toolkit/
Diffstat (limited to 'toolkit/components/formautofill/test/chrome/loader.js')
-rw-r--r-- | toolkit/components/formautofill/test/chrome/loader.js | 116 |
1 files changed, 0 insertions, 116 deletions
diff --git a/toolkit/components/formautofill/test/chrome/loader.js b/toolkit/components/formautofill/test/chrome/loader.js deleted file mode 100644 index 25b0e6ea3..000000000 --- a/toolkit/components/formautofill/test/chrome/loader.js +++ /dev/null @@ -1,116 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -/* - * Infrastructure for the mochitest-chrome tests located in this folder. - * - * See "loader_common.js" in the parent folder for a general overview. - * - * Unless you are adding new features to the framework, you shouldn't have to - * modify this file. Use "head_common.js" or "head.js" for shared code. - */ - -"use strict"; - -var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; - -Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); -Cu.import("resource://gre/modules/Services.jsm", this); - -Services.scriptloader.loadSubScript( - "chrome://mochikit/content/tests/SimpleTest/SimpleTest.js", this); - -var sharedUrl = SimpleTest.getTestFileURL("loader_common.js"); -Services.scriptloader.loadSubScript(sharedUrl, this); - -var parentScript = SpecialPowers.loadChromeScript( - SimpleTest.getTestFileURL("loader_parent.js")); - -// Replace the extension of the loaded HTML file with ".js" -var testUrl = location.href.replace(/\.\w+$/, ".js"); - -// Start loading the test script in the parent process. -var promiseParentInitFinished = new Promise(function (resolve) { - parentScript.addMessageListener("finish_load_in_parent", resolve); -}); -parentScript.sendAsyncMessage("start_load_in_parent", { testUrl: testUrl }); - -// Define output functions so they look the same across all frameworks. -var Output = { - print: info, -}; - -// Define assertion functions so they look the same across all frameworks. -var Assert = { - ok: _mochitestAssert.ok, - equal: _mochitestAssert.equal, -}; - -var executeSoon = SimpleTest.executeSoon; - -var gTestTasks = []; - -// Define task registration functions, see description in "loader_common.js". -function add_task(taskFn) { - gTestTasks.push([taskFn, "content", taskFn.name]); -} -function add_task_in_parent_process(taskFn, taskIdOverride) { - let taskId = taskIdOverride || getTaskId(Components.stack.caller); - gTestTasks.push([taskFn, "parent", taskId]); -} -function add_task_in_both_processes(taskFn) { - // We need to define a task ID based on our direct caller. - add_task_in_parent_process(taskFn, getTaskId(Components.stack.caller)); - add_task(taskFn); -} -var add_task_in_child_process = add_task; - -window.addEventListener("load", function onLoad() { - window.removeEventListener("load", onLoad); - - Task.spawn(function* () { - try { - for (let [taskFn, taskType, taskId] of gTestTasks) { - if (taskType == "content") { - // This is a normal task executed in the current process. - info("Running " + taskFn.name); - yield Task.spawn(taskFn); - } else { - // This is a task executed in the parent process. - info("Running task in parent process: " + taskFn.name); - let promiseFinished = new Promise(function (resolve) { - parentScript.addMessageListener("finish_task_" + taskId, resolve); - }); - parentScript.sendAsyncMessage("start_task_" + taskId); - yield promiseFinished; - info("Finished task in parent process: " + taskFn.name); - } - } - } catch (ex) { - ok(false, ex); - } - - SimpleTest.finish(); - }); -}); - -// Wait for the test script to be loaded in the parent process. This means that -// test tasks are registered and ready, but have not been executed yet. -add_task(function* wait_loading_in_parent_process() { - yield promiseParentInitFinished; -}); - -var headUrl = SimpleTest.getTestFileURL("head_common.js"); -Services.scriptloader.loadSubScript(headUrl, this); - -Output.print("Loading test file: " + testUrl); -Services.scriptloader.loadSubScript(testUrl, this); - -// Register the execution of termination tasks after all other tasks. -add_task(terminationTaskFn); -add_task_in_parent_process(terminationTaskFn, terminationTaskFn.name); - -SimpleTest.waitForExplicitFinish(); - -// Reminder: unless you are adding new features to the framework, you shouldn't -// have to modify this file. Use "head_common.js" or "head.js" for shared code. |