--- a/browser/base/content/test/general/accounts_testRemoteCommands.html
+++ b/browser/base/content/test/general/accounts_testRemoteCommands.html
@@ -14,24 +14,41 @@ function init() {
function checkStatusValue(payload, expectedValue) {
return payload.status == expectedValue;
}
let tests = [
{
info: "Check account verification",
event: "verified",
+ data: {
+ email: "foo@example.com",
+ uid: "1234@lcip.org",
+ assertion: "foobar",
+ sessionToken: "dead",
+ kA: "beef",
+ kB: "cafe",
+ },
payloadType: "message",
validateResponse: function(payload) {
return checkStatusValue(payload, "verified");
},
},
{
info: "Check account log in",
event: "login",
+ data: {
+ email: "foo@example.com",
+ uid: "1234@lcip.org",
+ assertion: "foobar",
+ sessionToken: "dead",
+ kA: "beef",
+ kB: "cafe",
+ isVerified: true
+ },
payloadType: "message",
validateResponse: function(payload) {
return checkStatusValue(payload, "login");
},
},
];
let currentTest = -1;
@@ -48,33 +65,33 @@ function doTest(evt) {
let pass = false;
try {
pass = test.validateResponse(evt.data.content)
} catch (e) {}
reportResult(test.info, pass, error);
}
// start the next test if there are any left
if (tests[++currentTest])
- sendToBrowser(tests[currentTest].event);
+ sendToBrowser(tests[currentTest].event, tests[currentTest].data);
else
reportFinished();
}
function reportResult(info, pass, error) {
let data = {type: "testResult", info: info, pass: pass, error: error};
window.parent.postMessage(data, "*");
}
function reportFinished(cmd) {
let data = {type: "testsComplete", count: tests.length};
window.parent.postMessage(data, "*");
}
-function sendToBrowser(type) {
- let event = new CustomEvent("FirefoxAccountsCommand", {detail: {command: type, data: {}}, bubbles: true});
+function sendToBrowser(type, data) {
+ let event = new CustomEvent("FirefoxAccountsCommand", {detail: {command: type, data: data}, bubbles: true});
document.dispatchEvent(event);
}
</script>
</head>
<body onload="init()">
</body>
</html>