Closed Bug 474763 Opened 16 years ago Closed 15 years ago

Add automated tests for xpinstall

Categories

(Core Graveyard :: Installer: XPInstall Engine, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: mossop, Assigned: mossop)

References

Details

(Keywords: fixed1.9.1, verified1.9.0.11)

Attachments

(3 files)

We currently have very little of xpinstall tested automatically. Just a few bits that have come up as part of extension manager tests. I have some work in progress to change that.
Attached patch test suite rev 1Splinter Review
This is a pretty well featured test suite for the xpinstall module. Sorry it's a bit big to start with.

The majority of the work is in harness.js which watches windows opening in order to accept/cancel a requested install, deal with any authentication and dismiss error dialogs. It also listens to the EM's install events to find out the status of installs as well as watching for installed blocked by the whitelist.

The testcases all follow a pretty similar pattern which hopefully will make reviewing and developing new cases easier. They register for callbacks from the harness and then trigger an install of some kind and test that the right things happen.

Some of the additional files:

authRedirect.sjs:   This is a server executed script to redirect to a url when the right authentication is given.
cookieRedirect.sjs: The same but redirects when the right cookie is present.

enabled.html:             Tests that InstallTrigger.enabled() works.
installtrigger.html:      Runs InstallTrigger.install.
installchrome.html:       Runs InstallTrigger.installChrome.
startsoftwareupdate.html: Runs InstallTrigger.startSoftwareUpdate.

unsigned.xpi:         A simple unsigned xpi extension.
signed.xpi:           A simple signed xpi extension.
signed2.xpi:          Another signed xpi extension.
signed-tampered.xpi:  A signed xpi that has had its contents changed since signing.
signed-untrusted.xpi: An xpi signed by an unknown signer.
corrupt.xpi:          This is a corrupt zip file, just a text file really.
empty.xpi:            An xpi with no install script.

The tests navigateaway and navigateaway2 will fail until bug 473060 is fixed. Also navigateaway2 is disabled completely for now as it triggers bug 475347.
Attachment #359501 - Flags: review?(benjamin)
Status: NEW → ASSIGNED
Attachment #359501 - Flags: review?(benjamin) → review+
Checking in these tests without these assertion fixes would make things very noisy
Depends on: 475532, 475526
Pushed with browser_navigateaway.js and browser_navigateaway2.js disabled for now: http://hg.mozilla.org/mozilla-central/rev/e321d96f8145
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.2a1
Disabled the tests for now since they are failing on OSX:

TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Should be 2 items listed in the confirmation dialog - Got 1, expected 2
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Should have seen the name from the trigger list - Got unsigned.xpi, expected Signed XPI
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Should have listed the correct url for the item - Got http://example.com/browser/xpinstall/tests/unsigned.xpi, expected http://example.com/browser/xpinstall/tests/signed.xpi
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Should have seen the signer - Got (Author not verified), expected (Mozilla Testing)
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_multiple.js | Should have listed the item as signed - Got false, expected true
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Should have seen the name from the trigger list - Got unsigned.xpi, expected Tampered Signed XPI
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Should have listed the correct url for the item - Got http://example.com/browser/xpinstall/tests/unsigned.xpi, expected http://example.com/browser/xpinstall/tests/signed-tampered.xpi
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Should have seen the signer - Got (Author not verified), expected (Mozilla Testing)
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Should have listed the item as signed - Got false, expected true
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_tampered.js | Install should fail - Got 0, expected -260
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_trigger.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_untrusted.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_untrusted.js | Install should fail - Got 0, expected -260
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_signed_url.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_softwareupdate.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_unsigned_trigger.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_unsigned_trigger.js | Shouldn't have been blocked by the whitelist
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_unsigned_trigger.js | Shouldn't have been blocked by the whitelist
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_unsigned_trigger.js | Shouldn't have been blocked by the whitelist
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_whitelist2.js | Timed out
TEST-UNEXPECTED-FAIL | chrome://mochikit/content/browser/xpinstall/tests/browser_whitelist5.js | Timed out
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
The tests are failing because Firefox stays in offline mode when switching online for some reason.
The tests are failing because randomly the switch to offline will fail. What happens is the call to set offline to true will spin an event loop, during that the add-ons manager opens, calls nonBrowserWindowDelayedStartup which sets offline to whatever the pref browser.offline is.

This fixes that by avoiding the browser.js method for setting offline and doing it itself, but setting the preference first to avoid the issue.
Attachment #363413 - Flags: review?(benjamin)
Attachment #363413 - Flags: review?(benjamin) → review+
Landed: http://hg.mozilla.org/mozilla-central/rev/37fe6a2a0628
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → FIXED
Depends on: 480752
Attached patch branch patchSplinter Review
This is a patch for the 1.9.0.x branch. It is essentially all the patches that landed on trunk however some tests are omitted (we don't have the infrastructure to test signed xpis on 1.9.0.x). There is also a couple of bits minor changes to add a quick and dirty JSON encoder and decoder since the tests pass stuff around and native JSON isn't on 1.9.0.x.
Attachment #373927 - Flags: review+
Keywords: fixed1.9.0.10
Verified by looking at the tests running for 1.9.0.11.
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: