summaryrefslogtreecommitdiffstats
path: root/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/mozapps/extensions/test/browser/browser_manualupdates.js')
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_manualupdates.js100
1 files changed, 48 insertions, 52 deletions
diff --git a/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js b/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
index 0c5eb2da6..27a4a6cd8 100644
--- a/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_manualupdates.js
@@ -38,7 +38,7 @@ function end_test() {
add_test(function() {
gAvailableCategory = gManagerWindow.gCategories.get("addons://updates/available");
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should initially be hidden");
-
+
gProvider.createAddons([{
id: "addon2@tests.mozilla.org",
name: "manually updating addon",
@@ -47,7 +47,7 @@ add_test(function() {
blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE
}]);
-
+
is(gCategoryUtilities.isVisible(gAvailableCategory), false, "Available Updates category should still be hidden");
run_next_test();
@@ -55,17 +55,11 @@ add_test(function() {
add_test(function() {
- let finished = 0;
- function maybeRunNext() {
- if (++finished == 2)
- run_next_test();
- }
-
gAvailableCategory.addEventListener("CategoryBadgeUpdated", function() {
gAvailableCategory.removeEventListener("CategoryBadgeUpdated", arguments.callee, false);
is(gCategoryUtilities.isVisible(gAvailableCategory), true, "Available Updates category should now be visible");
is(gAvailableCategory.badgeCount, 1, "Badge for Available Updates should now be 1");
- maybeRunNext();
+ run_next_test();
}, false);
gCategoryUtilities.openType("extension", function() {
@@ -77,10 +71,7 @@ add_test(function() {
}]);
var item = get_addon_element(gManagerWindow, "addon2@tests.mozilla.org");
- get_tooltip_info(item).then(({ version }) => {
- is(version, "1.0", "Should still show the old version in the tooltip");
- maybeRunNext();
- });
+ is(item._version.value, "1.0", "Should still show the old version in the normal list");
});
});
@@ -100,62 +91,67 @@ add_test(function() {
is(list.itemCount, 1, "Should be 1 available update listed");
var item = list.firstChild;
is(item.mAddon.id, "addon2@tests.mozilla.org", "Update item should be for the manually updating addon");
-
- // The item in the list will be checking for update information asynchronously
- // so we have to wait for it to complete. Doing the same async request should
- // make our callback be called later.
- AddonManager.getAllInstalls(run_next_test);
+
+ // for manual update items, update-related properties are updated asynchronously,
+ // so we poll for one of the expected changes to know when its done
+ function waitForAsyncInit() {
+ if (item._version.value == "1.1") {
+ run_next_test();
+ return;
+ }
+ info("Update item not initialized yet, checking again in 100ms");
+ setTimeout(waitForAsyncInit, 100);
+ }
+ waitForAsyncInit();
});
add_test(function() {
var list = gManagerWindow.document.getElementById("updates-list");
var item = list.firstChild;
- get_tooltip_info(item).then(({ version }) => {
- is(version, "1.1", "Update item should have version number of the update");
- var postfix = gManagerWindow.document.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_visible(postfix, "'Update' postfix should be visible");
- is_element_visible(item._updateAvailable, "");
- is_element_visible(item._relNotesToggle, "Release notes toggle should be visible");
- is_element_hidden(item._warning, "Incompatible warning should be hidden");
- is_element_hidden(item._error, "Blocklist error should be hidden");
-
- info("Opening release notes");
+ is(item._version.value, "1.1", "Update item should have version number of the update");
+ var postfix = gManagerWindow.document.getAnonymousElementByAttribute(item, "class", "update-postfix");
+ is_element_visible(postfix, "'Update' postfix should be visible");
+ is_element_visible(item._updateAvailable, "");
+ is_element_visible(item._relNotesToggle, "Release notes toggle should be visible");
+ is_element_hidden(item._warning, "Incompatible warning should be hidden");
+ is_element_hidden(item._error, "Blocklist error should be hidden");
+
+ info("Opening release notes");
+ item.addEventListener("RelNotesToggle", function() {
+ item.removeEventListener("RelNotesToggle", arguments.callee, false);
+ info("Release notes now open");
+
+ is_element_hidden(item._relNotesLoading, "Release notes loading message should be hidden");
+ is_element_visible(item._relNotesError, "Release notes error message should be visible");
+ is(item._relNotes.childElementCount, 0, "Release notes should be empty");
+
+ info("Closing release notes");
item.addEventListener("RelNotesToggle", function() {
item.removeEventListener("RelNotesToggle", arguments.callee, false);
- info("Release notes now open");
-
- is_element_hidden(item._relNotesLoading, "Release notes loading message should be hidden");
- is_element_visible(item._relNotesError, "Release notes error message should be visible");
- is(item._relNotes.childElementCount, 0, "Release notes should be empty");
+ info("Release notes now closed");
+ info("Setting Release notes URI to something that should load");
+ gProvider.installs[0].releaseNotesURI = Services.io.newURI(TESTROOT + "releaseNotes.xhtml", null, null)
- info("Closing release notes");
+ info("Re-opening release notes");
item.addEventListener("RelNotesToggle", function() {
item.removeEventListener("RelNotesToggle", arguments.callee, false);
- info("Release notes now closed");
- info("Setting Release notes URI to something that should load");
- gProvider.installs[0].releaseNotesURI = Services.io.newURI(TESTROOT + "releaseNotes.xhtml", null, null)
-
- info("Re-opening release notes");
- item.addEventListener("RelNotesToggle", function() {
- item.removeEventListener("RelNotesToggle", arguments.callee, false);
- info("Release notes now open");
-
- is_element_hidden(item._relNotesLoading, "Release notes loading message should be hidden");
- is_element_hidden(item._relNotesError, "Release notes error message should be hidden");
- isnot(item._relNotes.childElementCount, 0, "Release notes should have been inserted into container");
- run_next_test();
+ info("Release notes now open");
- }, false);
- EventUtils.synthesizeMouseAtCenter(item._relNotesToggle, { }, gManagerWindow);
- is_element_visible(item._relNotesLoading, "Release notes loading message should be visible");
+ is_element_hidden(item._relNotesLoading, "Release notes loading message should be hidden");
+ is_element_hidden(item._relNotesError, "Release notes error message should be hidden");
+ isnot(item._relNotes.childElementCount, 0, "Release notes should have been inserted into container");
+ run_next_test();
}, false);
EventUtils.synthesizeMouseAtCenter(item._relNotesToggle, { }, gManagerWindow);
+ is_element_visible(item._relNotesLoading, "Release notes loading message should be visible");
}, false);
EventUtils.synthesizeMouseAtCenter(item._relNotesToggle, { }, gManagerWindow);
- is_element_visible(item._relNotesLoading, "Release notes loading message should be visible");
- });
+
+ }, false);
+ EventUtils.synthesizeMouseAtCenter(item._relNotesToggle, { }, gManagerWindow);
+ is_element_visible(item._relNotesLoading, "Release notes loading message should be visible");
});