Backed out changeset ec9fc64e82a8 (bug 940955) for landing with the wrong bug number

This commit is contained in:
Wes Kocher 2014-11-17 15:51:09 -08:00
Родитель 05c55c6ad0
Коммит 7a99b4b8a3
3 изменённых файлов: 19 добавлений и 33 удалений

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

@ -30,13 +30,12 @@ class GeckoInstance(object):
"browser.tabs.remote.autostart.1": False,
"browser.tabs.remote.autostart.2": False}
def __init__(self, host, port, bin, profile_path=None, app_args=None, symbols_path=None,
gecko_log=None, prefs=None, profile=None):
def __init__(self, host, port, bin, profile, app_args=None, symbols_path=None,
gecko_log=None, prefs=None):
self.marionette_host = host
self.marionette_port = port
self.bin = bin
self.profile_path = profile_path
self.profile = None
self.profile_path = profile
self.prefs = prefs
self.app_args = app_args or []
self.runner = None
@ -47,14 +46,12 @@ class GeckoInstance(object):
profile_args = {"preferences": deepcopy(self.required_prefs)}
if self.prefs:
profile_args["preferences"].update(self.prefs)
if not self.profile:
if not self.profile_path:
profile_args["restore"] = False
self.profile = Profile(**profile_args)
else:
profile_args["path_from"] = self.profile_path
self.profile = Profile.clone(**profile_args)
if not self.profile_path:
profile_args["restore"] = False
profile = Profile(**profile_args)
else:
profile_args["path_from"] = self.profile_path
profile = Profile.clone(**profile_args)
if self.gecko_log is None:
self.gecko_log = 'gecko.log'
@ -94,7 +91,7 @@ class GeckoInstance(object):
'MOZ_CRASHREPORTER_NO_REPORT': '1', })
self.runner = Runner(
binary=self.bin,
profile=self.profile,
profile=profile,
cmdargs=['-no-remote', '-marionette'] + self.app_args,
env=env,
symbols_path=self.symbols_path,
@ -108,11 +105,7 @@ class GeckoInstance(object):
self.runner.stop()
self.runner.cleanup()
def restart(self, prefs=None, clean=True):
if clean:
self.profile.cleanup()
self.profile = None
def restart(self, prefs=None):
self.close()
if prefs:
self.prefs = prefs

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

@ -477,7 +477,6 @@ class Marionette(object):
self.host = host
self.port = self.local_port = port
self.bin = bin
self.profile = profile
self.instance = None
self.session = None
self.session_id = None
@ -515,7 +514,7 @@ class Marionette(object):
KeyError):
instance_class = geckoinstance.GeckoInstance
self.instance = instance_class(host=self.host, port=self.port,
bin=self.bin, profile=self.profile,
bin=self.bin, profile=profile,
app_args=app_args, symbols_path=symbols_path,
gecko_log=gecko_log)
self.instance.start()
@ -531,7 +530,7 @@ class Marionette(object):
binary=emulator_binary,
userdata=emulator_img,
resolution=emulator_res,
profile=self.profile,
profile=profile,
adb_path=adb_path,
process_args=process_args)
self.emulator = self.runner.device
@ -791,20 +790,20 @@ class Marionette(object):
self.start_session()
self._reset_timeouts()
def restart(self, clean=False):
def restart_with_clean_profile(self):
"""
This will terminate the currently running instance, and spawn a new instance
with the same profile and then reuse the session id when creating a session again.
with a clean profile.
: param prefs: A dictionary whose keys are preference names.
"""
if not self.instance:
raise errors.MarionetteException("restart can only be called " \
raise errors.MarionetteException("enforce_gecko_prefs can only be called " \
"on gecko instances launched by Marionette")
self.delete_session()
self.instance.restart(clean=clean)
self.instance.restart()
assert(self.wait_for_port()), "Timed out waiting for port!"
self.start_session(session_id=self.session_id)
self.start_session()
self._reset_timeouts()
def absolute_url(self, relative_url):

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

@ -27,12 +27,6 @@ class TestLog(MarionetteTestCase):
self.assertFalse(bool_value)
def test_clean_profile(self):
self.marionette.restart(clean=True)
self.marionette.restart_with_clean_profile()
with self.assertRaisesRegexp(JavascriptException, "Error getting pref"):
bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.bool');")
def test_can_restart_the_browser(self):
self.marionette.enforce_gecko_prefs({"marionette.test.restart": True})
self.marionette.restart()
bool_value = self.marionette.execute_script("return SpecialPowers.getBoolPref('marionette.test.restart');")
self.assertTrue(bool_value)