Closed Bug 912184 Opened 12 years ago Closed 12 years ago

gallery unit tests use requireApp() to load shared/js modules

Categories

(Firefox OS Graveyard :: Gaia::Gallery, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bkelly, Assigned: bkelly)

Details

(Whiteboard: [ c= p=2 s=2013.09.06 ])

Attachments

(1 file)

Currently gallery/test/unit/setup.js uses requireApp() to load a couple resources from shared/js. For example: https://github.com/mozilla-b2g/gaia/blob/master/apps/gallery/test/unit/setup.js#L17 This causes the browser to attempt to load from the shared.gaiamobile.org domain. For most people this fails immediately since the domain is bogus. For unlucky folks like me, however, our ISP helpfully provides valid IP addresses for invalid domains. Not only that, but in my case it allows me to connect to the IP, but never returns a resource. For example: telnet shared.gaiamobile.org 80 Trying 92.242.140.2... Connected to shared.gaiamobile.org. Escape character is '^]'. This effectively causes the tests to hang for anyone running on a DNS server like this. I suppose I should look into using opendns. Anyway, it would be nice if we could convert the code to use require() instead of requireApp() for the shared resources. This allows the setup code to run as intended.
Pull request converting requireApp() to require() for the two shared/js resources I see with this issue.
Attachment #799065 - Flags: review?(dflanagan)
Attachment #799065 - Attachment mime type: text/plain → text/html
Using requireApp)() here also appears to cause tests to fail when running gallery tests independently by modifying their file. The error looks like: 1) [gallery] "before all" hook: TypeError: navigator.mozL10n is undefined at (anonymous) (http://gallery.gaiamobile.org:8080/test/unit/setup.js:22) at wrapper (http://test-agent.gaiamobile.org:8080/common/test/mocha_generators.js:60) at run (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3709) at next (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3973) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:3984) at (anonymous) (http://test-agent.gaiamobile.org:8080/common/vendor/mocha/mocha.js:4932)
Comment on attachment 799065 [details] Pull request at https://github.com/mozilla-b2g/gaia/pull/11913 Thanks for fixing this.
Attachment #799065 - Flags: review?(dflanagan) → review+
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: