Backed out changeset bfe0d5c41edd (bug 1014332)

This commit is contained in:
Ed Morley 2014-08-21 12:27:12 +01:00
parent 428a1c7d2b
commit 1e166e3cd3
3 changed files with 14 additions and 29 deletions

View File

@ -19,7 +19,7 @@ let snippet =
' "iconURL": "chrome://branding/content/icon16.png",' +
' "icon32URL": "chrome://branding/content/favicon32.png",' +
' "icon64URL": "chrome://branding/content/icon64.png",' +
' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",' +
' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",' +
' "postActivationURL": "https://example.com/browser/browser/base/content/test/social/social_postActivation.html",' +
' };' +
' function activateProvider(node) {' +
@ -41,7 +41,7 @@ let snippet2 =
' "iconURL": "chrome://branding/content/icon16.png",' +
' "icon32URL": "chrome://branding/content/favicon32.png",' +
' "icon64URL": "chrome://branding/content/icon64.png",' +
' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar_empty.html",' +
' "sidebarURL": "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",' +
' "postActivationURL": "https://example.com/browser/browser/base/content/test/social/social_postActivation.html",' +
' "oneclick": true' +
' };' +

View File

@ -34,6 +34,7 @@ function openChat(provider, callback) {
let port = provider.getWorkerPort();
port.onmessage = function(e) {
if (e.data.topic == "got-chatbox-message") {
port.close();
callback();
}
}
@ -41,7 +42,6 @@ function openChat(provider, callback) {
port.postMessage({topic: "test-init"});
port.postMessage({topic: "test-worker-chat", data: url});
gURLsNotRemembered.push(url);
return port;
}
function windowHasChats(win) {
@ -172,9 +172,6 @@ var tests = {
let num = 0;
is(chatbar.childNodes.length, 0, "chatbar starting empty");
is(chatbar.menupopup.childNodes.length, 0, "popup starting empty");
let port = SocialSidebar.provider.getWorkerPort();
ok(port, "provider has a port");
port.postMessage({topic: "test-init"});
makeChat("normal", "first chat", function() {
// got the first one.
@ -198,7 +195,6 @@ var tests = {
chatbar.selectedChat.close();
is(chatbar.selectedChat, second, "second chat is selected");
closeAllChats();
port.close();
next();
});
});
@ -247,24 +243,24 @@ var tests = {
testMultipleProviderChat: function(next) {
// test incomming chats from all providers
let port0 = openChat(Social.providers[0], function() {
let port1 = openChat(Social.providers[1], function() {
let port2 = openChat(Social.providers[2], function() {
openChat(Social.providers[0], function() {
openChat(Social.providers[1], function() {
openChat(Social.providers[2], function() {
let chats = document.getElementById("pinnedchats");
waitForCondition(function() chats.children.length == Social.providers.length,
function() {
ok(true, "one chat window per provider opened");
// test logout of a single provider
port2.postMessage({topic: "test-logout"});
let provider = Social.providers[2];
let port = provider.getWorkerPort();
port.postMessage({topic: "test-logout"});
waitForCondition(function() chats.children.length == Social.providers.length - 1,
function() {
closeAllChats();
waitForCondition(function() chats.children.length == 0,
function() {
ok(!chats.selectedChat, "multiprovider chats are all closed");
port0.close();
port1.close();
port2.close();
port.close();
next();
},
"chat windows didn't close");

View File

@ -36,16 +36,10 @@ function goOnline(callback) {
function openPanel(url, panelCallback, loadCallback) {
// open a flyout
SocialFlyout.open(url, 0, panelCallback);
// wait for both open and loaded before callback. Since the test doesn't close
// the panel between opens, we cannot rely on events here. We need to ensure
// popupshown happens before we finish out the tests.
waitForCondition(function() {
return SocialFlyout.panel.state == "open" &&
SocialFlyout.iframe.contentDocument.readyState == "complete";
},
loadCallback,
"flyout is open and loaded");
SocialFlyout.panel.firstChild.addEventListener("load", function panelLoad() {
SocialFlyout.panel.firstChild.removeEventListener("load", panelLoad, true);
loadCallback();
}, true);
}
function openChat(url, panelCallback, loadCallback) {
@ -189,10 +183,6 @@ var tests = {
// Ensure that the error listener survives the chat window being detached.
let url = "https://example.com/browser/browser/base/content/test/social/social_chat.html";
let panelCallbackCount = 0;
// chatwindow tests throw errors, which muddy test output, if the worker
// doesn't get test-init
let port = SocialSidebar.provider.getWorkerPort();
port.postMessage({topic: "test-init"});
// open a chat while we are still online.
openChat(
url,
@ -210,7 +200,6 @@ var tests = {
waitForCondition(function() chat.contentDocument.location.href.indexOf("about:socialerror?")==0,
function() {
chat.close();
port.close();
next();
},
"error page didn't appear");