Bug 797164 - Support chrome tests on b2g emulator; r=ahal

This commit is contained in:
Geoff Brown 2014-12-23 14:17:42 -07:00
Родитель 75611a763f
Коммит c9776740d9
3 изменённых файлов: 23 добавлений и 1 удалений

Просмотреть файл

@ -6,6 +6,7 @@ let outOfProcess = __marionetteParams[0]
let mochitestUrl = __marionetteParams[1]
let onDevice = __marionetteParams[2]
let wifiSettings = __marionetteParams[3]
let chrome = __marionetteParams[4]
let prefs = Components.classes["@mozilla.org/preferences-service;1"].
getService(Components.interfaces.nsIPrefBranch)
let settings = window.navigator.mozSettings;
@ -86,6 +87,11 @@ if (outOfProcess) {
mm.loadFrameScript("data:,(" + encodeURI(contentScript.toSource()) + ")();", true);
}
if (chrome) {
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
loader.loadSubScript("chrome://mochikit/content/browser-test.js");
b2gStart();
}
if (onDevice) {
var cpuLock = Cc["@mozilla.org/power/powermanagerservice;1"]
@ -133,5 +139,7 @@ if (onDevice) {
};
}
} else {
container.src = mochitestUrl;
if (!chrome) {
container.src = mochitestUrl;
}
}

Просмотреть файл

@ -5,7 +5,11 @@ var gConfig;
if (Cc === undefined) {
var Cc = Components.classes;
}
if (Ci === undefined) {
var Ci = Components.interfaces;
}
if (Cu === undefined) {
var Cu = Components.utils;
}
@ -32,6 +36,15 @@ window.addEventListener("load", function testOnLoad() {
});
});
function b2gStart() {
let homescreen = document.getElementById('systemapp');
var webNav = homescreen.contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation);
var url = "chrome://mochikit/content/harness.xul?manifestFile=tests.json";
webNav.loadURI(url, null, null, null, null);
}
function testInit() {
gConfig = readConfig();
if (gConfig.testRoot == "browser" ||

Просмотреть файл

@ -174,6 +174,7 @@ class B2GMochitest(MochitestUtilsMixin):
self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'})
self.test_script_args.append(not options.emulator)
self.test_script_args.append(options.wifi)
self.test_script_args.append(options.chrome)
self.runner.start(outputTimeout=timeout)