Bug 753013 reuse secondary emulators, r=mdas, DONTBUILD because NPOTB

This commit is contained in:
Jonathan Griffin 2012-05-09 13:39:19 -07:00
Родитель 8fa8928a94
Коммит 6bd9a2374a
4 изменённых файлов: 18 добавлений и 12 удалений

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

@ -81,6 +81,7 @@ waitFor(function() {
# Verify that the callstate changes to connected on the caller as well.
self.assertTrue(receiver.execute_async_script("""
waitFor(function() {
window.wrappedJSObject.incoming.hangUp();
marionetteScriptFinished(true);
}, function() {
return window.wrappedJSObject.callstate == "connected";

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

@ -52,4 +52,6 @@ window.navigator.mozTelephony.dial("%s");
# Verify the phone number of the incoming call.
self.assertEqual(received, fromPhoneNumber)
sender.execute_script("window.navigator.mozTelephony.calls[0].hangUp();")
receiver.execute_script("window.navigator.mozTelephony.calls[0].hangUp();")

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

@ -111,6 +111,7 @@ class Marionette(object):
self.session = None
self.window = None
self.emulator = None
self.extra_emulators = []
self.homedir = homedir
self.baseurl = baseurl
self.noWindow = noWindow
@ -141,6 +142,8 @@ class Marionette(object):
self.emulator.close()
if self.b2gbin:
self.b2ginstance.close()
for qemu in self.extra_emulators:
qemu.emulator.close()
def _send_message(self, command, response_key, **kwargs):
if not self.session and command not in ('newSession', 'getStatus'):

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

@ -18,7 +18,6 @@ def skip_if_b2g(target):
class CommonTestCase(unittest.TestCase):
def __init__(self, methodName):
self._qemu = []
unittest.TestCase.__init__(self, methodName)
def kill_gaia_app(self, url):
@ -56,26 +55,27 @@ window.addEventListener('message', function frameload(e) {
def tearDown(self):
if self.marionette.session is not None:
self.marionette.delete_session()
for _qemu in self._qemu:
_qemu.emulator.close()
_qemu = None
self._qemu = []
class MarionetteTestCase(CommonTestCase):
def __init__(self, marionette, methodName='runTest', **kwargs):
self.marionette = marionette
self.extra_emulator_index = -1
CommonTestCase.__init__(self, methodName, **kwargs)
def get_new_emulator(self):
_qemu = Marionette(emulator=True,
homedir=self.marionette.homedir,
baseurl=self.marionette.baseurl,
noWindow=self.marionette.noWindow)
_qemu.start_session()
self._qemu.append(_qemu)
return _qemu
self.extra_emulator_index += 1
if len(self.marionette.extra_emulators) == self.extra_emulator_index:
qemu = Marionette(emulator=True,
homedir=self.marionette.homedir,
baseurl=self.marionette.baseurl,
noWindow=self.marionette.noWindow)
qemu.start_session()
self.marionette.extra_emulators.append(qemu)
else:
qemu = self.marionette.extra_emulators[self.extra_emulator_index]
return qemu
class MarionetteJSTestCase(CommonTestCase):