mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-27 02:43:07 +00:00
Bug 803253 - Only wait for system-message-listener-ready on emulator startup, r=mdas, DONTBUILD(NPOTB)
This commit is contained in:
parent
e93f3a4f01
commit
5d6d95b924
@ -134,6 +134,32 @@ class Marionette(object):
|
||||
|
||||
self.client = MarionetteClient(self.host, self.port)
|
||||
|
||||
if emulator:
|
||||
# When launching an emulator, telephony API's are not
|
||||
# available immediately. They start working after the
|
||||
# system-message-listener-ready event is observed. See
|
||||
# bug 792647. This code causes us to wait for this event
|
||||
# after launching an emulator, before allowing any tests
|
||||
# to run.
|
||||
self.start_session()
|
||||
self.set_context(self.CONTEXT_CHROME)
|
||||
self.set_script_timeout(30000)
|
||||
try:
|
||||
self.execute_async_script("""
|
||||
waitFor(
|
||||
function() { marionetteScriptFinished(true); },
|
||||
function() { return isSystemMessageListenerReady(); }
|
||||
);
|
||||
""")
|
||||
except ScriptTimeoutException:
|
||||
# We silently ignore the timeout if it occurs, since
|
||||
# isSystemMessageListenerReady() isn't available on
|
||||
# older emulators. 30s *should* be enough of a delay
|
||||
# to allow telephony API's to work.
|
||||
pass
|
||||
self.set_context(self.CONTEXT_CONTENT)
|
||||
self.delete_session()
|
||||
|
||||
def __del__(self):
|
||||
if self.emulator:
|
||||
self.emulator.close()
|
||||
|
@ -160,16 +160,6 @@ class MarionetteJSTestCase(CommonTestCase):
|
||||
self.marionette.start_session()
|
||||
self.marionette.execute_script("log('TEST-START: %s');" % self.jsFile.replace('\\', '\\\\'))
|
||||
|
||||
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
|
||||
self.marionette.set_script_timeout(30000)
|
||||
self.marionette.execute_async_script("""
|
||||
waitFor(
|
||||
function() { marionetteScriptFinished(true); },
|
||||
function() { return isSystemMessageListenerReady(); }
|
||||
);
|
||||
""")
|
||||
self.marionette.set_context(self.marionette.CONTEXT_CONTENT)
|
||||
|
||||
f = open(self.jsFile, 'r')
|
||||
js = f.read()
|
||||
args = []
|
||||
|
Loading…
Reference in New Issue
Block a user