Thanks David

----- Original Message -----
From: "David Chan" <dc...@mozilla.com>
To: "Geo Mealer" <gmea...@mozilla.com>
Cc: qa-...@mozilla.org, dev-b2g@lists.mozilla.org, "Paul Theriault" 
<ptheria...@mozilla.com>, "David Clarke" <dcla...@mozilla.com>
Sent: Friday, September 28, 2012 9:36:51 AM
Subject: Re: A draft on Mochitest permissions testing in b2g

I've add some notes to the etherpad. My comments are inline

David

----- Original Message -----
> From: "Geo Mealer" <gmea...@mozilla.com>
> To: "David Clarke" <dcla...@mozilla.com>
> Cc: qa-...@mozilla.org, dev-b2g@lists.mozilla.org, "David Chan" 
> <dc...@mozilla.com>, "Paul Theriault"
> <ptheria...@mozilla.com>
> Sent: Thursday, September 27, 2012 5:54:19 PM
> Subject: Re: A draft on Mochitest permissions testing in b2g
> 
> David Chan and Paul Theriault should be in on this conversation, as
> they've been doing significant work here putting together testing
> frameworks. Unsure if they're on the lists included, so copying them
> directly.
> 
> Geo
> 
> ----- Original Message -----
> > From: "David Clarke" <dcla...@mozilla.com>
> > To: dev-b2g@lists.mozilla.org
> > Cc: qa-...@mozilla.org
> > Sent: Thursday, September 27, 2012 4:09:00 PM
> > Subject: A draft on Mochitest permissions testing in b2g
> > 
> > Hey B2G Devs,
> > 
> > I was putting together a how to document for testing permissions
> > using mochitests on the b2g emulator platform.
> > 
> > https://etherpad.mozilla.org/b2g-mochitest-permissions
> > 
> > Generally looking to solicit ideas and create a conversation before
> > I
> > put it to the wiki.
> > 
> > I would like to gather further information:
> > 
> > #1) Permissions notifications
> > 
> > Are there any thoughts on having a notification mechanism that
> > allows
> > for permission changes to be handled more dynamically.
> > Without permissions notifications is there any real guarantee that
> > an
> > app has been installed correctly ?
> > 
Are you looking for something similar to pushPrefEnv in SpecialPowers?
https://bugzilla.mozilla.org/show_bug.cgi?id=685652

I thought the paradigm for b2g was that apps could request
permissions in the manifest, but there was no guarantee the
app would receive the permission, either because the runtime
didn't allow it or the user didn't allow it. If that is the case,
an app /SHOULD/ be coded to handle the situation of not receiving
geolocation or bluetooth.

In my opinion, app content doesn't need to know whether it has permission
x, y, z. However it would be nice for testing purposes if we knew
when a permission was set so that test code could act on that.

The tests that Geo, Paul and I are testing with use navigator.mozApps.install.
We're assuming permissions are properly set once ddahl's patch lands
https://bugzilla.mozilla.org/show_bug.cgi?id=758269


> > #2) Other Mechanisms for launching permissions tests.
> > Are there any other known working mechanisms for launching
> > permissions tests, or modififying app permissions.
> >

I'm not aware of a nice way to modify app permissions outside of
ddahl's patch. We didn't want to reinvent ddahl's logic, so we
use install/installPackage
 

> > #3) Could there be a better mechanism for installing an app with
> > the
> > correct permissions and then running tests within that context ?
> > 

The mechanism could be better. Here is the code we're using
https://people.mozilla.com/~dchan/test-framework.zip

I've only tested the above on emulator, but it should work for device
You will have to revert part of
https://bugzilla.mozilla.org/show_bug.cgi?id=773886

until mochitest-chrome support is on the emulator.
appProtocolHandler.js needs the protocol flag
Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE
and not 
Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD


Workflow
1. mochitest runs test_install.html
2. This page installs an app using either install or installPackage
The packaged app is currently static, but should be dynamically
generated.
3. test_install catches the 'webapps-ask-install' event, and calls
browser.CustomEventManager.handleEvent(), which does the actual install
4. an app iframe is created once oninstall fires
5. The app is pointed to the origin of the webapp
a webpage is the webapp case and app://{guid} for the packaged case
6. an onload handler postMessages to the iframe so that the iframe can
communicate back
7. Tests run in the context of the app iframe and results posted back to the
parent 

It should be possible to install multiple apps with test_install and run
them all in separate iframes.


> > Would anyone want to see an example where we install an app with
> > specific permissions, and then run tests from within that context ?
> > 
> > 
> > Thanks for the feedback.
> > 
> > 
> > -David
> > _______________________________________________
> > Qa-b2g mailing list
> > qa-...@mozilla.org
> > https://mail.mozilla.org/listinfo/qa-b2g
> > 
> 
_______________________________________________
dev-b2g mailing list
dev-b2g@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to