Bug 1275608 - [mozrunner] Remove wait_for_system_message from Emulator; r=ahal
authorMaja Frydrychowicz <mjzffr@gmail.com>
Wed, 25 May 2016 11:53:25 -0400
changeset 338024 b284943099b5c9982078193ce21d263e051515ce
parent 338023 a50249d48b1e86a3749bccc51ece4d1a827a621c
child 338025 a3a5b2614b5d3479e48dd749270798b9a8c12b07
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersahal
bugs1275608
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1275608 - [mozrunner] Remove wait_for_system_message from Emulator; r=ahal This code is no longer used by Marionette client or elsewhere. MozReview-Commit-ID: 4lx9CN7XIeH
testing/mozbase/mozrunner/mozrunner/devices/emulator.py
testing/mozbase/mozrunner/mozrunner/utils.py
--- a/testing/mozbase/mozrunner/mozrunner/devices/emulator.py
+++ b/testing/mozbase/mozrunner/mozrunner/devices/emulator.py
@@ -12,17 +12,16 @@ import tempfile
 import time
 
 from mozprocess import ProcessHandler
 
 from .base import Device
 from .emulator_battery import EmulatorBattery
 from .emulator_geo import EmulatorGeo
 from .emulator_screen import EmulatorScreen
-from ..utils import uses_marionette
 from ..errors import TimeoutException
 
 class ArchContext(object):
     def __init__(self, arch, context, binary=None):
         kernel = os.path.join(context.homedir, 'prebuilts', 'qemu-kernel', '%s', '%s')
         sysdir = os.path.join(context.homedir, 'out', 'target', 'product', '%s')
         if arch == 'x86':
             self.binary = os.path.join(context.bindir, 'emulator-x86')
@@ -170,47 +169,16 @@ class Emulator(Device):
         if self.proc:
             self.proc.kill()
             self.proc = None
 
         # Remove temporary files
         self.userdata.close()
         shutil.rmtree(self.tmpdir)
 
-    # TODO this function is B2G specific and shouldn't live here
-    @uses_marionette
-    def wait_for_system_message(self, marionette):
-        marionette.set_script_timeout(45000)
-        # Telephony API's won't be available immediately upon emulator
-        # boot; we have to wait for the syste-message-listener-ready
-        # message before we'll be able to use them successfully.  See
-        # bug 792647.
-        print 'waiting for system-message-listener-ready...'
-        try:
-            marionette.execute_async_script("""
-waitFor(
-    function() { marionetteScriptFinished(true); },
-    function() { return isSystemMessageListenerReady(); }
-);
-            """)
-        except:
-            # Look for ScriptTimeoutException this way to avoid a
-            # dependency on the marionette python client.
-            exc_name = sys.exc_info()[0].__name__
-            if exc_name != 'ScriptTimeoutException':
-                raise
-
-            print 'timed out'
-            # We silently ignore the timeout if it occurs, since
-            # isSystemMessageListenerReady() isn't available on
-            # older emulators.  45s *should* be enough of a delay
-            # to allow telephony API's to work.
-            pass
-        print '...done'
-
     def _get_telnet_response(self, command=None):
         output = []
         assert(self.telnet)
         if command is not None:
             self.telnet.write('%s\n' % command)
         while True:
             line = self.telnet.read_until('\n')
             output.append(line.rstrip())
--- a/testing/mozbase/mozrunner/mozrunner/utils.py
+++ b/testing/mozbase/mozrunner/mozrunner/utils.py
@@ -69,37 +69,16 @@ if __name__ == '__main__':
 def _find_marionette_in_args(*args, **kwargs):
     try:
         m = [a for a in args + tuple(kwargs.values()) if hasattr(a, 'session')][0]
     except IndexError:
         print("Can only apply decorator to function using a marionette object")
         raise
     return m
 
-def uses_marionette(func):
-    """Decorator which creates a marionette session and deletes it
-    afterwards if one doesn't already exist.
-    """
-    @wraps(func)
-    def _(*args, **kwargs):
-        m = _find_marionette_in_args(*args, **kwargs)
-        delete_session = False
-        if not m.session:
-            delete_session = True
-            m.start_session()
-
-        m.set_context(m.CONTEXT_CHROME)
-        ret = func(*args, **kwargs)
-
-        if delete_session:
-            m.delete_session()
-
-        return ret
-    return _
-
 
 def _raw_log():
     import logging
     return logging.getLogger(__name__)
 
 
 def test_environment(xrePath, env=None, crashreporter=True, debugger=False,
                      dmdPath=None, lsanPath=None, log=None):