Bug 786463 - Add TEST-START and TEST-END to output, r=mdas, DONTBUILD because NPOTB

This commit is contained in:
Jonathan Griffin 2012-08-29 10:39:11 -07:00
parent ad1f0d9e7c
commit c4772eb65f
3 changed files with 24 additions and 3 deletions

View File

@ -90,12 +90,26 @@ permissions.forEach(function (perm) {
class MarionetteTestCase(CommonTestCase):
def __init__(self, marionette_weakref, methodName='runTest', **kwargs):
def __init__(self, marionette_weakref, methodName='runTest',
filepath='', **kwargs):
self._marionette_weakref = marionette_weakref
self.marionette = None
self.extra_emulator_index = -1
self.methodName = methodName
self.filepath = filepath
CommonTestCase.__init__(self, methodName, **kwargs)
def setUp(self):
CommonTestCase.setUp(self)
self.marionette.execute_script("log('TEST-START: %s:%s')" %
(self.filepath, self.methodName))
def tearDown(self):
self.marionette.set_context("content")
self.marionette.execute_script("log('TEST-END: %s:%s')" %
(self.filepath, self.methodName))
CommonTestCase.tearDown(self)
def get_new_emulator(self):
self.extra_emulator_index += 1
if len(self.marionette.extra_emulators) == self.extra_emulator_index:
@ -127,6 +141,7 @@ class MarionetteJSTestCase(CommonTestCase):
def runTest(self):
if self.marionette.session is None:
self.marionette.start_session()
self.marionette.execute_script("log('TEST-START: %s');" % self.jsFile)
f = open(self.jsFile, 'r')
js = f.read()
args = []
@ -197,6 +212,7 @@ class MarionetteJSTestCase(CommonTestCase):
self.loglines = self.marionette.get_logs()
raise
self.marionette.execute_script("log('TEST-END: %s');" % self.jsFile)

View File

@ -395,7 +395,9 @@ class MarionetteTestRunner(object):
issubclass(obj, unittest.TestCase)):
testnames = testloader.getTestCaseNames(obj)
for testname in testnames:
suite.addTest(obj(weakref.ref(self.marionette), methodName=testname))
suite.addTest(obj(weakref.ref(self.marionette),
methodName=testname,
filepath=filepath))
elif file_ext == '.js':
suite.addTest(MarionetteJSTestCase(weakref.ref(self.marionette), jsFile=filepath))

View File

@ -634,7 +634,10 @@ MarionetteDriverActor.prototype = {
}
}
else {
this.sendAsync("executeJSScript", {value:aRequest.value, args:aRequest.args, timeout:aRequest.timeout});
this.sendAsync("executeJSScript", { value:aRequest.value,
args:aRequest.args,
newSandbox:aRequest.newSandbox,
timeout:aRequest.timeout });
}
},