Bug 793935 - tests for closing social chat windows on logout. r=jaws

This commit is contained in:
Mark Hammond 2012-09-26 09:32:27 +10:00
parent c356d3cd85
commit 0730c6685f
2 changed files with 22 additions and 0 deletions

View File

@ -115,5 +115,24 @@ var tests = {
}
}
port.postMessage({topic: "test-worker-chat", data: chatUrl});
},
testCloseOnLogout: function(next) {
const chatUrl = "https://example.com/browser/browser/base/content/test/social_chat.html";
let port = Social.provider.getWorkerPort();
ok(port, "provider has a port");
port.postMessage({topic: "test-init"});
port.onmessage = function (e) {
let topic = e.data.topic;
switch (topic) {
case "got-chatbox-message":
ok(true, "got a chat window opened");
port.postMessage({topic: "test-logout"});
waitForCondition(function() document.getElementById("pinnedchats").firstChild == null,
next,
"chat windows didn't close");
break;
}
}
port.postMessage({topic: "test-worker-chat", data: chatUrl});
}
}

View File

@ -13,6 +13,9 @@ onconnect = function(e) {
testPort = port;
port.postMessage({topic: "test-init-done"});
break;
case "test-logout":
apiPort.postMessage({topic: "social.user-profile", data: {}});
break;
case "sidebar-message":
sidebarPort = port;
if (testPort && event.data.result == "ok")