зеркало из https://github.com/mozilla/gecko-dev.git
Bug 974747 intermittents, split up and simplify some tests,r=me
This commit is contained in:
Родитель
6ed2708de0
Коммит
32793c683c
|
@ -13,6 +13,7 @@ support-files =
|
|||
share.html
|
||||
share_activate.html
|
||||
social_activate.html
|
||||
social_activate_basic.html
|
||||
social_activate_iframe.html
|
||||
social_chat.html
|
||||
social_crash_content_helper.js
|
||||
|
@ -45,6 +46,7 @@ skip-if = (os == 'linux' && e10s) # Bug 1072669 context menu relies on target el
|
|||
[browser_social_flyout.js]
|
||||
[browser_social_isVisible.js]
|
||||
[browser_social_marks.js]
|
||||
[browser_social_marks_context.js]
|
||||
[browser_social_multiprovider.js]
|
||||
[browser_social_multiworker.js]
|
||||
[browser_social_perwindowPB.js]
|
||||
|
|
|
@ -67,7 +67,7 @@ function sendActivationEvent(tab, callback, nullManifest) {
|
|||
}
|
||||
|
||||
function activateProvider(domain, callback, nullManifest) {
|
||||
let activationURL = domain+"/browser/browser/base/content/test/social/social_activate.html"
|
||||
let activationURL = domain+"/browser/browser/base/content/test/social/social_activate_basic.html"
|
||||
addTab(activationURL, function(tab) {
|
||||
sendActivationEvent(tab, callback, nullManifest);
|
||||
});
|
||||
|
@ -263,7 +263,7 @@ var tests = {
|
|||
info("first activation completed");
|
||||
is(gBrowser.contentDocument.location.href, gProviders[0].origin + "/browser/browser/base/content/test/social/social_postActivation.html", "postActivationURL loaded");
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
is(gBrowser.contentDocument.location.href, gProviders[0].origin + "/browser/browser/base/content/test/social/social_activate.html", "activation page selected");
|
||||
is(gBrowser.contentDocument.location.href, gProviders[0].origin + "/browser/browser/base/content/test/social/social_activate_basic.html", "activation page selected");
|
||||
gBrowser.removeTab(gBrowser.selectedTab);
|
||||
tabsToRemove.pop();
|
||||
// uninstall the provider
|
||||
|
|
|
@ -4,13 +4,6 @@
|
|||
|
||||
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
|
||||
|
||||
let manifest = { // builtin provider
|
||||
name: "provider example.com",
|
||||
origin: "https://example.com",
|
||||
sidebarURL: "https://example.com/browser/browser/base/content/test/social/social_sidebar.html",
|
||||
workerURL: "https://example.com/browser/browser/base/content/test/social/social_worker.js",
|
||||
iconURL: "https://example.com/browser/browser/base/content/test/general/moz.png"
|
||||
};
|
||||
let manifest2 = { // used for testing install
|
||||
name: "provider test1",
|
||||
origin: "https://test1.example.com",
|
||||
|
@ -29,34 +22,14 @@ let manifest3 = { // used for testing install
|
|||
iconURL: "https://test2.example.com/browser/browser/base/content/test/general/moz.png",
|
||||
version: 1
|
||||
};
|
||||
function makeMarkProvider(origin) {
|
||||
return { // used for testing install
|
||||
name: "mark provider " + origin,
|
||||
origin: "https://" + origin + ".example.com",
|
||||
workerURL: "https://" + origin + ".example.com/browser/browser/base/content/test/social/social_worker.js",
|
||||
markURL: "https://" + origin + ".example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
|
||||
markedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/unchecked.jpg",
|
||||
unmarkedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/checked.jpg",
|
||||
|
||||
iconURL: "https://" + origin + ".example.com/browser/browser/base/content/test/general/moz.png",
|
||||
version: 1
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
let toolbar = document.getElementById("nav-bar");
|
||||
let currentsetAtStart = toolbar.currentSet;
|
||||
runSocialTestWithProvider(manifest, function (finishcb) {
|
||||
runSocialTests(tests, undefined, undefined, function () {
|
||||
Services.prefs.clearUserPref("social.remote-install.enabled");
|
||||
// just in case the tests failed, clear these here as well
|
||||
Services.prefs.clearUserPref("social.whitelist");
|
||||
ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
|
||||
CustomizableUI.reset();
|
||||
finishcb();
|
||||
});
|
||||
runSocialTests(tests, undefined, undefined, function () {
|
||||
ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
|
||||
CustomizableUI.reset();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -110,8 +83,7 @@ var tests = {
|
|||
let widget = CustomizableUI.getWidget(id);
|
||||
ok(!widget || !widget.forWindow(window).node, "no button added to widget set");
|
||||
Social.uninstallProvider(manifest3.origin, function() {
|
||||
gBrowser.removeTab(tab);
|
||||
next();
|
||||
ensureBrowserTabClosed(tab).then(next);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -152,8 +124,7 @@ var tests = {
|
|||
is(button.hidden, false, "mark button is visible");
|
||||
|
||||
checkSocialUI(window);
|
||||
gBrowser.removeTab(tab);
|
||||
next();
|
||||
ensureBrowserTabClosed(tab).then(next);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -327,85 +298,5 @@ var tests = {
|
|||
Social.uninstallProvider(manifest2.origin, next);
|
||||
}, "button does not exist after disabling the provider");
|
||||
});
|
||||
},
|
||||
|
||||
testContextSubmenu: function(next) {
|
||||
// install 4 providers to test that the menu's are added as submenus
|
||||
let manifests = [
|
||||
makeMarkProvider("sub1.test1"),
|
||||
makeMarkProvider("sub2.test1"),
|
||||
makeMarkProvider("sub1.test2"),
|
||||
makeMarkProvider("sub2.test2")
|
||||
];
|
||||
let installed = [];
|
||||
let markLinkMenu = document.getElementById("context-marklinkMenu").firstChild;
|
||||
let markPageMenu = document.getElementById("context-markpageMenu").firstChild;
|
||||
|
||||
function addProviders(callback) {
|
||||
let manifest = manifests.pop();
|
||||
if (!manifest) {
|
||||
info("INSTALLATION FINISHED");
|
||||
executeSoon(callback);
|
||||
return;
|
||||
}
|
||||
info("INSTALLING " + manifest.origin);
|
||||
let panel = document.getElementById("servicesInstall-notification");
|
||||
ensureEventFired(PopupNotifications.panel, "popupshown").then(() => {
|
||||
info("servicesInstall-notification panel opened");
|
||||
panel.button.click();
|
||||
});
|
||||
|
||||
let activationURL = manifest.origin + "/browser/browser/base/content/test/social/social_activate.html"
|
||||
let id = SocialMarks._toolbarHelper.idFromOrigin(manifest.origin);
|
||||
let toolbar = document.getElementById("nav-bar");
|
||||
addTab(activationURL, function(tab) {
|
||||
let doc = tab.linkedBrowser.contentDocument;
|
||||
let data = {
|
||||
origin: doc.nodePrincipal.origin,
|
||||
url: doc.location.href,
|
||||
manifest: manifest,
|
||||
window: window
|
||||
}
|
||||
|
||||
Social.installProvider(data, function(addonManifest) {
|
||||
// enable the provider so we know the button would have appeared
|
||||
SocialService.enableProvider(manifest.origin, function(provider) {
|
||||
waitForCondition(function() { return CustomizableUI.getWidget(id) },
|
||||
function() {
|
||||
gBrowser.removeTab(tab);
|
||||
installed.push(manifest.origin);
|
||||
// checkSocialUI will properly check where the menus are located
|
||||
checkSocialUI(window);
|
||||
executeSoon(function() {
|
||||
addProviders(callback);
|
||||
});
|
||||
}, "button exists after enabling social");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function removeProviders(callback) {
|
||||
let origin = installed.pop();
|
||||
if (!origin) {
|
||||
executeSoon(callback);
|
||||
return;
|
||||
}
|
||||
Social.uninstallProvider(origin, function(provider) {
|
||||
executeSoon(function() {
|
||||
removeProviders(callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addProviders(function() {
|
||||
removeProviders(function() {
|
||||
is(SocialMarks.getProviders().length, 0, "mark providers removed");
|
||||
is(markLinkMenu.childNodes.length, 0, "marklink menu ok");
|
||||
is(markPageMenu.childNodes.length, 0, "markpage menu ok");
|
||||
checkSocialUI(window);
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,105 @@
|
|||
let SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
|
||||
|
||||
function makeMarkProvider(origin) {
|
||||
return { // used for testing install
|
||||
name: "mark provider " + origin,
|
||||
origin: "https://" + origin + ".example.com",
|
||||
markURL: "https://" + origin + ".example.com/browser/browser/base/content/test/social/social_mark.html?url=%{url}",
|
||||
markedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/unchecked.jpg",
|
||||
unmarkedIcon: "https://" + origin + ".example.com/browser/browser/base/content/test/social/checked.jpg",
|
||||
iconURL: "https://" + origin + ".example.com/browser/browser/base/content/test/general/moz.png",
|
||||
version: 1
|
||||
}
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
|
||||
runSocialTests(tests, undefined, undefined, function () {
|
||||
ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
|
||||
CustomizableUI.reset();
|
||||
finish();
|
||||
});
|
||||
}
|
||||
|
||||
var tests = {
|
||||
testContextSubmenu: function(next) {
|
||||
// install 4 providers to test that the menu's are added as submenus
|
||||
let manifests = [
|
||||
makeMarkProvider("sub1.test1"),
|
||||
makeMarkProvider("sub2.test1"),
|
||||
makeMarkProvider("sub1.test2"),
|
||||
makeMarkProvider("sub2.test2")
|
||||
];
|
||||
let installed = [];
|
||||
let markLinkMenu = document.getElementById("context-marklinkMenu").firstChild;
|
||||
let markPageMenu = document.getElementById("context-markpageMenu").firstChild;
|
||||
|
||||
function addProviders(callback) {
|
||||
let manifest = manifests.pop();
|
||||
if (!manifest) {
|
||||
info("INSTALLATION FINISHED");
|
||||
executeSoon(callback);
|
||||
return;
|
||||
}
|
||||
info("INSTALLING " + manifest.origin);
|
||||
let panel = document.getElementById("servicesInstall-notification");
|
||||
ensureEventFired(PopupNotifications.panel, "popupshown").then(() => {
|
||||
info("servicesInstall-notification panel opened");
|
||||
panel.button.click();
|
||||
});
|
||||
|
||||
let activationURL = manifest.origin + "/browser/browser/base/content/test/social/social_activate.html"
|
||||
let id = SocialMarks._toolbarHelper.idFromOrigin(manifest.origin);
|
||||
let toolbar = document.getElementById("nav-bar");
|
||||
addTab(activationURL, function(tab) {
|
||||
let doc = tab.linkedBrowser.contentDocument;
|
||||
let data = {
|
||||
origin: doc.nodePrincipal.origin,
|
||||
url: doc.location.href,
|
||||
manifest: manifest,
|
||||
window: window
|
||||
}
|
||||
|
||||
Social.installProvider(data, function(addonManifest) {
|
||||
// enable the provider so we know the button would have appeared
|
||||
SocialService.enableProvider(manifest.origin, function(provider) {
|
||||
waitForCondition(function() { return CustomizableUI.getWidget(id) },
|
||||
function() {
|
||||
gBrowser.removeTab(tab);
|
||||
installed.push(manifest.origin);
|
||||
// checkSocialUI will properly check where the menus are located
|
||||
checkSocialUI(window);
|
||||
executeSoon(function() {
|
||||
addProviders(callback);
|
||||
});
|
||||
}, "button exists after enabling social");
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function removeProviders(callback) {
|
||||
let origin = installed.pop();
|
||||
if (!origin) {
|
||||
executeSoon(callback);
|
||||
return;
|
||||
}
|
||||
Social.uninstallProvider(origin, function(provider) {
|
||||
executeSoon(function() {
|
||||
removeProviders(callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
addProviders(function() {
|
||||
removeProviders(function() {
|
||||
is(SocialMarks.getProviders().length, 0, "mark providers removed");
|
||||
is(markLinkMenu.childNodes.length, 0, "marklink menu ok");
|
||||
is(markPageMenu.childNodes.length, 0, "markpage menu ok");
|
||||
checkSocialUI(window);
|
||||
next();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Activation test</title>
|
||||
</head>
|
||||
<script>
|
||||
// icons from http://findicons.com/icon/158311/firefox?id=356182 by ipapun
|
||||
var data = {
|
||||
// currently required
|
||||
"name": "Demo Social Service",
|
||||
"iconURL": "chrome://branding/content/icon16.png",
|
||||
"icon32URL": "chrome://branding/content/favicon32.png",
|
||||
"icon64URL": "chrome://branding/content/icon64.png",
|
||||
|
||||
// at least one of these must be defined
|
||||
"sidebarURL": "/browser/browser/base/content/test/social/social_sidebar_empty.html",
|
||||
"postActivationURL": "/browser/browser/base/content/test/social/social_postActivation.html",
|
||||
|
||||
// should be available for display purposes
|
||||
"description": "A short paragraph about this provider",
|
||||
"author": "Shane Caraveo, Mozilla",
|
||||
|
||||
// optional
|
||||
"version": 1
|
||||
}
|
||||
|
||||
function activate(node) {
|
||||
node.setAttribute("data-service", JSON.stringify(data));
|
||||
var event = new CustomEvent("ActivateSocialFeature");
|
||||
node.dispatchEvent(event);
|
||||
}
|
||||
|
||||
</script>
|
||||
<body>
|
||||
|
||||
nothing to see here
|
||||
|
||||
<button id="activation" onclick="activate(this)">Activate The Demo Provider</button>
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<body>
|
||||
|
||||
<iframe src="social_activate.html"/>
|
||||
<iframe src="social_activate_basic.html"/>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче