diff --git a/modules/benchpress/src/webdriver/chrome_driver_extension.js b/modules/benchpress/src/webdriver/chrome_driver_extension.js index ec9174d4fc..b614035d20 100644 --- a/modules/benchpress/src/webdriver/chrome_driver_extension.js +++ b/modules/benchpress/src/webdriver/chrome_driver_extension.js @@ -116,7 +116,11 @@ function normalizeEvent(chromeEvent, data) { 'ts': chromeEvent['ts'] / 1000 }; if (chromeEvent['ph'] === 'X') { - result['dur'] = chromeEvent['dur'] / 1000; + var dur = chromeEvent['dur']; + if (isBlank(dur)) { + dur = chromeEvent['tdur']; + } + result['dur'] = isBlank(dur) ? 0.0 : dur / 1000; } StringMapWrapper.forEach(data, (value, prop) => { result[prop] = value; diff --git a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.js b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.js index adcece7389..16272d87dc 100644 --- a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.js +++ b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.js @@ -83,6 +83,17 @@ export function main() { }); }); + it('should normalize "tdur" to "dur"', (done) => { + var event = chromeTimelineEvents.create('X', 'FunctionCall', 1100, null); + event['tdur'] = 5500; + createExtension([event]).readPerfLog().then( (events) => { + expect(events).toEqual([ + normEvents.complete('script', 1.1, 5.5, null), + ]); + done(); + }); + }); + it('should report FunctionCall events as "script"', (done) => { createExtension([ chromeTimelineEvents.start('FunctionCall', 0)