Closed Bug 811153 Opened 13 years ago Closed 12 years ago

Implement a global emulator object for JS tests to ease the creation of emulator tests

Categories

(Remote Protocol :: Marionette, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: whimboo, Unassigned)

Details

A lot of our current emulator tests which get written in Javascript include a fair amount of details about the underlying command. I can see that for the telephony and SMS tests at least. While working on the screen orientation sensor I found another example. Let me use this for an example. In a JS tests I would have to write: runEmulatorCmd("set sensor orientation 0:-90:0", function callback() { ... } This is far than ideal because who knows the right command or even what that value means. Instead I propose wrapper classes and a global emulator object which can be used in all the JS tests like so: emulator.screen.setOrientation('portrait-primary', function callback() { ... } or even emulator.screen.orientation = 'portrait-primary'; ... Jonathan, what do you think? If that's a good RFE would you mind telling us where such an object would have to be added?
Flags: needinfo?(jgriffin)
Functions are attached to the Marionette sandbox here (for content): http://mxr.mozilla.org/mozilla-central/source/testing/marionette/marionette-listener.js#279 Most of those are defined here: http://mxr.mozilla.org/mozilla-central/source/testing/marionette/marionette-simpletest.js Unfortunately, the JS bits of Marionette have no idea whether they're being run in an emulator or not, so it currently isn't possible to attach an object to the sandbox conditionally depending on whether we're in an emulator. Possibly, we could extend newSession to give the JS bits of Marionette this information.
Flags: needinfo?(jgriffin)
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.