mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-12 21:05:36 +00:00
bug 962858 - bypass native installation during automated tests; r=mfinkle,fabrice
--HG-- extra : rebase_source : bf4a585b4f7bee784d36a7338ba1f592bdedae94
This commit is contained in:
parent
afb16c34a0
commit
01c2a7f857
@ -1131,7 +1131,7 @@ this.DOMApplicationRegistry = {
|
|||||||
switch (aMessage.name) {
|
switch (aMessage.name) {
|
||||||
case "Webapps:Install": {
|
case "Webapps:Install": {
|
||||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||||
Services.obs.notifyObservers(null, "webapps-download-apk", JSON.stringify(msg));
|
Services.obs.notifyObservers(mm, "webapps-runtime-install", JSON.stringify(msg));
|
||||||
#else
|
#else
|
||||||
this.doInstall(msg, mm);
|
this.doInstall(msg, mm);
|
||||||
#endif
|
#endif
|
||||||
@ -1160,7 +1160,7 @@ this.DOMApplicationRegistry = {
|
|||||||
break;
|
break;
|
||||||
case "Webapps:InstallPackage": {
|
case "Webapps:InstallPackage": {
|
||||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||||
Services.obs.notifyObservers(null, "webapps-download-apk", JSON.stringify(msg));
|
Services.obs.notifyObservers(mm, "webapps-runtime-install-package", JSON.stringify(msg));
|
||||||
#else
|
#else
|
||||||
this.doInstallPackage(msg, mm);
|
this.doInstallPackage(msg, mm);
|
||||||
#endif
|
#endif
|
||||||
|
@ -334,7 +334,8 @@ var BrowserApp = {
|
|||||||
Services.obs.addObserver(this, "gather-telemetry", false);
|
Services.obs.addObserver(this, "gather-telemetry", false);
|
||||||
Services.obs.addObserver(this, "keyword-search", false);
|
Services.obs.addObserver(this, "keyword-search", false);
|
||||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||||
Services.obs.addObserver(this, "webapps-download-apk", false);
|
Services.obs.addObserver(this, "webapps-runtime-install", false);
|
||||||
|
Services.obs.addObserver(this, "webapps-runtime-install-package", false);
|
||||||
Services.obs.addObserver(this, "webapps-ask-install", false);
|
Services.obs.addObserver(this, "webapps-ask-install", false);
|
||||||
Services.obs.addObserver(this, "webapps-launch", false);
|
Services.obs.addObserver(this, "webapps-launch", false);
|
||||||
Services.obs.addObserver(this, "webapps-uninstall", false);
|
Services.obs.addObserver(this, "webapps-uninstall", false);
|
||||||
@ -1579,8 +1580,12 @@ var BrowserApp = {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef MOZ_ANDROID_SYNTHAPKS
|
#ifdef MOZ_ANDROID_SYNTHAPKS
|
||||||
case "webapps-download-apk":
|
case "webapps-runtime-install":
|
||||||
WebappManager.downloadApk(JSON.parse(aData));
|
WebappManager.install(JSON.parse(aData), aSubject);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "webapps-runtime-install-package":
|
||||||
|
WebappManager.installPackage(JSON.parse(aData), aSubject);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "webapps-ask-install":
|
case "webapps-ask-install":
|
||||||
|
@ -28,9 +28,37 @@ function sendMessageToJava(aMessage) {
|
|||||||
this.WebappManager = {
|
this.WebappManager = {
|
||||||
__proto__: DOMRequestIpcHelper.prototype,
|
__proto__: DOMRequestIpcHelper.prototype,
|
||||||
|
|
||||||
downloadApk: function(aMsg) {
|
get _testing() {
|
||||||
|
try {
|
||||||
|
return Services.prefs.getBoolPref("browser.webapps.testing");
|
||||||
|
} catch(ex) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
install: function(aMessage, aMessageManager) {
|
||||||
|
if (this._testing) {
|
||||||
|
// Go directly to DOM. Do not download/install APK, do not collect $200.
|
||||||
|
DOMApplicationRegistry.doInstall(aMessage, aMessageManager);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._downloadApk(aMessage);
|
||||||
|
},
|
||||||
|
|
||||||
|
installPackage: function(aMessage, aMessageManager) {
|
||||||
|
if (this._testing) {
|
||||||
|
// Go directly to DOM. Do not download/install APK, do not collect $200.
|
||||||
|
DOMApplicationRegistry.doInstallPackage(aMessage, aMessageManager);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._downloadApk(aMessage);
|
||||||
|
},
|
||||||
|
|
||||||
|
_downloadApk: function(aMsg) {
|
||||||
let manifestUrl = aMsg.app.manifestURL;
|
let manifestUrl = aMsg.app.manifestURL;
|
||||||
dump("downloadApk for " + manifestUrl);
|
dump("_downloadApk for " + manifestUrl);
|
||||||
|
|
||||||
// Get the endpoint URL and convert it to an nsIURI/nsIURL object.
|
// Get the endpoint URL and convert it to an nsIURI/nsIURL object.
|
||||||
const GENERATOR_URL_PREF = "browser.webapps.apkFactoryUrl";
|
const GENERATOR_URL_PREF = "browser.webapps.apkFactoryUrl";
|
||||||
@ -117,6 +145,11 @@ this.WebappManager = {
|
|||||||
uninstall: function(aData) {
|
uninstall: function(aData) {
|
||||||
dump("uninstall: " + aData.manifestURL);
|
dump("uninstall: " + aData.manifestURL);
|
||||||
|
|
||||||
|
if (this._testing) {
|
||||||
|
// We don't have to do anything, as the registry does all the work.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: uninstall the APK.
|
// TODO: uninstall the APK.
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -156,3 +156,6 @@ user_pref("browser.download.panel.shown", true);
|
|||||||
// prefs for firefox metro.
|
// prefs for firefox metro.
|
||||||
// Disable first-tun tab
|
// Disable first-tun tab
|
||||||
user_pref("browser.firstrun.count", 0);
|
user_pref("browser.firstrun.count", 0);
|
||||||
|
|
||||||
|
// Enable webapps testing mode, which bypasses native installation.
|
||||||
|
user_pref("browser.webapps.testing", true);
|
||||||
|
Loading…
Reference in New Issue
Block a user