зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1268366 - Convert test_formless_submit.html from m-chrome to m-plain. r=dolske
Switch from test1.mochi.test to mochi.test to avoid same-origin policy issues. MozReview-Commit-ID: 7kHJiPPG2dW --HG-- rename : toolkit/components/passwordmgr/test/chrome/test_formless_submit.html => toolkit/components/passwordmgr/test/mochitest/test_formless_submit.html extra : rebase_source : 7355f4de5d4fbeefa0aa9027db95e52489a267f5
This commit is contained in:
Родитель
c379e0b738
Коммит
632af50110
|
@ -1,8 +1,6 @@
|
|||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
|
||||
[test_formless_submit.html]
|
||||
support-files = ../pwmgr_common.js
|
||||
[test_privbrowsing_perwindowpb.html]
|
||||
skip-if = true # Bug 1173337
|
||||
support-files =
|
||||
|
|
|
@ -33,6 +33,8 @@ skip-if = toolkit == 'android' # autocomplete
|
|||
[test_form_action_javascript.html]
|
||||
[test_formless_autofill.html]
|
||||
skip-if = toolkit == 'android' # Bug 1259768
|
||||
[test_formless_submit.html]
|
||||
skip-if = toolkit == 'android' # Bug 1259768
|
||||
[test_input_events.html]
|
||||
[test_input_events_for_identical_values.html]
|
||||
[test_maxlength.html]
|
||||
|
|
|
@ -10,18 +10,27 @@
|
|||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.8">
|
||||
let mm = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
|
||||
let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("loginFrame").addEventListener("load", (evt) => {
|
||||
// Tell the parent to setup test logins.
|
||||
mm.sendAsyncMessage("setupParent", { selfFilling: true });
|
||||
chromeScript.sendAsyncMessage("setupParent", { selfFilling: true });
|
||||
});
|
||||
});
|
||||
|
||||
// When the setup is done, load a recipe for this test.
|
||||
mm.addMessageListener("doneSetup", function doneSetup() {
|
||||
mm.sendAsyncMessage("loadRecipes", {
|
||||
let doneSetupPromise = new Promise(resolve => {
|
||||
// When the setup is done, load a recipe for this test.
|
||||
chromeScript.addMessageListener("doneSetup", function doneSetup() {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
add_task(function* setup() {
|
||||
info("Waiting for loads and setup");
|
||||
yield doneSetupPromise;
|
||||
|
||||
yield loadRecipes({
|
||||
siteRecipes: [{
|
||||
hosts: ["mochi.test:8888"],
|
||||
usernameSelector: "input[name='recipeuname']",
|
||||
|
@ -30,14 +39,6 @@ mm.addMessageListener("doneSetup", function doneSetup() {
|
|||
});
|
||||
});
|
||||
|
||||
let loadedRecipesPromise = new Promise(resolve => {
|
||||
mm.addMessageListener("loadedRecipes", resolve);
|
||||
});
|
||||
|
||||
add_task(function* setup() {
|
||||
yield loadedRecipesPromise;
|
||||
});
|
||||
|
||||
|
||||
const DEFAULT_ORIGIN = "http://mochi.test:8888";
|
||||
const TESTCASES = [
|
||||
|
|
|
@ -3,43 +3,40 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test capturing of fields outside of a form</title>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="/tests/SimpleTest/SpawnTask.js"></script>
|
||||
<script src="pwmgr_common.js"></script>
|
||||
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<script type="application/javascript;version=1.8">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
Cu.import("resource://gre/modules/Task.jsm");
|
||||
const LMCBackstagePass = Cu.import("resource://gre/modules/LoginManagerContent.jsm");
|
||||
const LMCBackstagePass = SpecialPowers.Cu.import("resource://gre/modules/LoginManagerContent.jsm");
|
||||
const { LoginManagerContent, FormLikeFactory } = LMCBackstagePass;
|
||||
|
||||
let parentScriptURL = SimpleTest.getTestFileURL("pwmgr_common.js");
|
||||
let mm = SpecialPowers.loadChromeScript(parentScriptURL);
|
||||
let chromeScript = runInParent(SimpleTest.getTestFileURL("pwmgr_common.js"));
|
||||
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("loginFrame").addEventListener("load", (evt) => {
|
||||
// Tell the parent to setup test logins.
|
||||
mm.sendAsyncMessage("setupParent", { selfFilling: true });
|
||||
let loadPromise = new Promise(resolve => {
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
document.getElementById("loginFrame").addEventListener("load", (evt) => {
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// When the setup is done, load a recipe for this test.
|
||||
mm.addMessageListener("doneSetup", function doneSetup() {
|
||||
mm.sendAsyncMessage("loadRecipes", {
|
||||
add_task(function* setup() {
|
||||
info("Waiting for page and frame loads");
|
||||
yield loadPromise;
|
||||
|
||||
yield loadRecipes({
|
||||
siteRecipes: [{
|
||||
hosts: ["test1.mochi.test:8888"],
|
||||
hosts: ["mochi.test:8888"],
|
||||
usernameSelector: "input[name='recipeuname']",
|
||||
passwordSelector: "input[name='recipepword']",
|
||||
}],
|
||||
});
|
||||
});
|
||||
|
||||
mm.addMessageListener("loadedRecipes", () => runTest());
|
||||
|
||||
const DEFAULT_ORIGIN = "http://test1.mochi.test:8888";
|
||||
const DEFAULT_ORIGIN = "http://mochi.test:8888";
|
||||
const TESTCASES = [
|
||||
{
|
||||
// Inputs
|
||||
|
@ -129,15 +126,15 @@ const TESTCASES = [
|
|||
function getSubmitMessage() {
|
||||
info("getSubmitMessage");
|
||||
return new Promise((resolve, reject) => {
|
||||
mm.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
chromeScript.addMessageListener("formSubmissionProcessed", function processed(...args) {
|
||||
info("got formSubmissionProcessed");
|
||||
mm.removeMessageListener("formSubmissionProcessed", processed);
|
||||
chromeScript.removeMessageListener("formSubmissionProcessed", processed);
|
||||
resolve(...args);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
let runTest = Task.async(function*() {
|
||||
add_task(function* test() {
|
||||
let loginFrame = document.getElementById("loginFrame");
|
||||
let frameDoc = loginFrame.contentWindow.document;
|
||||
|
||||
|
@ -172,8 +169,6 @@ let runTest = Task.async(function*() {
|
|||
is(submittedResult.oldPasswordField.value, tc.oldPasswordFieldValue, "Check oldPasswordFieldValue");
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -181,7 +176,7 @@ let runTest = Task.async(function*() {
|
|||
<p id="display"></p>
|
||||
|
||||
<div id="content">
|
||||
<iframe id="loginFrame" src="http://test1.mochi.test:8888/tests/toolkit/components/passwordmgr/test/blank.html"></iframe>
|
||||
<iframe id="loginFrame" src="http://mochi.test:8888/tests/toolkit/components/passwordmgr/test/blank.html"></iframe>
|
||||
</div>
|
||||
<pre id="test"></pre>
|
||||
</body>
|
|
@ -283,6 +283,7 @@ function promiseFormsProcessed(expectedCount = 1) {
|
|||
}
|
||||
|
||||
function loadRecipes(recipes) {
|
||||
info("Loading recipes");
|
||||
return new Promise(resolve => {
|
||||
chromeScript.addMessageListener("loadedRecipes", function loaded() {
|
||||
chromeScript.removeMessageListener("loadedRecipes", loaded);
|
||||
|
@ -293,6 +294,7 @@ function loadRecipes(recipes) {
|
|||
}
|
||||
|
||||
function resetRecipes() {
|
||||
info("Resetting recipes");
|
||||
return new Promise(resolve => {
|
||||
chromeScript.addMessageListener("recipesReset", function reset() {
|
||||
chromeScript.removeMessageListener("recipesReset", reset);
|
||||
|
|
Загрузка…
Ссылка в новой задаче