summaryrefslogtreecommitdiffstats
path: root/testing/marionette/client/marionette_driver/geckoinstance.py
diff options
context:
space:
mode:
Diffstat (limited to 'testing/marionette/client/marionette_driver/geckoinstance.py')
-rw-r--r--testing/marionette/client/marionette_driver/geckoinstance.py28
1 files changed, 26 insertions, 2 deletions
diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py
index e613415886..26ad58f360 100644
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -29,6 +29,10 @@ from six import reraise
from . import errors
+if sys.platform.startswith("darwin"):
+ # Marionette's own processhandler is only used on MacOS for now
+ from .processhandler import UNKNOWN_RETURNCODE, ProcessHandler
+
class GeckoInstance(object):
required_prefs = {
@@ -388,7 +392,7 @@ class GeckoInstance(object):
}
)
- return {
+ args = {
"binary": self.binary,
"profile": self.profile,
"cmdargs": ["-no-remote", "-marionette"] + self.app_args,
@@ -397,6 +401,13 @@ class GeckoInstance(object):
"process_args": process_args,
}
+ if sys.platform.startswith("darwin"):
+ # Bug 1887666: The custom process handler class for Marionette is
+ # only supported on MacOS at the moment.
+ args["process_class"] = ProcessHandler
+
+ return args
+
def close(self, clean=False):
"""
Close the managed Gecko process.
@@ -431,6 +442,19 @@ class GeckoInstance(object):
self.close(clean=clean)
self.start()
+ def update_process(self, pid, timeout=None):
+ """Update the process to track when the application re-launched itself"""
+ if sys.platform.startswith("darwin"):
+ # The new process handler is only supported on MacOS yet
+ returncode = self.runner.process_handler.update_process(pid, timeout)
+ if returncode not in [0, UNKNOWN_RETURNCODE]:
+ raise IOError(
+ f"Old process inappropriately quit with exit code: {returncode}"
+ )
+
+ else:
+ returncode = self.runner.process_handler.check_for_detached(pid)
+
class FennecInstance(GeckoInstance):
fennec_prefs = {
@@ -454,7 +478,7 @@ class FennecInstance(GeckoInstance):
package_name=None,
env=None,
*args,
- **kwargs
+ **kwargs,
):
required_prefs = deepcopy(FennecInstance.fennec_prefs)
required_prefs.update(kwargs.get("prefs", {}))