bug 1125394 - launch runtime executable stub from test app bundle on Mac; r=jmaher,marco

This commit is contained in:
Myk Melez 2015-05-06 15:17:34 -07:00
parent 88df218627
commit c4dcb24922
4 changed files with 63 additions and 6 deletions

View File

@ -8,6 +8,7 @@ from argparse import Namespace
import logging
import mozpack.path as mozpath
import os
import shutil
import sys
import warnings
import which
@ -90,17 +91,41 @@ class MochitestRunner(MozbuildObject):
def get_webapp_runtime_path(self):
import mozinfo
appname = 'webapprt-stub' + mozinfo.info.get('bin_suffix', '')
app_name = 'webapprt-stub' + mozinfo.info.get('bin_suffix', '')
app_path = os.path.join(self.distdir, 'bin', app_name)
if sys.platform.startswith('darwin'):
appname = os.path.join(
# On Mac, we copy the stub from the dist dir to the test app bundle,
# since we have to run it from a bundle for its windows to appear.
# Ideally, the build system would do this for us, and we should find
# a way for it to do that.
mac_dir_name = os.path.join(
self.mochitest_dir,
'webapprtChrome',
'webapprt',
'test',
'chrome',
'TestApp.app',
'Contents',
'MacOS')
mac_app_name = 'webapprt' + mozinfo.info.get('bin_suffix', '')
mac_app_path = os.path.join(mac_dir_name, mac_app_name)
shutil.copy(app_path, mac_app_path)
return mac_app_path
return app_path
# On Mac, the app invoked by runtests.py is in a different app bundle
# (as determined by get_webapp_runtime_path above), but the XRE path should
# still point to the browser's app bundle, so we set it here explicitly.
def get_webapp_runtime_xre_path(self):
if sys.platform.startswith('darwin'):
xre_path = os.path.join(
self.distdir,
self.substs['MOZ_MACBUNDLE_NAME'],
'Contents',
'Resources',
appname)
'Resources')
else:
appname = os.path.join(self.distdir, 'bin', appname)
return appname
xre_path = os.path.join(self.distdir, 'bin')
return xre_path
def __init__(self, *args, **kwargs):
MozbuildObject.__init__(self, *args, **kwargs)
@ -244,11 +269,13 @@ class MochitestRunner(MozbuildObject):
options.webapprtContent = True
if not options.app or options.app == self.get_binary_path():
options.app = self.get_webapp_runtime_path()
options.xrePath = self.get_webapp_runtime_xre_path()
elif suite == 'webapprt-chrome':
options.webapprtChrome = True
options.browserArgs.append("-test-mode")
if not options.app or options.app == self.get_binary_path():
options.app = self.get_webapp_runtime_path()
options.xrePath = self.get_webapp_runtime_xre_path()
else:
raise Exception('None or unrecognized mochitest suite type.')

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>TestApp</string>
<key>CFBundleExecutable</key>
<string>webapprt</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>TestApp</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleVersion</key>
<string>0</string>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSPrincipalClass</key>
<string>GeckoNSApplication</string>
<key>FirefoxBinary</key>
<string>org.mozilla.nightly</string>
</dict>
</plist>

View File

@ -0,0 +1,2 @@
[Webapp]
Name=TestApp

View File

@ -49,6 +49,8 @@ support-files =
install-app.html
install-app.webapp
install-app.webapp^headers^
TestApp.app/Contents/Info.plist
TestApp.app/Contents/MacOS/webapp.ini
[browser_alarm.js]
[browser_debugger.js]