2012-08-23 17:11:02 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
function test() {
|
|
|
|
waitForExplicitFinish();
|
|
|
|
|
|
|
|
let manifest = { // normal provider
|
|
|
|
name: "provider 1",
|
|
|
|
origin: "https://example.com",
|
|
|
|
sidebarURL: "https://example.com/browser/browser/base/content/test/social_sidebar.html",
|
|
|
|
workerURL: "https://example.com/browser/browser/base/content/test/social_worker.js",
|
|
|
|
iconURL: "chrome://branding/content/icon48.png"
|
|
|
|
};
|
|
|
|
runSocialTestWithProvider(manifest, function (finishcb) {
|
|
|
|
runSocialTests(tests, undefined, undefined, finishcb);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
var tests = {
|
|
|
|
testOpenCloseFlyout: function(next) {
|
|
|
|
let panel = document.getElementById("social-flyout-panel");
|
2012-09-11 19:48:38 -07:00
|
|
|
let port = Social.provider.getWorkerPort();
|
2012-08-23 17:11:02 -07:00
|
|
|
ok(port, "provider has a port");
|
|
|
|
port.onmessage = function (e) {
|
|
|
|
let topic = e.data.topic;
|
|
|
|
switch (topic) {
|
|
|
|
case "got-sidebar-message":
|
|
|
|
port.postMessage({topic: "test-flyout-open"});
|
|
|
|
break;
|
|
|
|
case "got-flyout-visibility":
|
|
|
|
if (e.data.result == "hidden") {
|
|
|
|
ok(true, "flyout visibility is 'hidden'");
|
2012-09-11 19:48:38 -07:00
|
|
|
port.close();
|
2012-08-23 17:11:02 -07:00
|
|
|
next();
|
|
|
|
} else if (e.data.result == "shown") {
|
|
|
|
ok(true, "flyout visibility is 'shown");
|
|
|
|
panel.hidePopup();
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case "got-flyout-message":
|
|
|
|
ok(e.data.result == "ok", "got flyout message");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
port.postMessage({topic: "test-init"});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|