Bug 1068440: Uplift Add-on SDK to Firefox.

cc3242d1ca...cbf6cdd0d6
This commit is contained in:
Dave Townsend
2014-09-26 08:32:55 -07:00
parent caf3c1bdc9
commit f1e5377077
88 changed files with 1206 additions and 1464 deletions

View File

@@ -18,6 +18,7 @@ from cuddlefish.prefs import DEFAULT_FIREFOX_PREFS
from cuddlefish.prefs import DEFAULT_THUNDERBIRD_PREFS
from cuddlefish.prefs import DEFAULT_FENNEC_PREFS
from cuddlefish.prefs import DEFAULT_NO_CONNECTIONS_PREFS
from cuddlefish.prefs import DEFAULT_TEST_PREFS
# Used to remove noise from ADB output
CLEANUP_ADB = re.compile(r'^(I|E)/(stdout|stderr|GeckoConsole)\s*\(\s*\d+\):\s*(.*)$')
@@ -104,30 +105,6 @@ class FennecProfile(mozrunner.Profile):
preferences = {}
names = ['fennec']
class FennecRunner(mozrunner.Runner):
profile_class = FennecProfile
names = ['fennec']
__DARWIN_PATH = '/Applications/Fennec.app/Contents/MacOS/fennec'
def __init__(self, binary=None, **kwargs):
if sys.platform == 'darwin' and binary and binary.endswith('.app'):
# Assume it's a Fennec app dir.
binary = os.path.join(binary, 'Contents/MacOS/fennec')
self.__real_binary = binary
mozrunner.Runner.__init__(self, **kwargs)
def find_binary(self):
if not self.__real_binary:
if sys.platform == 'darwin':
if os.path.exists(self.__DARWIN_PATH):
return self.__DARWIN_PATH
self.__real_binary = mozrunner.Runner.find_binary(self)
return self.__real_binary
FENNEC_REMOTE_PATH = '/mnt/sdcard/jetpack-profile'
class RemoteFennecRunner(mozrunner.Runner):
@@ -167,11 +144,11 @@ class RemoteFennecRunner(mozrunner.Runner):
# or use name given as cfx `--mobile-app` argument.
intents = self.getIntentNames()
if not intents:
raise ValueError("Unable to found any Firefox "
raise ValueError("Unable to find any Firefox "
"application on your device.")
elif mobile_app_name:
if not mobile_app_name in intents:
raise ValueError("Unable to found Firefox application "
raise ValueError("Unable to find Firefox application "
"with intent name '%s'\n"
"Available ones are: %s" %
(mobile_app_name, ", ".join(intents)))
@@ -412,7 +389,7 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
app_type, binary=None, profiledir=None, verbose=False,
parseable=False, enforce_timeouts=False,
logfile=None, addons=None, args=None, extra_environment={},
norun=None,
norun=None, noquit=None,
used_files=None, enable_mobile=False,
mobile_app_name=None,
env_root=None,
@@ -433,6 +410,9 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
cmdargs = []
preferences = dict(DEFAULT_COMMON_PREFS)
if is_running_tests:
preferences.update(DEFAULT_TEST_PREFS)
if no_connections:
preferences.update(DEFAULT_NO_CONNECTIONS_PREFS)
@@ -440,7 +420,7 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
preferences['browser.tabs.remote.autostart'] = True
# For now, only allow running on Mobile with --force-mobile argument
if app_type in ["fennec", "fennec-on-device"] and not enable_mobile:
if app_type in ["fennec-on-device"] and not enable_mobile:
print """
WARNING: Firefox Mobile support is still experimental.
If you would like to run an addon on this platform, use --force-mobile flag:
@@ -454,10 +434,6 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
runner_class = RemoteFennecRunner
# We pass the intent name through command arguments
cmdargs.append(mobile_app_name)
elif enable_mobile or app_type == "fennec":
profile_class = FennecProfile
preferences.update(DEFAULT_FENNEC_PREFS)
runner_class = FennecRunner
elif app_type == "xulrunner":
profile_class = XulrunnerAppProfile
runner_class = XulrunnerAppRunner
@@ -763,7 +739,8 @@ def run_app(harness_root_dir, manifest_rdf, harness_options,
raise Timeout("Test run exceeded timeout (%ds)." %
RUN_TIMEOUT, test_name, parseable)
except:
runner.stop()
if not noquit:
runner.stop()
raise
else:
runner.wait(10)