Bug 771271 - Get mochitest-metro-chrome tests running in immersive mode. r=jmaher

This commit is contained in:
Jim Mathies 2013-02-12 14:51:24 -06:00
parent 10fe5fc177
commit de21b231b0
4 changed files with 31 additions and 2 deletions

View File

@ -84,4 +84,10 @@ mochitest-browser-chrome:
mochitest:: mochitest-browser-chrome
.PHONY: mochitest-browser-chrome
mochitest-metro-chrome:
$(RUN_MOCHITEST) --metro-immersive --browser-chrome
$(CHECK_TEST_ERROR)
endif

View File

@ -189,6 +189,7 @@
var windowMediator = Cc['@mozilla.org/appshell/window-mediator;1'].
getService(Ci.nsIWindowMediator);
var winType = gConfig.testRoot == "browser" ? "navigator:browser" :
gConfig.testRoot == "metro" ? "navigator:browser" :
gConfig.testRoot == "webapprtChrome" ? "webapprt:webapp" :
null;
if (!winType) {

View File

@ -19,7 +19,9 @@ function testOnLoad() {
window.removeEventListener("load", testOnLoad, false);
gConfig = readConfig();
if (gConfig.testRoot == "browser" || gConfig.testRoot == "webapprtChrome") {
if (gConfig.testRoot == "browser" ||
gConfig.testRoot == "metro" ||
gConfig.testRoot == "webapprtChrome") {
// Make sure to launch the test harness for the first opened window only
var prefs = Services.prefs;
if (prefs.prefHasUserValue("testing.browserTestHarness.running"))

View File

@ -251,6 +251,11 @@ class MochitestOptions(optparse.OptionParser):
help = "Delay execution between test files.")
defaults["runSlower"] = False
self.add_option("--metro-immersive",
action = "store_true", dest = "immersiveMode",
help = "launches tests in immersive browser")
defaults["immersiveMode"] = False
# -h, --help are automatically handled by OptionParser
self.set_defaults(**defaults)
@ -363,6 +368,15 @@ See <http://mochikit.com/doc/html/MochiKit/Logging.html> for details on the logg
if options.testingModulesDir[-1] != '/':
options.testingModulesDir += '/'
if options.immersiveMode:
if not self._automation.IS_WIN32:
self.error("immersive is only supported on Windows 8 and up.")
mochitest.immersiveHelperPath = os.path.join(
options.utilityPath, "metrotestharness.exe")
if not os.path.exists(mochitest.immersiveHelperPath):
self.error("%s not found, cannot launch immersive tests." %
mochitest.immersiveHelperPath)
return options
@ -718,6 +732,9 @@ class Mochitest(object):
options.browserArgs.extend(('-test-mode', testURL))
testURL = None
if options.immersiveMode:
options.app = self.immersiveHelperPath
# Remove the leak detection file so it can't "leak" to the tests run.
# The file is not there if leak logging was not enabled in the application build.
if os.path.exists(self.leak_report_file):
@ -798,7 +815,10 @@ class Mochitest(object):
options.testPath = options.testPath.replace("\\", "\\\\")
testRoot = 'chrome'
if (options.browserChrome):
testRoot = 'browser'
if (options.immersiveMode):
testRoot = 'metro'
else:
testRoot = 'browser'
elif (options.a11y):
testRoot = 'a11y'
elif (options.webapprtChrome):