summaryrefslogtreecommitdiffstats
path: root/toolkit/components/formautofill/test/chrome
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-02-25 15:07:00 -0500
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-04-14 12:55:19 +0200
commiteb70e6e3d0bff11c25f14b1196025791bf2308fb (patch)
tree5ef4ce17db83c74d7b05ec12c8f59e095a6dd5bd /toolkit/components/formautofill/test/chrome
parent32ead795290b3399d56b4708fc75b77d296f6a1a (diff)
downloadUXP-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')
-rw-r--r--toolkit/components/formautofill/test/chrome/.eslintrc.js7
-rw-r--r--toolkit/components/formautofill/test/chrome/chrome.ini17
-rw-r--r--toolkit/components/formautofill/test/chrome/head.js15
-rw-r--r--toolkit/components/formautofill/test/chrome/loader.js116
-rw-r--r--toolkit/components/formautofill/test/chrome/loader_parent.js77
-rw-r--r--toolkit/components/formautofill/test/chrome/test_infrastructure.html8
-rw-r--r--toolkit/components/formautofill/test/chrome/test_infrastructure.js61
-rw-r--r--toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.html9
-rw-r--r--toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.js26
9 files changed, 0 insertions, 336 deletions
diff --git a/toolkit/components/formautofill/test/chrome/.eslintrc.js b/toolkit/components/formautofill/test/chrome/.eslintrc.js
deleted file mode 100644
index 8c0f4f574..000000000
--- a/toolkit/components/formautofill/test/chrome/.eslintrc.js
+++ /dev/null
@@ -1,7 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../../testing/mochitest/chrome.eslintrc.js"
- ]
-};
diff --git a/toolkit/components/formautofill/test/chrome/chrome.ini b/toolkit/components/formautofill/test/chrome/chrome.ini
deleted file mode 100644
index 67b7869af..000000000
--- a/toolkit/components/formautofill/test/chrome/chrome.ini
+++ /dev/null
@@ -1,17 +0,0 @@
-[DEFAULT]
-# The following files starting with ".." are installed in the current folder.
-support-files =
- ../head_common.js
- ../loader_common.js
- head.js
- test_infrastructure.js
- test_requestAutocomplete_cancel.js
- loader_parent.js
- loader.js
-
-# For each test defined below, the associated JavaScript file must be declared
-# in the list above. This is required because a "support-files" declaration on
-# the individual test would override the global list instead of adding entries.
-
-[test_infrastructure.html]
-[test_requestAutocomplete_cancel.html]
diff --git a/toolkit/components/formautofill/test/chrome/head.js b/toolkit/components/formautofill/test/chrome/head.js
deleted file mode 100644
index 4110d5e7c..000000000
--- a/toolkit/components/formautofill/test/chrome/head.js
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * Initialization specific to Form Autofill mochitest-chrome tests.
- *
- * This file is loaded by "loader.js".
- */
-
-"use strict";
-
-// The testing framework is fully initialized at this point, you can add
-// mochitest-chrome specific test initialization here. If you need shared
-// functions or initialization that are not specific to mochitest-chrome,
-// consider adding them to "head_common.js" in the parent folder instead.
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.
diff --git a/toolkit/components/formautofill/test/chrome/loader_parent.js b/toolkit/components/formautofill/test/chrome/loader_parent.js
deleted file mode 100644
index bf823218e..000000000
--- a/toolkit/components/formautofill/test/chrome/loader_parent.js
+++ /dev/null
@@ -1,77 +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, always
- * executed in the parent process.
- *
- * 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);
-
-var sharedUrl = "chrome://mochitests/content/chrome/" +
- "toolkit/components/formautofill/test/chrome/loader_common.js";
-Services.scriptloader.loadSubScript(sharedUrl, this);
-
-// Define output functions so they look the same across all frameworks. Since
-// we don't have an output function available here, we report as TEST-PASS.
-var Output = {
- print: message => assert.ok(true, message),
-};
-
-// Define assertion functions so they look the same across all frameworks.
-var Assert = {
- ok: assert.ok,
- equal: assert.equal,
-};
-
-// Define task registration functions, see description in "loader_common.js".
-function add_task_in_parent_process(taskFn, taskIdOverride) {
- let taskId = taskIdOverride || getTaskId(Components.stack.caller);
- Output.print("Registering in the parent process: " + taskId);
- addMessageListener("start_task_" + taskId, function () {
- Task.spawn(function* () {
- try {
- Output.print("Running in the parent process " + taskId);
- yield Task.spawn(taskFn);
- } catch (ex) {
- assert.ok(false, ex);
- }
-
- sendAsyncMessage("finish_task_" + taskId, {});
- });
- });
-}
-var add_task = function () {};
-var add_task_in_child_process = function () {};
-var add_task_in_both_processes = add_task_in_parent_process;
-
-// We need to wait for the child process to send us the path of the test file
-// to load before we can actually start loading it.
-var context = this;
-addMessageListener("start_load_in_parent", function (message) {
- Output.print("Starting loading infrastructure in parent process.");
- let headUrl = "chrome://mochitests/content/chrome/" +
- "toolkit/components/formautofill/test/chrome/head_common.js";
- Services.scriptloader.loadSubScript(headUrl, context);
-
- Services.scriptloader.loadSubScript(message.testUrl, context);
-
- // Register the execution of termination tasks after all other tasks.
- add_task_in_parent_process(terminationTaskFn, terminationTaskFn.name);
-
- Output.print("Finished loading infrastructure in parent process.");
- sendAsyncMessage("finish_load_in_parent", {});
-});
-
-// 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.
diff --git a/toolkit/components/formautofill/test/chrome/test_infrastructure.html b/toolkit/components/formautofill/test/chrome/test_infrastructure.html
deleted file mode 100644
index 54f417f77..000000000
--- a/toolkit/components/formautofill/test/chrome/test_infrastructure.html
+++ /dev/null
@@ -1,8 +0,0 @@
-<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>
-<script type="application/javascript;version=1.7" src="loader.js"></script>
-<!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<p id="paragraph">Paragraph contents.</p>
-
-</body></html>
diff --git a/toolkit/components/formautofill/test/chrome/test_infrastructure.js b/toolkit/components/formautofill/test/chrome/test_infrastructure.js
deleted file mode 100644
index c3b0b43ff..000000000
--- a/toolkit/components/formautofill/test/chrome/test_infrastructure.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * Tests the local testing infrastructure.
- */
-
-"use strict";
-
-/**
- * Tests the truth assertion function.
- */
-add_task(function* test_assert_truth() {
- Assert.ok(1 != 2);
-});
-
-/**
- * Tests the equality assertion function.
- */
-add_task(function* test_assert_equality() {
- Assert.equal(1 + 1, 2);
-});
-
-/**
- * Uses some of the utility functions provided by the framework.
- */
-add_task(function* test_utility_functions() {
- // The "print" function is useful to log information that is not known before.
- let randomString = "R" + Math.floor(Math.random() * 10);
- Output.print("The random contents will be '" + randomString + "'.");
-
- // Create the text file with the random contents.
- let path = yield TestUtils.getTempFile("test-infrastructure.txt");
- yield OS.File.writeAtomic(path, new TextEncoder().encode(randomString));
-
- // Test a few utility functions.
- yield TestUtils.waitForTick();
- yield TestUtils.waitMs(50);
-
- let promiseMyNotification = TestUtils.waitForNotification("my-topic");
- Services.obs.notifyObservers(null, "my-topic", "");
- yield promiseMyNotification;
-
- // Check the file size. The file will be deleted automatically later.
- Assert.equal((yield OS.File.stat(path)).size, randomString.length);
-});
-
-/**
- * This type of test has access to the content declared above.
- */
-add_task(function* test_content() {
- Assert.equal($("paragraph").innerHTML, "Paragraph contents.");
-
- let promiseMyEvent = TestUtils.waitForEvent($("paragraph"), "MyEvent");
-
- let event = document.createEvent("CustomEvent");
- event.initCustomEvent("MyEvent", true, false, {});
- $("paragraph").dispatchEvent(event);
-
- yield promiseMyEvent;
-});
diff --git a/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.html b/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.html
deleted file mode 100644
index 8ae7ffd4b..000000000
--- a/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.html
+++ /dev/null
@@ -1,9 +0,0 @@
-<!DOCTYPE html><html><head><meta charset="utf-8"></head><body>
-<script type="application/javascript;version=1.7" src="loader.js"></script>
-<!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
-
-<form id="form">
-</form>
-
-</body></html>
diff --git a/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.js b/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.js
deleted file mode 100644
index 1ee12bd9a..000000000
--- a/toolkit/components/formautofill/test/chrome/test_requestAutocomplete_cancel.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/*
- * Tests the response sent when requestAutocomplete is canceled by the user.
- */
-
-"use strict";
-
-/**
- * The requestAutocomplete UI will not be displayed during these tests.
- */
-add_task_in_parent_process(function* test_cancel_init() {
- FormAutofillTest.requestAutocompleteResponse = { canceled: true };
-});
-
-/**
- * Tests the case where the feature is canceled.
- */
-add_task(function* test_cancel() {
- let promise = TestUtils.waitForEvent($("form"), "autocompleteerror");
- $("form").requestAutocomplete();
- let errorEvent = yield promise;
-
- Assert.equal(errorEvent.reason, "cancel");
-});