Get browser-aboutAccounts test working.
authorMark Hammond <mhammond@skippinet.com.au>
Tue, 17 Dec 2013 15:45:02 +1100
changeset 161635 bea6a04adfe895fcc777fb5c2cb26e98ce1dd74b
parent 161634 1b9829ecb1ce7222394b962d97383aec2b4a1e2f
child 161636 50fef04086e9b41d7cdd73b8be1ee8f8d25fd762
push idunknown
push userunknown
push dateunknown
milestone29.0a1
Get browser-aboutAccounts test working.
browser/base/content/test/general/accounts_testRemoteCommands.html
--- 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>