From 4f3be31bf751dead95f6e2c32ad539f71b76496c Mon Sep 17 00:00:00 2001 From: Ted Mielczarek Date: Wed, 7 Jan 2015 14:17:05 -0500 Subject: [PATCH] bug 859952 - B2GDesktopInstance should clone the gaia profile by default. r=ahal --- .../client/marionette/geckoinstance.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/testing/marionette/client/marionette/geckoinstance.py b/testing/marionette/client/marionette/geckoinstance.py index 43b88dae2aaa..700ce81ad3f5 100644 --- a/testing/marionette/client/marionette/geckoinstance.py +++ b/testing/marionette/client/marionette/geckoinstance.py @@ -149,8 +149,22 @@ def restart(self, prefs=None, clean=True): self.start() class B2GDesktopInstance(GeckoInstance): - def __init__(self, **kwargs): - super(B2GDesktopInstance, self).__init__(**kwargs) + def __init__(self, host, port, bin, **kwargs): + # Pass a profile and change the binary to -bin so that + # the built-in gaia profile doesn't get touched. + if kwargs.get('profile', None) is None: + # GeckoInstance.start will clone the profile. + kwargs['profile'] = os.path.join(os.path.dirname(bin), + 'gaia', + 'profile') + if '-bin' not in os.path.basename(bin): + if bin.endswith('.exe'): + newbin = bin[:-len('.exe')] + '-bin.exe' + else: + newbin = bin + '-bin' + if os.path.exists(newbin): + bin = newbin + super(B2GDesktopInstance, self).__init__(host, port, bin, **kwargs) if not self.prefs: self.prefs = {} self.prefs["focusmanager.testmode"] = True