From 37b8691c8c7dda3c40adaabd91af6aced83f9a23 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Wed, 14 Sep 2016 18:04:30 -0700 Subject: [PATCH] refactor(benchpress): remove chrome < v44 support --- .../src/webdriver/chrome_driver_extension.ts | 43 +------------------ 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/modules/@angular/benchpress/src/webdriver/chrome_driver_extension.ts b/modules/@angular/benchpress/src/webdriver/chrome_driver_extension.ts index b7d5327b93..448538c3a3 100644 --- a/modules/@angular/benchpress/src/webdriver/chrome_driver_extension.ts +++ b/modules/@angular/benchpress/src/webdriver/chrome_driver_extension.ts @@ -28,6 +28,7 @@ export class ChromeDriverExtension extends WebDriverExtension { constructor(private _driver: WebDriverAdapter, @Inject(Options.USER_AGENT) userAgent: string) { super(); this._majorChromeVersion = this._parseChromeVersion(userAgent); + } private _parseChromeVersion(userAgent: string): number { @@ -114,9 +115,6 @@ export class ChromeDriverExtension extends WebDriverExtension { this._isEvent( categories, name, ['disabled-by-default-devtools.timeline'], 'CompositeLayers')) { normalizedEvents.push(normalizeEvent(event, {'name': 'render'})); - } else if (this._majorChromeVersion < 45) { - var normalizedEvent = this._processAsPreChrome45Event(event, categories, majorGCPids); - if (normalizedEvent != null) normalizedEvents.push(normalizedEvent); } else { var normalizedEvent = this._processAsPostChrome44Event(event, categories); if (normalizedEvent != null) normalizedEvents.push(normalizedEvent); @@ -125,43 +123,6 @@ export class ChromeDriverExtension extends WebDriverExtension { return normalizedEvents; } - private _processAsPreChrome45Event( - event: {[key: string]: any}, categories: string[], majorGCPids: {[key: string]: any}) { - var name = event['name']; - var args = event['args']; - var pid = event['pid']; - var ph = event['ph']; - if (this._isEvent( - categories, name, ['disabled-by-default-devtools.timeline'], 'FunctionCall') && - (!args || !args['data'] || - args['data']['scriptName'] !== 'InjectedScript')) { - return normalizeEvent(event, {'name': 'script'}); - } else if ( - this._isEvent( - categories, name, ['disabled-by-default-devtools.timeline'], 'RecalculateStyles') || - this._isEvent(categories, name, ['disabled-by-default-devtools.timeline'], 'Layout') || - this._isEvent( - categories, name, ['disabled-by-default-devtools.timeline'], 'UpdateLayerTree') || - this._isEvent(categories, name, ['disabled-by-default-devtools.timeline'], 'Paint')) { - return normalizeEvent(event, {'name': 'render'}); - } else if (this._isEvent( - categories, name, ['disabled-by-default-devtools.timeline'], 'GCEvent')) { - var normArgs: {[key: string]: any} = { - 'usedHeapSize': args['usedHeapSizeAfter'] ? args['usedHeapSizeAfter'] : - args['usedHeapSizeBefore'] - }; - if (ph === 'E') { - normArgs['majorGc'] = majorGCPids[pid] && majorGCPids[pid]; - } - majorGCPids[pid] = false; - return normalizeEvent(event, {'name': 'gc', 'args': normArgs}); - } else if ( - this._isEvent(categories, name, ['v8'], 'majorGC') && ph === 'B') { - majorGCPids[pid] = true; - } - return null; // nothing useful in this event - } - private _processAsPostChrome44Event(event: {[key: string]: any}, categories: string[]) { var name = event['name']; var args = event['args']; @@ -222,7 +183,7 @@ export class ChromeDriverExtension extends WebDriverExtension { } supports(capabilities: {[key: string]: any}): boolean { - return this._majorChromeVersion != -1 && + return this._majorChromeVersion >=44 && capabilities['browserName'].toLowerCase() === 'chrome'; } }