Bug 857599 - Clone profile for Marionette tests to prevent polluting the original profile. r=jgriffin

This commit is contained in:
Dave Hunt 2013-04-10 09:31:35 +01:00
Родитель 12f5f98da7
Коммит 5a36971982
1 изменённых файлов: 12 добавлений и 4 удалений

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

@ -2,6 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/
from mozprofile import Profile
from mozrunner import Runner
@ -22,13 +23,15 @@ class GeckoInstance(object):
profile_path = self.profile
profile_args = {"preferences": self.required_prefs}
if not profile_path:
runner_class = Runner
profile_args["restore"] = False
else:
profile_args["profile"] = profile_path
runner_class = CloneRunner
profile_args["path_from"] = profile_path
print "starting runner"
self.runner = Runner.create(binary=self.bin,
profile_args=profile_args,
cmdargs=['-no-remote'])
self.runner = runner_class.create(binary=self.bin,
profile_args=profile_args,
cmdargs=['-no-remote'])
self.runner.start()
def close(self):
@ -41,3 +44,8 @@ class B2GDesktopInstance(GeckoInstance):
required_prefs = {"focusmanager.testmode": True}
apps = {'b2gdesktop': B2GDesktopInstance}
class CloneRunner(Runner):
profile_class = Profile.clone