summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/browser/browser_details.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_details.js')
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_details.js307
1 files changed, 9 insertions, 298 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_details.js b/toolkit/mozapps/extensions/test/browser/browser_details.js
index ce4c51b5a..7394c87da 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_details.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_details.js
@@ -4,12 +4,9 @@
// Tests various aspects of the details view
-const { REQUIRE_SIGNING } = Components.utils.import("resource://gre/modules/addons/AddonConstants.jsm", {});
-
-const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault";
+const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault"
const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url";
const SEARCH_URL = TESTROOT + "browser_details.xml";
-const PREF_EM_HOTFIX_ID = "extensions.hotfix.id";
var gManagerWindow;
var gCategoryUtilities;
@@ -17,8 +14,9 @@ var gProvider;
var gApp = document.getElementById("bundle_brand").getString("brandShortName");
var gVersion = Services.appinfo.version;
+var gBlocklistURL = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL");
+var gPluginURL = Services.urlFormatter.formatURLPref("plugins.update.url");
var gDate = new Date(2010, 7, 1);
-var infoURL = Services.urlFormatter.formatURLPref("app.support.baseURL") + "unsigned-addons";
function open_details(aId, aType, aCallback) {
requestLongerTimeout(2);
@@ -49,7 +47,6 @@ function test() {
// Turn on searching for this test
Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15);
Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, SEARCH_URL);
- Services.prefs.setCharPref(PREF_EM_HOTFIX_ID, "hotfix@tests.mozilla.org");
waitForExplicitFinish();
@@ -144,33 +141,6 @@ function test() {
blocklistURL: "http://example.com/addon8@tests.mozilla.org",
name: "Test add-on 8",
blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED
- }, {
- id: "addon9@tests.mozilla.org",
- name: "Test add-on 9",
- signedState: AddonManager.SIGNEDSTATE_MISSING,
- }, {
- id: "addon10@tests.mozilla.org",
- name: "Test add-on 10",
- signedState: AddonManager.SIGNEDSTATE_MISSING,
- isActive: false,
- appDisabled: true,
- isCompatible: false,
- }, {
- id: "addon11@tests.mozilla.org",
- name: "Test add-on 11",
- signedState: AddonManager.SIGNEDSTATE_PRELIMINARY,
- foreignInstall: true,
- isActive: false,
- appDisabled: true,
- isCompatible: false,
- }, {
- id: "addon12@tests.mozilla.org",
- name: "Test add-on 12",
- signedState: AddonManager.SIGNEDSTATE_SIGNED,
- foreignInstall: true,
- }, {
- id: "hotfix@tests.mozilla.org",
- name: "Test hotfix 1",
}]);
open_manager(null, function(aWindow) {
@@ -182,7 +152,6 @@ function test() {
}
function end_test() {
- Services.prefs.clearUserPref(PREF_EM_HOTFIX_ID);
close_manager(gManagerWindow, function() {
finish();
});
@@ -196,7 +165,7 @@ add_test(function() {
is(get("detail-version").value, "2.1", "Version should be correct");
is(get("detail-icon").src, "chrome://foo/skin/icon64.png", "Icon should be correct");
is_element_hidden(get("detail-creator"), "Creator should be hidden");
- is_element_hidden(get("detail-screenshot-box"), "Screenshot should be hidden");
+ is_element_hidden(get("detail-screenshot"), "Screenshot should be hidden");
is(get("detail-screenshot").width, "", "Screenshot dimensions should not be set");
is(get("detail-screenshot").height, "", "Screenshot dimensions should not be set");
is(get("detail-desc").textContent, "Short description", "Description should be correct");
@@ -303,7 +272,7 @@ add_test(function() {
is(get("detail-creator")._creatorName.value, "Mozilla", "Creator should be correct");
is_element_hidden(get("detail-creator")._creatorLink, "Creator link should be hidden");
- is_element_visible(get("detail-screenshot-box"), "Screenshot should be visible");
+ is_element_visible(get("detail-screenshot"), "Screenshot should be visible");
is(get("detail-screenshot").src, "chrome://branding/content/about.png", "Should be showing the full sized screenshot");
is(get("detail-screenshot").width, 200, "Screenshot dimensions should be set");
is(get("detail-screenshot").height, 150, "Screenshot dimensions should be set");
@@ -360,7 +329,7 @@ add_test(function() {
is(get("detail-creator")._creatorLink.value, "Mozilla", "Creator link should be correct");
is(get("detail-creator")._creatorLink.href, "http://www.mozilla.org", "Creator link href should be correct");
- is_element_visible(get("detail-screenshot-box"), "Screenshot should be visible");
+ is_element_visible(get("detail-screenshot"), "Screenshot should be visible");
is(get("detail-screenshot").src, "chrome://branding/content/icon64.png", "Should be showing the thumbnail");
is(get("detail-screenshot").width, 160, "Screenshot dimensions should be set");
is(get("detail-screenshot").height, 120, "Screenshot dimensions should be set");
@@ -657,7 +626,7 @@ add_test(function() {
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
- is(get("detail-warning-link").href, "http://example.com/addon8@tests.mozilla.org", "Warning link should be correct");
+ is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
@@ -701,7 +670,7 @@ add_test(function() {
is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct");
is_element_visible(get("detail-warning-link"), "Warning link should be visible");
is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct");
- is(get("detail-warning-link").href, "http://example.com/addon8@tests.mozilla.org", "Warning link should be correct");
+ is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct");
is_element_hidden(get("detail-error"), "Error message should be hidden");
is_element_hidden(get("detail-error-link"), "Error link should be hidden");
is_element_hidden(get("detail-pending"), "Pending message should be hidden");
@@ -711,264 +680,6 @@ add_test(function() {
});
});
-// These tests are only appropriate when signing can be turned off
-if (!REQUIRE_SIGNING) {
- // Opens and tests the details view for add-on 9
- add_test(function() {
- open_details("addon9@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 9", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
- is_element_visible(get("detail-warning"), "Error message should be visible");
- is(get("detail-warning").textContent, "Test add-on 9 could not be verified for use in " + gApp + ". Proceed with caution.", "Warning message should be correct");
- is_element_visible(get("detail-warning-link"), "Warning link should be visible");
- is(get("detail-warning-link").value, "More Information", "Warning link text should be correct");
- is(get("detail-warning-link").href, infoURL, "Warning link should be correct");
- is_element_hidden(get("detail-pending"), "Pending message should be hidden");
-
- run_next_test();
- });
- });
-}
-
-// Opens and tests the details view for add-on 9 with signing required
-add_test(function() {
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", true);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- open_details("addon9@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 9", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-warning"), "Warning message should be hidden");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_visible(get("detail-error"), "Error message should be visible");
- is(get("detail-error").textContent, "Test add-on 9 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
- is_element_visible(get("detail-error-link"), "Error link should be visible");
- is(get("detail-error-link").value, "More Information", "Error link text should be correct");
- is(get("detail-error-link").href, infoURL, "Error link should be correct");
-
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", false);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- run_next_test();
- });
- });
- });
- });
- });
-});
-
-// These tests are only appropriate when signing can be turned off
-if (!REQUIRE_SIGNING) {
- // Opens and tests the details view for add-on 10
- add_test(function() {
- open_details("addon10@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 10", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_visible(get("detail-warning"), "Warning message should be visible");
- is(get("detail-warning").textContent, "Test add-on 10 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
- is_element_hidden(get("detail-pending"), "Pending message should be hidden");
-
- run_next_test();
- });
- });
-}
-
-// Opens and tests the details view for add-on 10 with signing required
-add_test(function() {
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", true);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- open_details("addon10@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 10", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-warning"), "Warning message should be hidden");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_visible(get("detail-error"), "Error message should be visible");
- is(get("detail-error").textContent, "Test add-on 10 could not be verified for use in " + gApp + " and has been disabled.", "Error message should be correct");
- is_element_visible(get("detail-error-link"), "Error link should be visible");
- is(get("detail-error-link").value, "More Information", "Error link text should be correct");
- is(get("detail-error-link").href, infoURL, "Error link should be correct");
-
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", false);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- run_next_test();
- });
- });
- });
- });
- });
-});
-
-// Opens and tests the details view for add-on 11
-add_test(function() {
- open_details("addon11@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 11", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_visible(get("detail-warning"), "Warning message should be visible");
- is(get("detail-warning").textContent, "Test add-on 11 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
- is_element_hidden(get("detail-pending"), "Pending message should be hidden");
-
- run_next_test();
- });
-});
-
-// Opens and tests the details view for add-on 11 with signing required
-add_test(function() {
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", true);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- open_details("addon11@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 11", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_visible(get("detail-warning"), "Warning message should be visible");
- is(get("detail-warning").textContent, "Test add-on 11 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
-
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", false);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- run_next_test();
- });
- });
- });
- });
- });
-});
-
-// Opens and tests the details view for add-on 12
-add_test(function() {
- open_details("addon12@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 12", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-warning"), "Warning message should be hidden");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
- is_element_hidden(get("detail-pending"), "Pending message should be hidden");
-
- run_next_test();
- });
-});
-
-// Opens and tests the details view for add-on 12 with signing required
-add_test(function() {
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", true);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- open_details("addon12@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test add-on 12", "Name should be correct");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-warning"), "Warning message should be hidden");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-error"), "Error message should be hidden");
- is_element_hidden(get("detail-error-link"), "Error link should be hidden");
-
- close_manager(gManagerWindow, function() {
- Services.prefs.setBoolPref("xpinstall.signatures.required", false);
- open_manager(null, function(aWindow) {
- gManagerWindow = aWindow;
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- run_next_test();
- });
- });
- });
- });
- });
-});
-
-// Opens and tests the details view for hotfix 1
-add_test(function() {
- open_details("hotfix@tests.mozilla.org", "extension", function() {
- is(get("detail-name").textContent, "Test hotfix 1", "Name should be correct");
-
- is_element_hidden(get("detail-updates-row"), "Updates should be hidden");
-
- is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden");
- is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden");
- is_element_visible(get("detail-disable-btn"), "Disable button should be visible");
- is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible");
-
- is_element_hidden(get("detail-warning"), "Warning message should be hidden");
- is_element_hidden(get("detail-warning-link"), "Warning link should be hidden");
- is_element_hidden(get("detail-pending"), "Pending message should be hidden");
-
- run_next_test();
- });
-});
-
// Tests that upgrades with onExternalInstall apply immediately
add_test(function() {
open_details("addon1@tests.mozilla.org", "extension", function() {
@@ -993,7 +704,7 @@ add_test(function() {
is(get("detail-version").value, "2.5", "Version should be correct");
is(get("detail-icon").src, "chrome://foo/skin/icon264.png", "Icon should be correct");
is_element_hidden(get("detail-creator"), "Creator should be hidden");
- is_element_hidden(get("detail-screenshot-box"), "Screenshot should be hidden");
+ is_element_hidden(get("detail-screenshot"), "Screenshot should be hidden");
is(get("detail-desc").textContent, "Short description replacement", "Description should be correct");
is(get("detail-fulldesc").textContent, "Longer description replacement", "Full description should be correct");