mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 865867 - Remove unused perf code from Marionette, r=mdas
This commit is contained in:
parent
ae998df2a8
commit
1e2ba240dc
@ -203,7 +203,6 @@ class B2GUpdateTestCase(MarionetteTestCase):
|
||||
self.duration = time.time() - self.start_time
|
||||
if self.marionette.session is not None:
|
||||
self.loglines.extend(self.marionette.get_logs())
|
||||
self.perfdata = self.marionette.get_perf_data()
|
||||
self.marionette.delete_session()
|
||||
self.marionette = None
|
||||
|
||||
|
@ -645,12 +645,6 @@ class Marionette(object):
|
||||
def get_logs(self):
|
||||
return self._send_message('getLogs', 'value')
|
||||
|
||||
def add_perf_data(self, suite, name, value):
|
||||
return self._send_message('addPerfData', 'ok', suite=suite, name=name, value=value)
|
||||
|
||||
def get_perf_data(self):
|
||||
return self._send_message('getPerfData', 'value')
|
||||
|
||||
def import_script(self, js_file):
|
||||
js = ''
|
||||
with open(js_file, 'r') as f:
|
||||
|
@ -29,7 +29,6 @@ class CommonTestCase(unittest.TestCase):
|
||||
def __init__(self, methodName):
|
||||
unittest.TestCase.__init__(self, methodName)
|
||||
self.loglines = None
|
||||
self.perfdata = None
|
||||
self.duration = 0
|
||||
|
||||
@classmethod
|
||||
@ -93,7 +92,6 @@ permissions.forEach(function (perm) {
|
||||
self.duration = time.time() - self.start_time
|
||||
if self.marionette.session is not None:
|
||||
self.loglines = self.marionette.get_logs()
|
||||
self.perfdata = self.marionette.get_perf_data()
|
||||
self.marionette.delete_session()
|
||||
self.marionette = None
|
||||
|
||||
@ -228,9 +226,8 @@ class MarionetteJSTestCase(CommonTestCase):
|
||||
self.assertEqual(0, results['failed'],
|
||||
'%d tests failed:\n%s' % (results['failed'], '\n'.join(fails)))
|
||||
|
||||
if not self.perfdata:
|
||||
self.assertTrue(results['passed'] + results['failed'] > 0,
|
||||
'no tests run')
|
||||
self.assertTrue(results['passed'] + results['failed'] > 0,
|
||||
'no tests run')
|
||||
|
||||
except ScriptTimeoutException:
|
||||
if 'timeout' in self.jsFile:
|
||||
|
@ -31,7 +31,6 @@ class MarionetteTestResult(unittest._TextTestResult):
|
||||
del kwargs['marionette']
|
||||
super(MarionetteTestResult, self).__init__(*args, **kwargs)
|
||||
self.passed = 0
|
||||
self.perfdata = None
|
||||
self.tests_passed = []
|
||||
|
||||
def addSuccess(self, test):
|
||||
@ -70,14 +69,6 @@ class MarionetteTestResult(unittest._TextTestResult):
|
||||
self.stream.writeln(' '.join(line).encode('ascii', 'replace'))
|
||||
self.stream.writeln('END LOG:')
|
||||
|
||||
def getPerfData(self, test):
|
||||
for testcase in test._tests:
|
||||
if testcase.perfdata:
|
||||
if not self.perfdata:
|
||||
self.perfdata = datazilla.DatazillaResult(testcase.perfdata)
|
||||
else:
|
||||
self.perfdata.join_results(testcase.perfdata)
|
||||
|
||||
def printErrorList(self, flavour, errors):
|
||||
for test, err in errors:
|
||||
self.stream.writeln(self.separator1)
|
||||
@ -104,8 +95,6 @@ class MarionetteTextTestRunner(unittest.TextTestRunner):
|
||||
resultclass = MarionetteTestResult
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.perf = kwargs['perf']
|
||||
del kwargs['perf']
|
||||
self.marionette = kwargs['marionette']
|
||||
del kwargs['marionette']
|
||||
unittest.TextTestRunner.__init__(self, **kwargs)
|
||||
@ -137,8 +126,6 @@ class MarionetteTextTestRunner(unittest.TextTestRunner):
|
||||
timeTaken = stopTime - startTime
|
||||
result.printErrors()
|
||||
result.printLogs(test)
|
||||
if self.perf:
|
||||
result.getPerfData(test)
|
||||
if hasattr(result, 'separator2'):
|
||||
self.stream.writeln(result.separator2)
|
||||
run = result.testsRun
|
||||
@ -186,9 +173,9 @@ class MarionetteTestRunner(object):
|
||||
app=None, bin=None, profile=None, autolog=False, revision=None,
|
||||
es_server=None, rest_server=None, logger=None,
|
||||
testgroup="marionette", noWindow=False, logcat_dir=None,
|
||||
xml_output=None, repeat=0, perf=False, perfserv=None,
|
||||
gecko_path=None, testvars=None, tree=None, type=None,
|
||||
device=None, symbols_path=None, **kwargs):
|
||||
xml_output=None, repeat=0, gecko_path=None, testvars=None,
|
||||
tree=None, type=None, device=None, symbols_path=None,
|
||||
**kwargs):
|
||||
self.address = address
|
||||
self.emulator = emulator
|
||||
self.emulatorBinary = emulatorBinary
|
||||
@ -209,11 +196,8 @@ class MarionetteTestRunner(object):
|
||||
self.baseurl = None
|
||||
self.marionette = None
|
||||
self.logcat_dir = logcat_dir
|
||||
self.perfrequest = None
|
||||
self.xml_output = xml_output
|
||||
self.repeat = repeat
|
||||
self.perf = perf
|
||||
self.perfserv = perfserv
|
||||
self.gecko_path = gecko_path
|
||||
self.testvars = {}
|
||||
self.test_kwargs = kwargs
|
||||
@ -254,7 +238,6 @@ class MarionetteTestRunner(object):
|
||||
self.failed = 0
|
||||
self.todo = 0
|
||||
self.failures = []
|
||||
self.perfrequest = None
|
||||
|
||||
def start_httpd(self):
|
||||
host = moznetwork.get_ip()
|
||||
@ -374,12 +357,6 @@ class MarionetteTestRunner(object):
|
||||
self.elapsedtime = datetime.utcnow() - starttime
|
||||
if self.autolog:
|
||||
self.post_to_autolog(self.elapsedtime)
|
||||
if self.perfrequest and options.perf:
|
||||
try:
|
||||
self.perfrequest.submit()
|
||||
except Exception, e:
|
||||
print "Could not submit to datazilla"
|
||||
print e
|
||||
|
||||
if self.xml_output:
|
||||
xml_dir = os.path.dirname(os.path.abspath(self.xml_output))
|
||||
@ -434,30 +411,6 @@ class MarionetteTestRunner(object):
|
||||
manifest = TestManifest()
|
||||
manifest.read(filepath)
|
||||
|
||||
if self.perf:
|
||||
if self.perfserv is None:
|
||||
self.perfserv = manifest.get("perfserv")[0]
|
||||
machine_name = socket.gethostname()
|
||||
try:
|
||||
manifest.has_key("machine_name")
|
||||
machine_name = manifest.get("machine_name")[0]
|
||||
except:
|
||||
self.logger.info("Using machine_name: %s" % machine_name)
|
||||
os_name = platform.system()
|
||||
os_version = platform.release()
|
||||
self.perfrequest = datazilla.DatazillaRequest(
|
||||
server=self.perfserv,
|
||||
machine_name=machine_name,
|
||||
os=os_name,
|
||||
os_version=os_version,
|
||||
platform=manifest.get("platform")[0],
|
||||
build_name=manifest.get("build_name")[0],
|
||||
version=manifest.get("version")[0],
|
||||
revision=self.revision,
|
||||
branch=manifest.get("branch")[0],
|
||||
id=os.getenv('BUILD_ID'),
|
||||
test_date=int(time.time()))
|
||||
|
||||
manifest_tests = manifest.active_tests(disabled=False)
|
||||
|
||||
for i in manifest.get(tests=manifest_tests, **testargs):
|
||||
@ -481,14 +434,11 @@ class MarionetteTestRunner(object):
|
||||
|
||||
if suite.countTestCases():
|
||||
runner = MarionetteTextTestRunner(verbosity=3,
|
||||
perf=self.perf,
|
||||
marionette=self.marionette)
|
||||
results = runner.run(suite)
|
||||
self.results.append(results)
|
||||
|
||||
self.failed += len(results.failures) + len(results.errors)
|
||||
if results.perfdata and options.perf:
|
||||
self.perfrequest.add_datazilla_result(results.perfdata)
|
||||
if hasattr(results, 'skipped'):
|
||||
self.todo += len(results.skipped) + len(results.expectedFailures)
|
||||
self.passed += results.passed
|
||||
@ -589,7 +539,7 @@ class MarionetteTestOptions(OptionParser):
|
||||
self.add_option('--revision',
|
||||
action='store',
|
||||
dest='revision',
|
||||
help='git revision for autolog/perfdata submissions')
|
||||
help='git revision for autolog submissions')
|
||||
self.add_option('--testgroup',
|
||||
action='store',
|
||||
dest='testgroup',
|
||||
@ -615,7 +565,7 @@ class MarionetteTestOptions(OptionParser):
|
||||
dest='emulator_res',
|
||||
type='str',
|
||||
help='set a custom resolution for the emulator'
|
||||
'Example: "480x800"')
|
||||
'Example: "480x800"')
|
||||
self.add_option('--no-window',
|
||||
action='store_true',
|
||||
dest='noWindow',
|
||||
@ -659,16 +609,6 @@ class MarionetteTestOptions(OptionParser):
|
||||
action='store',
|
||||
help='profile to use when launching the gecko process. if not passed, then a profile will be '
|
||||
'constructed and used')
|
||||
self.add_option('--perf',
|
||||
dest='perf',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help='send performance data to perf data server')
|
||||
self.add_option('--perf-server',
|
||||
dest='perfserv',
|
||||
action='store',
|
||||
help='dataserver for perf data submission. entering this value will overwrite the perfserv '
|
||||
'value in any passed manifest files')
|
||||
self.add_option('--repeat',
|
||||
dest='repeat',
|
||||
action='store',
|
||||
@ -712,9 +652,6 @@ class MarionetteTestOptions(OptionParser):
|
||||
if options.emulator and not options.logcat_dir:
|
||||
options.logcat_dir = 'logcat'
|
||||
|
||||
if options.perf:
|
||||
import datazilla
|
||||
|
||||
# check for valid resolution string, strip whitespaces
|
||||
try:
|
||||
if options.emulator_res:
|
||||
|
@ -1,57 +0,0 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import os
|
||||
from marionette_test import MarionetteTestCase
|
||||
|
||||
class TestPerf(MarionetteTestCase):
|
||||
def test_perf_basic(self):
|
||||
self.marionette.add_perf_data("testgroup", "testperf", 10)
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf"))
|
||||
self.assertEqual(10, data["testgroup"]["testperf"][0])
|
||||
self.marionette.add_perf_data("testgroup", "testperf", 20)
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf"))
|
||||
self.assertEqual(20, data["testgroup"]["testperf"][1])
|
||||
self.marionette.add_perf_data("testgroup", "testperf2", 20)
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf2"))
|
||||
self.assertEqual(20, data["testgroup"]["testperf2"][0])
|
||||
self.marionette.add_perf_data("testgroup2", "testperf3", 30)
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup2"))
|
||||
self.assertTrue(data["testgroup2"].has_key("testperf3"))
|
||||
self.assertEqual(30, data["testgroup2"]["testperf3"][0])
|
||||
|
||||
def test_perf_script(self):
|
||||
self.marionette.execute_script("addPerfData('testgroup', 'testperf', 10);")
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf"))
|
||||
self.assertEqual(10, data["testgroup"]["testperf"][0])
|
||||
self.marionette.execute_script("addPerfData('testgroup', 'testperf', 20);")
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf"))
|
||||
self.assertEqual(20, data["testgroup"]["testperf"][1])
|
||||
self.marionette.execute_script("addPerfData('testgroup', 'testperf2', 20);")
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup"))
|
||||
self.assertTrue(data["testgroup"].has_key("testperf2"))
|
||||
self.assertEqual(20, data["testgroup"]["testperf2"][0])
|
||||
self.marionette.execute_script("addPerfData('testgroup2', 'testperf3', 30);")
|
||||
data = self.marionette.get_perf_data()
|
||||
self.assertTrue(data.has_key("testgroup2"))
|
||||
self.assertTrue(data["testgroup2"].has_key("testperf3"))
|
||||
self.assertEqual(30, data["testgroup2"]["testperf3"][0])
|
||||
|
||||
class TestPerfChrome(TestPerf):
|
||||
def setUp(self):
|
||||
MarionetteTestCase.setUp(self)
|
||||
self.marionette.set_context("chrome")
|
||||
|
@ -29,7 +29,6 @@ b2g = false
|
||||
[test_text.py]
|
||||
b2g = false
|
||||
|
||||
[test_perf.py]
|
||||
[test_log.py]
|
||||
[test_emulator.py]
|
||||
browser = false
|
||||
|
@ -10,7 +10,6 @@ marionette.jar:
|
||||
content/marionette-sendkeys.js (marionette-sendkeys.js)
|
||||
content/marionette-log-obj.js (marionette-log-obj.js)
|
||||
content/marionette-simpletest.js (marionette-simpletest.js)
|
||||
content/marionette-perf.js (marionette-perf.js)
|
||||
content/EventUtils.js (EventUtils.js)
|
||||
content/ChromeUtils.js (ChromeUtils.js)
|
||||
#ifdef ENABLE_TESTS
|
||||
|
@ -16,7 +16,6 @@ let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
.getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-simpletest.js");
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-log-obj.js");
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-perf.js");
|
||||
Cu.import("chrome://marionette/content/marionette-elements.js");
|
||||
let utils = {};
|
||||
loader.loadSubScript("chrome://marionette/content/EventUtils.js", utils);
|
||||
@ -192,7 +191,6 @@ function MarionetteDriverActor(aConnection)
|
||||
this.pageTimeout = null;
|
||||
this.timer = null;
|
||||
this.marionetteLog = new MarionetteLogObj();
|
||||
this.marionettePerf = new MarionettePerfData();
|
||||
this.command_id = null;
|
||||
this.mainFrame = null; //topmost chrome frame
|
||||
this.curFrame = null; //subframe that currently has focus
|
||||
@ -652,23 +650,6 @@ MarionetteDriverActor.prototype = {
|
||||
this.command_id = this.getCommandId();
|
||||
this.sendResponse(this.marionetteLog.getLogs(), this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Log some performance data
|
||||
*/
|
||||
addPerfData: function MDA_addPerfData(aRequest) {
|
||||
this.command_id = this.getCommandId();
|
||||
this.marionettePerf.addPerfData(aRequest.suite, aRequest.name, aRequest.value);
|
||||
this.sendOk(this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve the performance data
|
||||
*/
|
||||
getPerfData: function MDA_getPerfData() {
|
||||
this.command_id = this.getCommandId();
|
||||
this.sendResponse(this.marionettePerf.getPerfData(), this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the context of the subsequent commands to be either 'chrome' or 'content'
|
||||
@ -820,7 +801,7 @@ MarionetteDriverActor.prototype = {
|
||||
|
||||
let curWindow = this.getCurrentWindow();
|
||||
let marionette = new Marionette(this, curWindow, "chrome",
|
||||
this.marionetteLog, this.marionettePerf,
|
||||
this.marionetteLog,
|
||||
timeout, this.testName);
|
||||
let _chromeSandbox = this.createExecuteSandbox(curWindow,
|
||||
marionette,
|
||||
@ -954,7 +935,7 @@ MarionetteDriverActor.prototype = {
|
||||
let that = this;
|
||||
that.timeout = timeout;
|
||||
let marionette = new Marionette(this, curWindow, "chrome",
|
||||
this.marionetteLog, this.marionettePerf,
|
||||
this.marionetteLog,
|
||||
timeout, this.testName);
|
||||
marionette.command_id = this.command_id;
|
||||
|
||||
@ -2204,9 +2185,6 @@ MarionetteDriverActor.prototype = {
|
||||
if (message.json.log) {
|
||||
this.marionetteLog.addLogs(message.json.log);
|
||||
}
|
||||
if (message.json.perf) {
|
||||
this.marionettePerf.appendPerfData(message.json.perf);
|
||||
}
|
||||
break;
|
||||
case "Marionette:runEmulatorCmd":
|
||||
this.sendToClient(message.json, -1);
|
||||
@ -2309,8 +2287,6 @@ MarionetteDriverActor.prototype.requestTypes = {
|
||||
"getStatus": MarionetteDriverActor.prototype.getStatus,
|
||||
"log": MarionetteDriverActor.prototype.log,
|
||||
"getLogs": MarionetteDriverActor.prototype.getLogs,
|
||||
"addPerfData": MarionetteDriverActor.prototype.addPerfData,
|
||||
"getPerfData": MarionetteDriverActor.prototype.getPerfData,
|
||||
"setContext": MarionetteDriverActor.prototype.setContext,
|
||||
"executeScript": MarionetteDriverActor.prototype.execute,
|
||||
"setScriptTimeout": MarionetteDriverActor.prototype.setScriptTimeout,
|
||||
|
@ -13,7 +13,6 @@ let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"]
|
||||
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-simpletest.js");
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-log-obj.js");
|
||||
loader.loadSubScript("chrome://marionette/content/marionette-perf.js");
|
||||
Cu.import("chrome://marionette/content/marionette-elements.js");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
Cu.import("resource://gre/modules/NetUtil.jsm");
|
||||
@ -30,7 +29,6 @@ loader.loadSubScript("chrome://specialpowers/content/specialpowersAPI.js");
|
||||
loader.loadSubScript("chrome://specialpowers/content/specialpowers.js");
|
||||
|
||||
let marionetteLogObj = new MarionetteLogObj();
|
||||
let marionettePerf = new MarionettePerfData();
|
||||
|
||||
let isB2G = false;
|
||||
|
||||
@ -323,7 +321,7 @@ function createExecuteContentSandbox(aWindow, timeout) {
|
||||
sandbox.asyncTestCommandId = asyncTestCommandId;
|
||||
|
||||
let marionette = new Marionette(this, aWindow, "content",
|
||||
marionetteLogObj, marionettePerf,
|
||||
marionetteLogObj,
|
||||
timeout, marionetteTestName);
|
||||
sandbox.marionette = marionette;
|
||||
marionette.exports.forEach(function(fn) {
|
||||
@ -344,10 +342,9 @@ function createExecuteContentSandbox(aWindow, timeout) {
|
||||
curWindow.removeEventListener("unload", onunload, false);
|
||||
curWindow.clearTimeout(asyncTestTimeoutId);
|
||||
|
||||
sendSyncMessage("Marionette:shareData", {log: elementManager.wrapValue(marionetteLogObj.getLogs()),
|
||||
perf: elementManager.wrapValue(marionettePerf.getPerfData())});
|
||||
sendSyncMessage("Marionette:shareData",
|
||||
{log: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
marionettePerf.clearPerfData();
|
||||
|
||||
if (status == 0){
|
||||
if (Object.keys(_emu_cbs).length) {
|
||||
@ -413,10 +410,10 @@ function executeScript(msg, directInject) {
|
||||
script = data + script;
|
||||
}
|
||||
let res = Cu.evalInSandbox(script, sandbox, "1.8");
|
||||
sendSyncMessage("Marionette:shareData", {log: elementManager.wrapValue(marionetteLogObj.getLogs()),
|
||||
perf: elementManager.wrapValue(marionettePerf.getPerfData())});
|
||||
sendSyncMessage("Marionette:shareData",
|
||||
{log: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
marionettePerf.clearPerfData();
|
||||
|
||||
if (res == undefined || res.passed == undefined) {
|
||||
sendError("Marionette.finish() not called", 17, null, asyncTestCommandId);
|
||||
}
|
||||
@ -444,10 +441,9 @@ function executeScript(msg, directInject) {
|
||||
scriptSrc = data + scriptSrc;
|
||||
}
|
||||
let res = Cu.evalInSandbox(scriptSrc, sandbox, "1.8");
|
||||
sendSyncMessage("Marionette:shareData", {log: elementManager.wrapValue(marionetteLogObj.getLogs()),
|
||||
perf: elementManager.wrapValue(marionettePerf.getPerfData())});
|
||||
sendSyncMessage("Marionette:shareData",
|
||||
{log: elementManager.wrapValue(marionetteLogObj.getLogs())});
|
||||
marionetteLogObj.clearLogs();
|
||||
marionettePerf.clearPerfData();
|
||||
sendResponse({value: elementManager.wrapValue(res)}, asyncTestCommandId);
|
||||
}
|
||||
}
|
||||
|
@ -1,83 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
function MarionettePerfData() {
|
||||
this.perfData = {};
|
||||
}
|
||||
MarionettePerfData.prototype = {
|
||||
/**
|
||||
* Add performance data.
|
||||
*
|
||||
* Datapoints within a testSuite get rolled up into
|
||||
* one value in Datazilla. You can then drill down to
|
||||
* individual (testName,data) pairs
|
||||
*
|
||||
* If the testSuite and testName exist, the data will
|
||||
* be added to this dataset.
|
||||
*
|
||||
* @param testSuite String
|
||||
* name of the test suite
|
||||
* @param testName String
|
||||
* name of the test
|
||||
* @param object data
|
||||
* data value to store
|
||||
*/
|
||||
addPerfData: function Marionette__addPerfData(testSuite, testName, data) {
|
||||
if (this.perfData[testSuite]) {
|
||||
if (this.perfData[testSuite][testName]) {
|
||||
this.perfData[testSuite][testName].push(data);
|
||||
}
|
||||
else {
|
||||
this.perfData[testSuite][testName.toString()] = [data];
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.perfData[testSuite] = {}
|
||||
this.perfData[testSuite][testName.toString()] = [data];
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Join another set of performance data this this set.
|
||||
* Used by the actor to join data gathered from the listener
|
||||
* @param object data
|
||||
* The performance data to join
|
||||
*/
|
||||
appendPerfData: function Marionette__appendPerfData(data) {
|
||||
for (var suite in data) {
|
||||
if (data.hasOwnProperty(suite)) {
|
||||
if (this.perfData[suite]) {
|
||||
for (var test in data[suite]) {
|
||||
if (this.perfData[suite][test]) {
|
||||
this.perfData[suite][test] = this.perfData[suite][test].concat(data[suite][test]);
|
||||
}
|
||||
else {
|
||||
this.perfData[suite][test] = data[suite][test];
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.perfData[suite] = data[suite];
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve the performance data
|
||||
*
|
||||
* @return object
|
||||
* Returns a list of test names to metric value
|
||||
*/
|
||||
getPerfData: function Marionette__getPerfData() {
|
||||
return this.perfData;
|
||||
},
|
||||
|
||||
/**
|
||||
* Clears the current performance data
|
||||
*/
|
||||
clearPerfData: function Marionette_clearPerfData() {
|
||||
this.perfData = {};
|
||||
},
|
||||
}
|
@ -5,12 +5,11 @@
|
||||
* The Marionette object, passed to the script context.
|
||||
*/
|
||||
|
||||
function Marionette(scope, window, context, logObj, perfData, timeout, testName) {
|
||||
function Marionette(scope, window, context, logObj, timeout, testName) {
|
||||
this.scope = scope;
|
||||
this.window = window;
|
||||
this.tests = [];
|
||||
this.logObj = logObj;
|
||||
this.perfData = perfData;
|
||||
this.context = context;
|
||||
this.timeout = timeout;
|
||||
this.testName = testName;
|
||||
@ -21,8 +20,8 @@ function Marionette(scope, window, context, logObj, perfData, timeout, testName)
|
||||
|
||||
Marionette.prototype = {
|
||||
exports: ['ok', 'is', 'isnot', 'log', 'getLogs', 'generate_results', 'waitFor',
|
||||
'runEmulatorCmd', 'addPerfData', 'getPerfData', 'TEST_PASS',
|
||||
'TEST_KNOWN_FAIL', 'TEST_UNEXPECTED_FAIL'],
|
||||
'runEmulatorCmd', 'TEST_PASS', 'TEST_KNOWN_FAIL',
|
||||
'TEST_UNEXPECTED_FAIL'],
|
||||
|
||||
ok: function Marionette__ok(condition, name, passString, failString, diag) {
|
||||
if (typeof(diag) == "undefined") {
|
||||
@ -49,14 +48,6 @@ Marionette.prototype = {
|
||||
this.ok(pass, name, passString, failString, diag);
|
||||
},
|
||||
|
||||
addPerfData: function Marionette__addPerfData(testSuite, testName, data) {
|
||||
this.perfData.addPerfData(testSuite, testName, data);
|
||||
},
|
||||
|
||||
getPerfData: function Marionette__getPerfData() {
|
||||
return this.perfData.perfData;
|
||||
},
|
||||
|
||||
log: function Marionette__log(msg, level) {
|
||||
dump("MARIONETTE LOG: " + (level ? level : "INFO") + ": " + msg + "\n");
|
||||
if (this.logObj != null) {
|
||||
|
Loading…
Reference in New Issue
Block a user