Bug 1100345 - Make Mulet appear as B2G for Marionette r=jgriffin

When running Gaia Marionette integration tests, we need to talk to Mulet
like if it was a B2G device. We define the "b2g.is_mulet" pref for this
purpose.
This commit is contained in:
Alexandre Lissy 2014-11-27 03:07:00 +01:00
parent 93ed00260c
commit 9474068426
2 changed files with 12 additions and 4 deletions

View File

@ -15,6 +15,7 @@ pref("browser.chromeURL", "chrome://b2g/content/");
// so that it can't be set a just a string.
// data: url is a workaround this.
pref("browser.startup.homepage", "data:text/plain,browser.startup.homepage=chrome://b2g/content/shell.html");
pref("b2g.is_mulet", true);
// Prevent having the firstrun page
pref("startup.homepage_welcome_url", "");
pref("browser.shell.checkDefaultBrowser", false);

View File

@ -37,8 +37,16 @@ specialpowers.specialPowersObserver.init();
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
function isMulet() {
let isMulet = false;
try {
isMulet = Services.prefs.getBoolPref("b2g.is_mulet");
} catch (ex) { }
return isMulet;
}
Services.prefs.setBoolPref("marionette.contentListener", false);
let appName = Services.appinfo.name;
let appName = isMulet() ? "B2G" : Services.appinfo.name;
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
let DevToolsUtils = devtools.require("devtools/toolkit/DevToolsUtils.js");
@ -2943,10 +2951,9 @@ BrowserObj.prototype = {
setBrowser: function BO_setBrowser(win) {
switch (appName) {
case "Firefox":
if (this.window.location.href.indexOf("chrome://b2g") == -1) {
if (!isMulet()) {
this.browser = win.gBrowser;
}
else {
} else {
// this is Mulet
appName = "B2G";
}