|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/publicdomain/zero/1.0/ |
|
3 */ |
|
4 |
|
5 // Tests various aspects of the details view |
|
6 |
|
7 const PREF_AUTOUPDATE_DEFAULT = "extensions.update.autoUpdateDefault" |
|
8 const PREF_GETADDONS_GETSEARCHRESULTS = "extensions.getAddons.search.url"; |
|
9 const SEARCH_URL = TESTROOT + "browser_details.xml"; |
|
10 const PREF_EM_HOTFIX_ID = "extensions.hotfix.id"; |
|
11 |
|
12 var gManagerWindow; |
|
13 var gCategoryUtilities; |
|
14 var gProvider; |
|
15 |
|
16 var gApp = document.getElementById("bundle_brand").getString("brandShortName"); |
|
17 var gVersion = Services.appinfo.version; |
|
18 var gBlocklistURL = Services.urlFormatter.formatURLPref("extensions.blocklist.detailsURL"); |
|
19 var gPluginURL = Services.urlFormatter.formatURLPref("plugins.update.url"); |
|
20 var gDate = new Date(2010, 7, 1); |
|
21 |
|
22 function open_details(aId, aType, aCallback) { |
|
23 requestLongerTimeout(2); |
|
24 |
|
25 gCategoryUtilities.openType(aType, function() { |
|
26 var list = gManagerWindow.document.getElementById("addon-list"); |
|
27 var item = list.firstChild; |
|
28 while (item) { |
|
29 if ("mAddon" in item && item.mAddon.id == aId) { |
|
30 list.ensureElementIsVisible(item); |
|
31 EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow); |
|
32 EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow); |
|
33 wait_for_view_load(gManagerWindow, aCallback); |
|
34 return; |
|
35 } |
|
36 item = item.nextSibling; |
|
37 } |
|
38 ok(false, "Should have found the add-on in the list"); |
|
39 }); |
|
40 } |
|
41 |
|
42 function get(aId) { |
|
43 return gManagerWindow.document.getElementById(aId); |
|
44 } |
|
45 |
|
46 function test() { |
|
47 requestLongerTimeout(2); |
|
48 // Turn on searching for this test |
|
49 Services.prefs.setIntPref(PREF_SEARCH_MAXRESULTS, 15); |
|
50 Services.prefs.setCharPref(PREF_GETADDONS_GETSEARCHRESULTS, SEARCH_URL); |
|
51 Services.prefs.setCharPref(PREF_EM_HOTFIX_ID, "hotfix@tests.mozilla.org"); |
|
52 |
|
53 waitForExplicitFinish(); |
|
54 |
|
55 gProvider = new MockProvider(); |
|
56 |
|
57 gProvider.createAddons([{ |
|
58 id: "addon1@tests.mozilla.org", |
|
59 name: "Test add-on 1", |
|
60 version: "2.1", |
|
61 description: "Short description", |
|
62 fullDescription: "Longer description", |
|
63 type: "extension", |
|
64 iconURL: "chrome://foo/skin/icon.png", |
|
65 icon64URL: "chrome://foo/skin/icon64.png", |
|
66 contributionURL: "http://foo.com", |
|
67 contributionAmount: "$0.99", |
|
68 sourceURI: Services.io.newURI("http://example.com/foo", null, null), |
|
69 averageRating: 4, |
|
70 reviewCount: 5, |
|
71 reviewURL: "http://example.com/reviews", |
|
72 homepageURL: "http://example.com/addon1", |
|
73 applyBackgroundUpdates: AddonManager.AUTOUPDATE_ENABLE |
|
74 }, { |
|
75 id: "addon2@tests.mozilla.org", |
|
76 name: "Test add-on 2", |
|
77 version: "2.2", |
|
78 description: "Short description", |
|
79 creator: { name: "Mozilla", url: null }, |
|
80 type: "extension", |
|
81 iconURL: "chrome://foo/skin/icon.png", |
|
82 contributionURL: "http://foo.com", |
|
83 contributionAmount: null, |
|
84 updateDate: gDate, |
|
85 permissions: 0, |
|
86 screenshots: [{ |
|
87 url: "chrome://branding/content/about.png", |
|
88 width: 200, |
|
89 height: 150 |
|
90 }], |
|
91 }, { |
|
92 id: "addon3@tests.mozilla.org", |
|
93 name: "Test add-on 3", |
|
94 description: "Short description", |
|
95 creator: { name: "Mozilla", url: "http://www.mozilla.org" }, |
|
96 type: "extension", |
|
97 sourceURI: Services.io.newURI("http://example.com/foo", null, null), |
|
98 updateDate: gDate, |
|
99 reviewCount: 1, |
|
100 reviewURL: "http://example.com/reviews", |
|
101 applyBackgroundUpdates: AddonManager.AUTOUPDATE_DISABLE, |
|
102 isActive: false, |
|
103 isCompatible: false, |
|
104 appDisabled: true, |
|
105 permissions: AddonManager.PERM_CAN_ENABLE | |
|
106 AddonManager.PERM_CAN_DISABLE | |
|
107 AddonManager.PERM_CAN_UPGRADE, |
|
108 screenshots: [{ |
|
109 url: "http://example.com/screenshot", |
|
110 width: 400, |
|
111 height: 300, |
|
112 thumbnailURL: "chrome://branding/content/icon64.png", |
|
113 thumbnailWidth: 160, |
|
114 thumbnailHeight: 120 |
|
115 }], |
|
116 }, { |
|
117 id: "addon4@tests.mozilla.org", |
|
118 blocklistURL: "http://example.com/addon4@tests.mozilla.org", |
|
119 name: "Test add-on 4", |
|
120 _userDisabled: true, |
|
121 isActive: false, |
|
122 blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED |
|
123 }, { |
|
124 id: "addon5@tests.mozilla.org", |
|
125 blocklistURL: "http://example.com/addon5@tests.mozilla.org", |
|
126 name: "Test add-on 5", |
|
127 isActive: false, |
|
128 blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED, |
|
129 appDisabled: true |
|
130 }, { |
|
131 id: "addon6@tests.mozilla.org", |
|
132 blocklistURL: "http://example.com/addon6@tests.mozilla.org", |
|
133 name: "Test add-on 6", |
|
134 operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE |
|
135 }, { |
|
136 id: "addon7@tests.mozilla.org", |
|
137 blocklistURL: "http://example.com/addon7@tests.mozilla.org", |
|
138 name: "Test add-on 7", |
|
139 _userDisabled: true, |
|
140 isActive: false |
|
141 }, { |
|
142 id: "addon8@tests.mozilla.org", |
|
143 blocklistURL: "http://example.com/addon8@tests.mozilla.org", |
|
144 name: "Test add-on 8", |
|
145 blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED |
|
146 }, { |
|
147 id: "hotfix@tests.mozilla.org", |
|
148 name: "Test hotfix 1", |
|
149 }]); |
|
150 |
|
151 open_manager(null, function(aWindow) { |
|
152 gManagerWindow = aWindow; |
|
153 gCategoryUtilities = new CategoryUtilities(gManagerWindow); |
|
154 |
|
155 run_next_test(); |
|
156 }); |
|
157 } |
|
158 |
|
159 function end_test() { |
|
160 Services.prefs.clearUserPref(PREF_EM_HOTFIX_ID); |
|
161 close_manager(gManagerWindow, function() { |
|
162 finish(); |
|
163 }); |
|
164 } |
|
165 |
|
166 // Opens and tests the details view for add-on 1 |
|
167 add_test(function() { |
|
168 open_details("addon1@tests.mozilla.org", "extension", function() { |
|
169 is(get("detail-name").textContent, "Test add-on 1", "Name should be correct"); |
|
170 is_element_visible(get("detail-version"), "Version should not be hidden"); |
|
171 is(get("detail-version").value, "2.1", "Version should be correct"); |
|
172 is(get("detail-icon").src, "chrome://foo/skin/icon64.png", "Icon should be correct"); |
|
173 is_element_hidden(get("detail-creator"), "Creator should be hidden"); |
|
174 is_element_hidden(get("detail-screenshot"), "Screenshot should be hidden"); |
|
175 is(get("detail-screenshot").width, "", "Screenshot dimensions should not be set"); |
|
176 is(get("detail-screenshot").height, "", "Screenshot dimensions should not be set"); |
|
177 is(get("detail-desc").textContent, "Short description", "Description should be correct"); |
|
178 is(get("detail-fulldesc").textContent, "Longer description", "Full description should be correct"); |
|
179 |
|
180 is_element_visible(get("detail-contributions"), "Contributions section should be visible"); |
|
181 is_element_visible(get("detail-contrib-suggested"), "Contributions amount should be visible"); |
|
182 ok(get("detail-contrib-suggested").value, "$0.99"); |
|
183 |
|
184 is_element_visible(get("detail-updates-row"), "Updates should not be hidden"); |
|
185 is_element_hidden(get("detail-dateUpdated"), "Update date should be hidden"); |
|
186 |
|
187 is_element_visible(get("detail-rating-row"), "Rating row should not be hidden"); |
|
188 is_element_visible(get("detail-rating"), "Rating should not be hidden"); |
|
189 is(get("detail-rating").averageRating, 4, "Rating should be correct"); |
|
190 is_element_visible(get("detail-reviews"), "Reviews should not be hidden"); |
|
191 is(get("detail-reviews").href, "http://example.com/reviews", "Review URL should be correct"); |
|
192 is(get("detail-reviews").value, "5 reviews", "Review text should be correct"); |
|
193 |
|
194 is_element_visible(get("detail-homepage-row"), "Homepage should be visible"); |
|
195 ok(get("detail-homepage").href, "http://example.com/addon1"); |
|
196 is_element_hidden(get("detail-repository-row"), "Repository profile should not be visible"); |
|
197 |
|
198 is_element_hidden(get("detail-size"), "Size should be hidden"); |
|
199 |
|
200 is_element_hidden(get("detail-downloads"), "Downloads should be hidden"); |
|
201 |
|
202 is_element_visible(get("detail-autoUpdate"), "Updates should not be hidden"); |
|
203 ok(get("detail-autoUpdate").childNodes[1].selected, "Updates ahould be automatic"); |
|
204 is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden"); |
|
205 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").lastChild, {}, gManagerWindow); |
|
206 ok(get("detail-autoUpdate").lastChild.selected, "Updates should be manual"); |
|
207 is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible"); |
|
208 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").firstChild, {}, gManagerWindow); |
|
209 ok(get("detail-autoUpdate").firstChild.selected, "Updates should be automatic"); |
|
210 is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden"); |
|
211 |
|
212 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
213 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
214 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
215 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
216 |
|
217 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
218 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
219 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
220 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
221 |
|
222 // Disable it |
|
223 EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow); |
|
224 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
225 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
226 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
227 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
228 |
|
229 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
230 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
231 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
232 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
233 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
234 is(get("detail-pending").textContent, "Test add-on 1 will be disabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
235 |
|
236 // Reopen it |
|
237 open_details("addon1@tests.mozilla.org", "extension", function() { |
|
238 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
239 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
240 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
241 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
242 |
|
243 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
244 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
245 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
246 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
247 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
248 is(get("detail-pending").textContent, "Test add-on 1 will be disabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
249 |
|
250 // Undo disabling |
|
251 EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow); |
|
252 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
253 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
254 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
255 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
256 |
|
257 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
258 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
259 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
260 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
261 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
262 |
|
263 run_next_test(); |
|
264 }); |
|
265 }); |
|
266 }); |
|
267 |
|
268 // Opens and tests the details view for add-on 2 |
|
269 add_test(function() { |
|
270 open_details("addon2@tests.mozilla.org", "extension", function() { |
|
271 is(get("detail-name").textContent, "Test add-on 2", "Name should be correct"); |
|
272 is_element_visible(get("detail-version"), "Version should not be hidden"); |
|
273 is(get("detail-version").value, "2.2", "Version should be correct"); |
|
274 is(get("detail-icon").src, "chrome://foo/skin/icon.png", "Icon should be correct"); |
|
275 |
|
276 is_element_visible(get("detail-creator"), "Creator should not be hidden"); |
|
277 is_element_visible(get("detail-creator")._creatorName, "Creator name should not be hidden"); |
|
278 is(get("detail-creator")._creatorName.value, "Mozilla", "Creator should be correct"); |
|
279 is_element_hidden(get("detail-creator")._creatorLink, "Creator link should be hidden"); |
|
280 |
|
281 is_element_visible(get("detail-screenshot"), "Screenshot should be visible"); |
|
282 is(get("detail-screenshot").src, "chrome://branding/content/about.png", "Should be showing the full sized screenshot"); |
|
283 is(get("detail-screenshot").width, 200, "Screenshot dimensions should be set"); |
|
284 is(get("detail-screenshot").height, 150, "Screenshot dimensions should be set"); |
|
285 is(get("detail-screenshot").hasAttribute("loading"), true, "Screenshot should have loading attribute"); |
|
286 is(get("detail-desc").textContent, "Short description", "Description should be correct"); |
|
287 is_element_hidden(get("detail-fulldesc"), "Full description should be hidden"); |
|
288 |
|
289 is_element_visible(get("detail-contributions"), "Contributions section should be visible"); |
|
290 is_element_hidden(get("detail-contrib-suggested"), "Contributions amount should be hidden"); |
|
291 |
|
292 is_element_visible(get("detail-dateUpdated"), "Update date should not be hidden"); |
|
293 is(get("detail-dateUpdated").value, formatDate(gDate), "Update date should be correct"); |
|
294 |
|
295 is_element_hidden(get("detail-rating-row"), "Rating should be hidden"); |
|
296 |
|
297 is_element_hidden(get("detail-homepage-row"), "Homepage should not be visible"); |
|
298 is_element_hidden(get("detail-repository-row"), "Repository profile should not be visible"); |
|
299 |
|
300 is_element_hidden(get("detail-size"), "Size should be hidden"); |
|
301 |
|
302 is_element_hidden(get("detail-downloads"), "Downloads should be hidden"); |
|
303 |
|
304 is_element_hidden(get("detail-updates-row"), "Updates should be hidden"); |
|
305 |
|
306 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
307 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
308 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
309 is_element_hidden(get("detail-uninstall-btn"), "Remove button should be hidden"); |
|
310 |
|
311 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
312 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
313 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
314 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
315 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
316 |
|
317 get("detail-screenshot").addEventListener("load", function() { |
|
318 this.removeEventListener("load", arguments.callee, false); |
|
319 is(this.hasAttribute("loading"), false, "Screenshot should not have loading attribute"); |
|
320 run_next_test(); |
|
321 }, false); |
|
322 }); |
|
323 }); |
|
324 |
|
325 // Opens and tests the details view for add-on 3 |
|
326 add_test(function() { |
|
327 open_details("addon3@tests.mozilla.org", "extension", function() { |
|
328 is(get("detail-name").textContent, "Test add-on 3", "Name should be correct"); |
|
329 is_element_hidden(get("detail-version"), "Version should be hidden"); |
|
330 is(get("detail-icon").src, "", "Icon should be correct"); |
|
331 |
|
332 is_element_visible(get("detail-creator"), "Creator should not be hidden"); |
|
333 is_element_hidden(get("detail-creator")._creatorName, "Creator name should be hidden"); |
|
334 is_element_visible(get("detail-creator")._creatorLink, "Creator link should not be hidden"); |
|
335 is(get("detail-creator")._creatorLink.value, "Mozilla", "Creator link should be correct"); |
|
336 is(get("detail-creator")._creatorLink.href, "http://www.mozilla.org", "Creator link href should be correct"); |
|
337 |
|
338 is_element_visible(get("detail-screenshot"), "Screenshot should be visible"); |
|
339 is(get("detail-screenshot").src, "chrome://branding/content/icon64.png", "Should be showing the thumbnail"); |
|
340 is(get("detail-screenshot").width, 160, "Screenshot dimensions should be set"); |
|
341 is(get("detail-screenshot").height, 120, "Screenshot dimensions should be set"); |
|
342 is(get("detail-screenshot").hasAttribute("loading"), true, "Screenshot should have loading attribute"); |
|
343 |
|
344 is_element_hidden(get("detail-contributions"), "Contributions section should be hidden"); |
|
345 |
|
346 is_element_visible(get("detail-updates-row"), "Updates should not be hidden"); |
|
347 is_element_visible(get("detail-dateUpdated"), "Update date should not be hidden"); |
|
348 is(get("detail-dateUpdated").value, formatDate(gDate), "Update date should be correct"); |
|
349 |
|
350 is_element_visible(get("detail-rating-row"), "Rating row should not be hidden"); |
|
351 is_element_hidden(get("detail-rating"), "Rating should be hidden"); |
|
352 is_element_visible(get("detail-reviews"), "Reviews should not be hidden"); |
|
353 is(get("detail-reviews").href, "http://example.com/reviews", "Review URL should be correct"); |
|
354 is(get("detail-reviews").value, "1 review", "Review text should be correct"); |
|
355 |
|
356 is_element_hidden(get("detail-size"), "Size should be hidden"); |
|
357 |
|
358 is_element_hidden(get("detail-downloads"), "Downloads should be hidden"); |
|
359 |
|
360 is_element_visible(get("detail-autoUpdate"), "Updates should not be hidden"); |
|
361 ok(get("detail-autoUpdate").lastChild.selected, "Updates should be manual"); |
|
362 is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible"); |
|
363 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").childNodes[1], {}, gManagerWindow); |
|
364 ok(get("detail-autoUpdate").childNodes[1].selected, "Updates should be automatic"); |
|
365 is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden"); |
|
366 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").lastChild, {}, gManagerWindow); |
|
367 ok(get("detail-autoUpdate").lastChild.selected, "Updates should be manual"); |
|
368 is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible"); |
|
369 |
|
370 info("Setting " + PREF_AUTOUPDATE_DEFAULT + " to true"); |
|
371 Services.prefs.setBoolPref(PREF_AUTOUPDATE_DEFAULT, true); |
|
372 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").firstChild, {}, gManagerWindow); |
|
373 ok(get("detail-autoUpdate").firstChild.selected, "Updates should be default"); |
|
374 is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden"); |
|
375 |
|
376 info("Setting " + PREF_AUTOUPDATE_DEFAULT + " to false"); |
|
377 Services.prefs.setBoolPref(PREF_AUTOUPDATE_DEFAULT, false); |
|
378 ok(get("detail-autoUpdate").firstChild.selected, "Updates should be default"); |
|
379 is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible"); |
|
380 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").childNodes[1], {}, gManagerWindow); |
|
381 ok(get("detail-autoUpdate").childNodes[1].selected, "Updates should be automatic"); |
|
382 is_element_hidden(get("detail-findUpdates-btn"), "Check for updates should be hidden"); |
|
383 EventUtils.synthesizeMouseAtCenter(get("detail-autoUpdate").firstChild, {}, gManagerWindow); |
|
384 ok(get("detail-autoUpdate").firstChild.selected, "Updates should be default"); |
|
385 is_element_visible(get("detail-findUpdates-btn"), "Check for updates should be visible"); |
|
386 Services.prefs.clearUserPref(PREF_AUTOUPDATE_DEFAULT); |
|
387 |
|
388 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
389 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
390 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
391 is_element_hidden(get("detail-uninstall-btn"), "Remove button should be hidden"); |
|
392 |
|
393 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
394 is(get("detail-warning").textContent, "Test add-on 3 is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct"); |
|
395 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
396 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
397 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
398 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
399 |
|
400 get("detail-screenshot").addEventListener("load", function() { |
|
401 this.removeEventListener("load", arguments.callee, false); |
|
402 is(this.hasAttribute("loading"), false, "Screenshot should not have loading attribute"); |
|
403 run_next_test(); |
|
404 }, false); |
|
405 }); |
|
406 }); |
|
407 |
|
408 // Opens and tests the details view for add-on 4 |
|
409 add_test(function() { |
|
410 open_details("addon4@tests.mozilla.org", "extension", function() { |
|
411 is(get("detail-name").textContent, "Test add-on 4", "Name should be correct"); |
|
412 |
|
413 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
414 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
415 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
416 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
417 |
|
418 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
419 is(get("detail-warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct"); |
|
420 is_element_visible(get("detail-warning-link"), "Warning link should be visible"); |
|
421 is(get("detail-warning-link").value, "More Information", "Warning link text should be correct"); |
|
422 is(get("detail-warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct"); |
|
423 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
424 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
425 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
426 |
|
427 // Enable it |
|
428 EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow); |
|
429 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
430 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
431 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
432 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
433 |
|
434 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
435 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
436 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
437 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
438 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
439 is(get("detail-pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
440 |
|
441 // Reopen it |
|
442 open_details("addon4@tests.mozilla.org", "extension", function() { |
|
443 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
444 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
445 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
446 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
447 |
|
448 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
449 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
450 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
451 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
452 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
453 is(get("detail-pending").textContent, "Test add-on 4 will be enabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
454 |
|
455 // Undo enabling |
|
456 EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow); |
|
457 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
458 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
459 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
460 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
461 |
|
462 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
463 is(get("detail-warning").textContent, "Test add-on 4 is known to cause security or stability issues.", "Warning message should be correct"); |
|
464 is_element_visible(get("detail-warning-link"), "Warning link should be visible"); |
|
465 is(get("detail-warning-link").value, "More Information", "Warning link text should be correct"); |
|
466 is(get("detail-warning-link").href, "http://example.com/addon4@tests.mozilla.org", "Warning link should be correct"); |
|
467 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
468 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
469 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
470 |
|
471 run_next_test(); |
|
472 }); |
|
473 }); |
|
474 }); |
|
475 |
|
476 // Opens and tests the details view for add-on 5 |
|
477 add_test(function() { |
|
478 open_details("addon5@tests.mozilla.org", "extension", function() { |
|
479 is(get("detail-name").textContent, "Test add-on 5", "Name should be correct"); |
|
480 |
|
481 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
482 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
483 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
484 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
485 |
|
486 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
487 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
488 is_element_visible(get("detail-error"), "Error message should be visible"); |
|
489 is(get("detail-error").textContent, "Test add-on 5 has been disabled due to security or stability issues.", "Error message should be correct"); |
|
490 is_element_visible(get("detail-error-link"), "Error link should be visible"); |
|
491 is(get("detail-error-link").value, "More Information", "Error link text should be correct"); |
|
492 is(get("detail-error-link").href, "http://example.com/addon5@tests.mozilla.org", "Error link should be correct"); |
|
493 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
494 |
|
495 run_next_test(); |
|
496 }); |
|
497 }); |
|
498 |
|
499 // Opens and tests the details view for add-on 6 |
|
500 add_test(function() { |
|
501 open_details("addon6@tests.mozilla.org", "extension", function() { |
|
502 is(get("detail-name").textContent, "Test add-on 6", "Name should be correct"); |
|
503 |
|
504 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
505 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
506 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
507 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
508 |
|
509 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
510 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
511 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
512 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
513 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
514 |
|
515 // Disable it |
|
516 EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow); |
|
517 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
518 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
519 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
520 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
521 |
|
522 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
523 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
524 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
525 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
526 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
527 |
|
528 // Reopen it |
|
529 open_details("addon6@tests.mozilla.org", "extension", function() { |
|
530 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
531 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
532 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
533 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
534 |
|
535 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
536 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
537 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
538 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
539 is_element_hidden(get("detail-pending"), "Pending message should be visible"); |
|
540 |
|
541 // Enable it |
|
542 EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow); |
|
543 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
544 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
545 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
546 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
547 |
|
548 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
549 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
550 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
551 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
552 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
553 |
|
554 run_next_test(); |
|
555 }); |
|
556 }); |
|
557 }); |
|
558 |
|
559 // Opens and tests the details view for add-on 7 |
|
560 add_test(function() { |
|
561 open_details("addon7@tests.mozilla.org", "extension", function() { |
|
562 is(get("detail-name").textContent, "Test add-on 7", "Name should be correct"); |
|
563 |
|
564 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
565 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
566 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
567 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
568 |
|
569 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
570 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
571 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
572 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
573 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
574 |
|
575 // Enable it |
|
576 EventUtils.synthesizeMouseAtCenter(get("detail-enable-btn"), {}, gManagerWindow); |
|
577 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
578 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
579 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
580 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
581 |
|
582 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
583 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
584 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
585 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
586 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
587 is(get("detail-pending").textContent, "Test add-on 7 will be enabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
588 |
|
589 // Reopen it |
|
590 open_details("addon7@tests.mozilla.org", "extension", function() { |
|
591 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
592 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
593 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
594 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
595 |
|
596 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
597 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
598 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
599 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
600 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
601 is(get("detail-pending").textContent, "Test add-on 7 will be enabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
602 |
|
603 // Undo enabling |
|
604 EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow); |
|
605 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
606 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
607 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
608 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
609 |
|
610 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
611 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
612 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
613 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
614 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
615 |
|
616 run_next_test(); |
|
617 }); |
|
618 }); |
|
619 }); |
|
620 |
|
621 // Opens and tests the details view for add-on 8 |
|
622 add_test(function() { |
|
623 open_details("addon8@tests.mozilla.org", "extension", function() { |
|
624 is(get("detail-name").textContent, "Test add-on 8", "Name should be correct"); |
|
625 |
|
626 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
627 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
628 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
629 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
630 |
|
631 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
632 is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct"); |
|
633 is_element_visible(get("detail-warning-link"), "Warning link should be visible"); |
|
634 is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct"); |
|
635 is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct"); |
|
636 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
637 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
638 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
639 |
|
640 // Disable it |
|
641 EventUtils.synthesizeMouseAtCenter(get("detail-disable-btn"), {}, gManagerWindow); |
|
642 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
643 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
644 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
645 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
646 |
|
647 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
648 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
649 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
650 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
651 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
652 is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
653 |
|
654 // Reopen it |
|
655 open_details("addon8@tests.mozilla.org", "extension", function() { |
|
656 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
657 is_element_visible(get("detail-enable-btn"), "Enable button should be visible"); |
|
658 is_element_hidden(get("detail-disable-btn"), "Disable button should be hidden"); |
|
659 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
660 |
|
661 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
662 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
663 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
664 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
665 is_element_visible(get("detail-pending"), "Pending message should be visible"); |
|
666 is(get("detail-pending").textContent, "Test add-on 8 will be disabled after you restart " + gApp + ".", "Pending message should be correct"); |
|
667 |
|
668 // Undo disabling |
|
669 EventUtils.synthesizeMouseAtCenter(get("detail-undo-btn"), {}, gManagerWindow); |
|
670 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
671 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
672 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
673 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
674 |
|
675 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
676 is(get("detail-warning").textContent, "An important update is available for Test add-on 8.", "Warning message should be correct"); |
|
677 is_element_visible(get("detail-warning-link"), "Warning link should be visible"); |
|
678 is(get("detail-warning-link").value, "Update Now", "Warning link text should be correct"); |
|
679 is(get("detail-warning-link").href, gPluginURL, "Warning link should be correct"); |
|
680 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
681 is_element_hidden(get("detail-error-link"), "Error link should be hidden"); |
|
682 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
683 |
|
684 run_next_test(); |
|
685 }); |
|
686 }); |
|
687 }); |
|
688 |
|
689 // Opens and tests the details view for hotfix 1 |
|
690 add_test(function() { |
|
691 open_details("hotfix@tests.mozilla.org", "extension", function() { |
|
692 is(get("detail-name").textContent, "Test hotfix 1", "Name should be correct"); |
|
693 |
|
694 is_element_hidden(get("detail-updates-row"), "Updates should be hidden"); |
|
695 |
|
696 is_element_hidden(get("detail-prefs-btn"), "Preferences button should be hidden"); |
|
697 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
698 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
699 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
700 |
|
701 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
702 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
703 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
704 |
|
705 run_next_test(); |
|
706 }); |
|
707 }); |
|
708 |
|
709 // Tests that upgrades with onExternalInstall apply immediately |
|
710 add_test(function() { |
|
711 open_details("addon1@tests.mozilla.org", "extension", function() { |
|
712 gProvider.createAddons([{ |
|
713 id: "addon1@tests.mozilla.org", |
|
714 name: "Test add-on replacement", |
|
715 version: "2.5", |
|
716 description: "Short description replacement", |
|
717 fullDescription: "Longer description replacement", |
|
718 type: "extension", |
|
719 iconURL: "chrome://foo/skin/icon.png", |
|
720 icon64URL: "chrome://foo/skin/icon264.png", |
|
721 sourceURI: Services.io.newURI("http://example.com/foo", null, null), |
|
722 averageRating: 2, |
|
723 optionsURL: "chrome://foo/content/options.xul", |
|
724 applyBackgroundUpdates: AddonManager.AUTOUPDATE_ENABLE, |
|
725 operationsRequiringRestart: AddonManager.OP_NEEDS_RESTART_NONE |
|
726 }]); |
|
727 |
|
728 is(get("detail-name").textContent, "Test add-on replacement", "Name should be correct"); |
|
729 is_element_visible(get("detail-version"), "Version should not be hidden"); |
|
730 is(get("detail-version").value, "2.5", "Version should be correct"); |
|
731 is(get("detail-icon").src, "chrome://foo/skin/icon264.png", "Icon should be correct"); |
|
732 is_element_hidden(get("detail-creator"), "Creator should be hidden"); |
|
733 is_element_hidden(get("detail-screenshot"), "Screenshot should be hidden"); |
|
734 is(get("detail-desc").textContent, "Short description replacement", "Description should be correct"); |
|
735 is(get("detail-fulldesc").textContent, "Longer description replacement", "Full description should be correct"); |
|
736 |
|
737 is_element_hidden(get("detail-contributions"), "Contributions section should be hidden"); |
|
738 |
|
739 is_element_hidden(get("detail-dateUpdated"), "Update date should be hidden"); |
|
740 |
|
741 is_element_visible(get("detail-rating-row"), "Rating row should not be hidden"); |
|
742 is_element_visible(get("detail-rating"), "Rating should not be hidden"); |
|
743 is(get("detail-rating").averageRating, 2, "Rating should be correct"); |
|
744 is_element_hidden(get("detail-reviews"), "Reviews should be hidden"); |
|
745 |
|
746 is_element_hidden(get("detail-homepage-row"), "Homepage should be hidden"); |
|
747 |
|
748 is_element_hidden(get("detail-size"), "Size should be hidden"); |
|
749 |
|
750 is_element_hidden(get("detail-downloads"), "Downloads should be hidden"); |
|
751 |
|
752 is_element_visible(get("detail-prefs-btn"), "Preferences button should be visible"); |
|
753 is_element_hidden(get("detail-enable-btn"), "Enable button should be hidden"); |
|
754 is_element_visible(get("detail-disable-btn"), "Disable button should be visible"); |
|
755 is_element_visible(get("detail-uninstall-btn"), "Remove button should be visible"); |
|
756 |
|
757 is_element_hidden(get("detail-warning"), "Warning message should be hidden"); |
|
758 is_element_hidden(get("detail-warning-link"), "Warning link should be hidden"); |
|
759 is_element_hidden(get("detail-error"), "Error message should be hidden"); |
|
760 is_element_hidden(get("detail-pending"), "Pending message should be hidden"); |
|
761 |
|
762 run_next_test(); |
|
763 }); |
|
764 }); |
|
765 |
|
766 // Check that onPropertyChanges for appDisabled updates the UI |
|
767 add_test(function() { |
|
768 info("Checking that onPropertyChanges for appDisabled updates the UI"); |
|
769 |
|
770 AddonManager.getAddonByID("addon1@tests.mozilla.org", function(aAddon) { |
|
771 aAddon.userDisabled = true; |
|
772 aAddon.isCompatible = true; |
|
773 aAddon.appDisabled = false; |
|
774 |
|
775 open_details("addon1@tests.mozilla.org", "extension", function() { |
|
776 is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active"); |
|
777 is_element_hidden(get("detail-warning"), "Warning message should not be visible"); |
|
778 |
|
779 info("Making addon incompatible and appDisabled"); |
|
780 aAddon.isCompatible = false; |
|
781 aAddon.appDisabled = true; |
|
782 |
|
783 is(get("detail-view").getAttribute("active"), "false", "Addon should not be marked as active"); |
|
784 is_element_visible(get("detail-warning"), "Warning message should be visible"); |
|
785 is(get("detail-warning").textContent, "Test add-on replacement is incompatible with " + gApp + " " + gVersion + ".", "Warning message should be correct"); |
|
786 |
|
787 run_next_test(); |
|
788 }); |
|
789 }); |
|
790 }); |