refactor(benchpress): ensure compatibility with noImplicitOverride (#42512)

Adds the `override` keyword to the `benchpress` sources to ensure
compatibility with `noImplicitOverride`.

PR Close #42512
This commit is contained in:
Paul Gschwendtner 2021-06-07 21:04:08 +02:00 committed by Andrew Kushnir
parent 634ba9ccbc
commit ff87da36e7
21 changed files with 73 additions and 69 deletions

View File

@ -33,7 +33,7 @@ export class MultiMetric extends Metric {
/** /**
* Starts measuring * Starts measuring
*/ */
beginMeasure(): Promise<any> { override beginMeasure(): Promise<any> {
return Promise.all(this._metrics.map(metric => metric.beginMeasure())); return Promise.all(this._metrics.map(metric => metric.beginMeasure()));
} }
@ -42,7 +42,7 @@ export class MultiMetric extends Metric {
* since the begin call. * since the begin call.
* @param restart: Whether to restart right after this. * @param restart: Whether to restart right after this.
*/ */
endMeasure(restart: boolean): Promise<{[key: string]: any}> { override endMeasure(restart: boolean): Promise<{[key: string]: any}> {
return Promise.all(this._metrics.map(metric => metric.endMeasure(restart))) return Promise.all(this._metrics.map(metric => metric.endMeasure(restart)))
.then(values => mergeStringMaps(<any>values)); .then(values => mergeStringMaps(<any>values));
} }
@ -51,7 +51,7 @@ export class MultiMetric extends Metric {
* Describes the metrics provided by this metric implementation. * Describes the metrics provided by this metric implementation.
* (e.g. units, ...) * (e.g. units, ...)
*/ */
describe(): {[key: string]: any} { override describe(): {[key: string]: any} {
return mergeStringMaps(this._metrics.map((metric) => metric.describe())); return mergeStringMaps(this._metrics.map((metric) => metric.describe()));
} }
} }

View File

@ -69,7 +69,7 @@ export class PerflogMetric extends Metric {
} }
} }
describe(): {[key: string]: string} { override describe(): {[key: string]: string} {
const res: {[key: string]: any} = { const res: {[key: string]: any} = {
'scriptTime': 'script execution time in ms, including gc and render', 'scriptTime': 'script execution time in ms, including gc and render',
'pureScriptTime': 'script execution time in ms, without gc nor render' 'pureScriptTime': 'script execution time in ms, without gc nor render'
@ -113,7 +113,7 @@ export class PerflogMetric extends Metric {
return res; return res;
} }
beginMeasure(): Promise<any> { override beginMeasure(): Promise<any> {
let resultPromise = Promise.resolve(null); let resultPromise = Promise.resolve(null);
if (this._forceGc) { if (this._forceGc) {
resultPromise = resultPromise.then((_) => this._driverExtension.gc()); resultPromise = resultPromise.then((_) => this._driverExtension.gc());
@ -121,7 +121,7 @@ export class PerflogMetric extends Metric {
return resultPromise.then((_) => this._beginMeasure()); return resultPromise.then((_) => this._beginMeasure());
} }
endMeasure(restart: boolean): Promise<{[key: string]: number}> { override endMeasure(restart: boolean): Promise<{[key: string]: number}> {
if (this._forceGc) { if (this._forceGc) {
return this._endPlainMeasureAndMeasureForceGc(restart); return this._endPlainMeasureAndMeasureForceGc(restart);
} else { } else {

View File

@ -26,14 +26,14 @@ export class UserMetric extends Metric {
/** /**
* Starts measuring * Starts measuring
*/ */
beginMeasure(): Promise<any> { override beginMeasure(): Promise<any> {
return Promise.resolve(true); return Promise.resolve(true);
} }
/** /**
* Ends measuring. * Ends measuring.
*/ */
endMeasure(restart: boolean): Promise<{[key: string]: any}> { override endMeasure(restart: boolean): Promise<{[key: string]: any}> {
let resolve: (result: any) => void; let resolve: (result: any) => void;
let reject: (error: any) => void; let reject: (error: any) => void;
const promise = new Promise<{[key: string]: any;}>((res, rej) => { const promise = new Promise<{[key: string]: any;}>((res, rej) => {
@ -68,7 +68,7 @@ export class UserMetric extends Metric {
* Describes the metrics provided by this metric implementation. * Describes the metrics provided by this metric implementation.
* (e.g. units, ...) * (e.g. units, ...)
*/ */
describe(): {[key: string]: any} { override describe(): {[key: string]: any} {
return this._userMetrics; return this._userMetrics;
} }
} }

View File

@ -71,7 +71,7 @@ export class ConsoleReporter extends Reporter {
this._printStringRow(this._metricNames.map((_) => ''), '-'); this._printStringRow(this._metricNames.map((_) => ''), '-');
} }
reportMeasureValues(measureValues: MeasureValues): Promise<any> { override reportMeasureValues(measureValues: MeasureValues): Promise<any> {
const formattedValues = this._metricNames.map(metricName => { const formattedValues = this._metricNames.map(metricName => {
const value = measureValues.values[metricName]; const value = measureValues.values[metricName];
return formatNum(value); return formatNum(value);
@ -80,7 +80,8 @@ export class ConsoleReporter extends Reporter {
return Promise.resolve(null); return Promise.resolve(null);
} }
reportSample(completeSample: MeasureValues[], validSamples: MeasureValues[]): Promise<any> { override reportSample(completeSample: MeasureValues[], validSamples: MeasureValues[]):
Promise<any> {
this._printStringRow(this._metricNames.map((_) => ''), '='); this._printStringRow(this._metricNames.map((_) => ''), '=');
this._printStringRow( this._printStringRow(
this._metricNames.map(metricName => formatStats(validSamples, metricName))); this._metricNames.map(metricName => formatStats(validSamples, metricName)));

View File

@ -37,11 +37,12 @@ export class JsonFileReporter extends Reporter {
super(); super();
} }
reportMeasureValues(measureValues: MeasureValues): Promise<any> { override reportMeasureValues(measureValues: MeasureValues): Promise<any> {
return Promise.resolve(null); return Promise.resolve(null);
} }
reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise<any> { override reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]):
Promise<any> {
const stats: {[key: string]: string} = {}; const stats: {[key: string]: string} = {};
sortedProps(this._description.metrics).forEach((metricName) => { sortedProps(this._description.metrics).forEach((metricName) => {
stats[metricName] = formatStats(validSample, metricName); stats[metricName] = formatStats(validSample, metricName);

View File

@ -31,11 +31,12 @@ export class MultiReporter extends Reporter {
super(); super();
} }
reportMeasureValues(values: MeasureValues): Promise<any[]> { override reportMeasureValues(values: MeasureValues): Promise<any[]> {
return Promise.all(this._reporters.map(reporter => reporter.reportMeasureValues(values))); return Promise.all(this._reporters.map(reporter => reporter.reportMeasureValues(values)));
} }
reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise<any[]> { override reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]):
Promise<any[]> {
return Promise.all( return Promise.all(
this._reporters.map(reporter => reporter.reportSample(completeSample, validSample))); this._reporters.map(reporter => reporter.reportSample(completeSample, validSample)));
} }

View File

@ -35,11 +35,11 @@ export class RegressionSlopeValidator extends Validator {
super(); super();
} }
describe(): {[key: string]: any} { override describe(): {[key: string]: any} {
return {'sampleSize': this._sampleSize, 'regressionSlopeMetric': this._metric}; return {'sampleSize': this._sampleSize, 'regressionSlopeMetric': this._metric};
} }
validate(completeSample: MeasureValues[]): MeasureValues[]|null { override validate(completeSample: MeasureValues[]): MeasureValues[]|null {
if (completeSample.length >= this._sampleSize) { if (completeSample.length >= this._sampleSize) {
const latestSample = const latestSample =
completeSample.slice(completeSample.length - this._sampleSize, completeSample.length); completeSample.slice(completeSample.length - this._sampleSize, completeSample.length);

View File

@ -26,11 +26,11 @@ export class SizeValidator extends Validator {
super(); super();
} }
describe(): {[key: string]: any} { override describe(): {[key: string]: any} {
return {'sampleSize': this._sampleSize}; return {'sampleSize': this._sampleSize};
} }
validate(completeSample: MeasureValues[]): MeasureValues[]|null { override validate(completeSample: MeasureValues[]): MeasureValues[]|null {
if (completeSample.length >= this._sampleSize) { if (completeSample.length >= this._sampleSize) {
return completeSample.slice(completeSample.length - this._sampleSize, completeSample.length); return completeSample.slice(completeSample.length - this._sampleSize, completeSample.length);
} else { } else {

View File

@ -54,11 +54,11 @@ export class ChromeDriverExtension extends WebDriverExtension {
return parseInt(v, 10); return parseInt(v, 10);
} }
gc() { override gc() {
return this.driver.executeScript('window.gc()'); return this.driver.executeScript('window.gc()');
} }
async timeBegin(name: string): Promise<any> { override async timeBegin(name: string): Promise<any> {
if (this._firstRun) { if (this._firstRun) {
this._firstRun = false; this._firstRun = false;
// Before the first run, read out the existing performance logs // Before the first run, read out the existing performance logs
@ -68,7 +68,7 @@ export class ChromeDriverExtension extends WebDriverExtension {
return this.driver.executeScript(`performance.mark('${name}-bpstart');`); return this.driver.executeScript(`performance.mark('${name}-bpstart');`);
} }
timeEnd(name: string, restartName: string|null = null): Promise<any> { override timeEnd(name: string, restartName: string|null = null): Promise<any> {
let script = `performance.mark('${name}-bpend');`; let script = `performance.mark('${name}-bpend');`;
if (restartName) { if (restartName) {
script += `performance.mark('${restartName}-bpstart');`; script += `performance.mark('${restartName}-bpstart');`;
@ -78,7 +78,7 @@ export class ChromeDriverExtension extends WebDriverExtension {
// See [Chrome Trace Event // See [Chrome Trace Event
// Format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit) // Format](https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/edit)
readPerfLog(): Promise<PerfLogEvent[]> { override readPerfLog(): Promise<PerfLogEvent[]> {
// TODO(tbosch): Chromedriver bug https://code.google.com/p/chromedriver/issues/detail?id=1098 // TODO(tbosch): Chromedriver bug https://code.google.com/p/chromedriver/issues/detail?id=1098
// Need to execute at least one command so that the browser logs can be read out! // Need to execute at least one command so that the browser logs can be read out!
return this.driver.executeScript('1+1') return this.driver.executeScript('1+1')
@ -200,11 +200,11 @@ export class ChromeDriverExtension extends WebDriverExtension {
return !expectedName ? hasCategories : hasCategories && eventName === expectedName; return !expectedName ? hasCategories : hasCategories && eventName === expectedName;
} }
perfLogFeatures(): PerfLogFeatures { override perfLogFeatures(): PerfLogFeatures {
return new PerfLogFeatures({render: true, gc: true, frameCapture: true, userTiming: true}); return new PerfLogFeatures({render: true, gc: true, frameCapture: true, userTiming: true});
} }
supports(capabilities: {[key: string]: any}): boolean { override supports(capabilities: {[key: string]: any}): boolean {
return this._majorChromeVersion >= 44 && capabilities['browserName'].toLowerCase() === 'chrome'; return this._majorChromeVersion >= 44 && capabilities['browserName'].toLowerCase() === 'chrome';
} }
} }

View File

@ -22,11 +22,11 @@ export class FirefoxDriverExtension extends WebDriverExtension {
this._profilerStarted = false; this._profilerStarted = false;
} }
gc() { override gc() {
return this._driver.executeScript('window.forceGC()'); return this._driver.executeScript('window.forceGC()');
} }
timeBegin(name: string): Promise<any> { override timeBegin(name: string): Promise<any> {
if (!this._profilerStarted) { if (!this._profilerStarted) {
this._profilerStarted = true; this._profilerStarted = true;
this._driver.executeScript('window.startProfiler();'); this._driver.executeScript('window.startProfiler();');
@ -34,7 +34,7 @@ export class FirefoxDriverExtension extends WebDriverExtension {
return this._driver.executeScript('window.markStart("' + name + '");'); return this._driver.executeScript('window.markStart("' + name + '");');
} }
timeEnd(name: string, restartName: string|null = null): Promise<any> { override timeEnd(name: string, restartName: string|null = null): Promise<any> {
let script = 'window.markEnd("' + name + '");'; let script = 'window.markEnd("' + name + '");';
if (restartName != null) { if (restartName != null) {
script += 'window.markStart("' + restartName + '");'; script += 'window.markStart("' + restartName + '");';
@ -42,15 +42,15 @@ export class FirefoxDriverExtension extends WebDriverExtension {
return this._driver.executeScript(script); return this._driver.executeScript(script);
} }
readPerfLog(): Promise<PerfLogEvent[]> { override readPerfLog(): Promise<PerfLogEvent[]> {
return this._driver.executeAsyncScript('var cb = arguments[0]; window.getProfile(cb);'); return this._driver.executeAsyncScript('var cb = arguments[0]; window.getProfile(cb);');
} }
perfLogFeatures(): PerfLogFeatures { override perfLogFeatures(): PerfLogFeatures {
return new PerfLogFeatures({render: true, gc: true}); return new PerfLogFeatures({render: true, gc: true});
} }
supports(capabilities: {[key: string]: any}): boolean { override supports(capabilities: {[key: string]: any}): boolean {
return capabilities['browserName'].toLowerCase() === 'firefox'; return capabilities['browserName'].toLowerCase() === 'firefox';
} }
} }

View File

@ -19,15 +19,15 @@ export class IOsDriverExtension extends WebDriverExtension {
super(); super();
} }
gc(): Promise<any> { override gc(): Promise<any> {
throw new Error('Force GC is not supported on iOS'); throw new Error('Force GC is not supported on iOS');
} }
timeBegin(name: string): Promise<any> { override timeBegin(name: string): Promise<any> {
return this._driver.executeScript(`console.time('${name}');`); return this._driver.executeScript(`console.time('${name}');`);
} }
timeEnd(name: string, restartName: string|null = null): Promise<any> { override timeEnd(name: string, restartName: string|null = null): Promise<any> {
let script = `console.timeEnd('${name}');`; let script = `console.timeEnd('${name}');`;
if (restartName != null) { if (restartName != null) {
script += `console.time('${restartName}');`; script += `console.time('${restartName}');`;
@ -36,7 +36,7 @@ export class IOsDriverExtension extends WebDriverExtension {
} }
// See https://github.com/WebKit/webkit/tree/master/Source/WebInspectorUI/Versions // See https://github.com/WebKit/webkit/tree/master/Source/WebInspectorUI/Versions
readPerfLog() { override readPerfLog() {
// TODO(tbosch): Bug in IOsDriver: Need to execute at least one command // TODO(tbosch): Bug in IOsDriver: Need to execute at least one command
// so that the browser logs can be read out! // so that the browser logs can be read out!
return this._driver.executeScript('1+1') return this._driver.executeScript('1+1')
@ -91,11 +91,11 @@ export class IOsDriverExtension extends WebDriverExtension {
return events; return events;
} }
perfLogFeatures(): PerfLogFeatures { override perfLogFeatures(): PerfLogFeatures {
return new PerfLogFeatures({render: true}); return new PerfLogFeatures({render: true});
} }
supports(capabilities: {[key: string]: any}): boolean { override supports(capabilities: {[key: string]: any}): boolean {
return capabilities['browserName'].toLowerCase() === 'safari'; return capabilities['browserName'].toLowerCase() === 'safari';
} }
} }

View File

@ -25,19 +25,19 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
super(); super();
} }
waitFor(callback: () => any): Promise<any> { override waitFor(callback: () => any): Promise<any> {
return this._driver.call(callback); return this._driver.call(callback);
} }
executeScript(script: string): Promise<any> { override executeScript(script: string): Promise<any> {
return this._driver.executeScript(script); return this._driver.executeScript(script);
} }
executeAsyncScript(script: string): Promise<any> { override executeAsyncScript(script: string): Promise<any> {
return this._driver.executeAsyncScript(script); return this._driver.executeAsyncScript(script);
} }
capabilities(): Promise<{[key: string]: any}> { override capabilities(): Promise<{[key: string]: any}> {
return this._driver.getCapabilities().then((capsObject: any) => { return this._driver.getCapabilities().then((capsObject: any) => {
const localData: {[key: string]: any} = {}; const localData: {[key: string]: any} = {};
for (const key of Array.from((<Map<string, any>>capsObject).keys())) { for (const key of Array.from((<Map<string, any>>capsObject).keys())) {
@ -47,7 +47,7 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
}); });
} }
logs(type: string): Promise<any> { override logs(type: string): Promise<any> {
// Needed as selenium-webdriver does not forward // Needed as selenium-webdriver does not forward
// performance logs in the correct way via manage().logs // performance logs in the correct way via manage().logs
return this._driver.schedule( return this._driver.schedule(

View File

@ -50,17 +50,17 @@ class MockMetric extends Metric {
super(); super();
} }
beginMeasure(): Promise<string> { override beginMeasure(): Promise<string> {
return Promise.resolve(`${this._id}_beginMeasure`); return Promise.resolve(`${this._id}_beginMeasure`);
} }
endMeasure(restart: boolean): Promise<{[key: string]: any}> { override endMeasure(restart: boolean): Promise<{[key: string]: any}> {
const result: {[key: string]: any} = {}; const result: {[key: string]: any} = {};
result[this._id] = {'restart': restart}; result[this._id] = {'restart': restart};
return Promise.resolve(result); return Promise.resolve(result);
} }
describe(): {[key: string]: string} { override describe(): {[key: string]: string} {
const result: {[key: string]: string} = {}; const result: {[key: string]: string} = {};
result[this._id] = 'describe'; result[this._id] = 'describe';
return result; return result;

View File

@ -646,21 +646,21 @@ class MockDriverExtension extends WebDriverExtension {
super(); super();
} }
timeBegin(name: string): Promise<any> { override timeBegin(name: string): Promise<any> {
this._commandLog.push(['timeBegin', name]); this._commandLog.push(['timeBegin', name]);
return Promise.resolve(null); return Promise.resolve(null);
} }
timeEnd(name: string, restartName: string|null): Promise<any> { override timeEnd(name: string, restartName: string|null): Promise<any> {
this._commandLog.push(['timeEnd', name, restartName]); this._commandLog.push(['timeEnd', name, restartName]);
return Promise.resolve(null); return Promise.resolve(null);
} }
perfLogFeatures(): PerfLogFeatures { override perfLogFeatures(): PerfLogFeatures {
return this._perfLogFeatures; return this._perfLogFeatures;
} }
readPerfLog(): Promise<any> { override readPerfLog(): Promise<any> {
this._commandLog.push('readPerfLog'); this._commandLog.push('readPerfLog');
if (this._perfLogs.length > 0) { if (this._perfLogs.length > 0) {
const next = this._perfLogs[0]; const next = this._perfLogs[0];
@ -671,7 +671,7 @@ class MockDriverExtension extends WebDriverExtension {
} }
} }
gc(): Promise<any> { override gc(): Promise<any> {
this._commandLog.push(['gc']); this._commandLog.push(['gc']);
return Promise.resolve(null); return Promise.resolve(null);
} }

View File

@ -64,7 +64,7 @@ describe('user metric', () => {
class MockDriverAdapter extends WebDriverAdapter { class MockDriverAdapter extends WebDriverAdapter {
data: any = {}; data: any = {};
executeScript(script: string): any { override executeScript(script: string): any {
// Just handles `return window.propName` ignores `delete window.propName`. // Just handles `return window.propName` ignores `delete window.propName`.
if (script.indexOf('return window.') == 0) { if (script.indexOf('return window.') == 0) {
const metricName = script.substring('return window.'.length); const metricName = script.substring('return window.'.length);

View File

@ -51,11 +51,11 @@ class MockReporter extends Reporter {
super(); super();
} }
reportMeasureValues(values: MeasureValues): Promise<{[key: string]: any}> { override reportMeasureValues(values: MeasureValues): Promise<{[key: string]: any}> {
return Promise.resolve({'id': this._id, 'values': values}); return Promise.resolve({'id': this._id, 'values': values});
} }
reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): override reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]):
Promise<{[key: string]: any}> { Promise<{[key: string]: any}> {
return Promise.resolve( return Promise.resolve(
{'id': this._id, 'completeSample': completeSample, 'validSample': validSample}); {'id': this._id, 'completeSample': completeSample, 'validSample': validSample});

View File

@ -106,10 +106,10 @@ import {Injector, Metric, Options, Runner, SampleDescription, Sampler, SampleSta
} }
class MockWebDriverAdapter extends WebDriverAdapter { class MockWebDriverAdapter extends WebDriverAdapter {
executeScript(script: string): Promise<string> { override executeScript(script: string): Promise<string> {
return Promise.resolve('someUserAgent'); return Promise.resolve('someUserAgent');
} }
capabilities(): Promise<Map<string, any>> { override capabilities(): Promise<Map<string, any>> {
return null!; return null!;
} }
} }
@ -118,7 +118,7 @@ class MockValidator extends Validator {
constructor() { constructor() {
super(); super();
} }
describe() { override describe() {
return {'v': 11}; return {'v': 11};
} }
} }
@ -127,7 +127,7 @@ class MockMetric extends Metric {
constructor() { constructor() {
super(); super();
} }
describe() { override describe() {
return {'m1': 'some metric'}; return {'m1': 'some metric'};
} }
} }
@ -136,7 +136,7 @@ class MockSampler extends Sampler {
constructor() { constructor() {
super(null!, null!, null!, null!, null!, null!, null!); super(null!, null!, null!, null!, null!, null!, null!);
} }
sample(): Promise<SampleState> { override sample(): Promise<SampleState> {
return Promise.resolve(new SampleState([], [])); return Promise.resolve(new SampleState([], []));
} }
} }

View File

@ -225,7 +225,7 @@ class MockDriverAdapter extends WebDriverAdapter {
constructor(private _log: any[] = [], private _waitFor: Function|null = null) { constructor(private _log: any[] = [], private _waitFor: Function|null = null) {
super(); super();
} }
waitFor(callback: Function): Promise<any> { override waitFor(callback: Function): Promise<any> {
if (this._waitFor != null) { if (this._waitFor != null) {
return this._waitFor(callback); return this._waitFor(callback);
} else { } else {
@ -239,7 +239,7 @@ class MockValidator extends Validator {
constructor(private _log: any[] = [], private _validate: Function|null = null) { constructor(private _log: any[] = [], private _validate: Function|null = null) {
super(); super();
} }
validate(completeSample: MeasureValues[]): MeasureValues[] { override validate(completeSample: MeasureValues[]): MeasureValues[] {
const stableSample = this._validate != null ? this._validate(completeSample) : completeSample; const stableSample = this._validate != null ? this._validate(completeSample) : completeSample;
this._log.push(['validate', completeSample, stableSample]); this._log.push(['validate', completeSample, stableSample]);
return stableSample; return stableSample;
@ -250,11 +250,11 @@ class MockMetric extends Metric {
constructor(private _log: any[] = [], private _endMeasure: Function|null = null) { constructor(private _log: any[] = [], private _endMeasure: Function|null = null) {
super(); super();
} }
beginMeasure() { override beginMeasure() {
this._log.push(['beginMeasure']); this._log.push(['beginMeasure']);
return Promise.resolve(null); return Promise.resolve(null);
} }
endMeasure(restart: boolean) { override endMeasure(restart: boolean) {
const measureValues = this._endMeasure != null ? this._endMeasure() : {}; const measureValues = this._endMeasure != null ? this._endMeasure() : {};
this._log.push(['endMeasure', restart, measureValues]); this._log.push(['endMeasure', restart, measureValues]);
return Promise.resolve(measureValues); return Promise.resolve(measureValues);
@ -265,11 +265,12 @@ class MockReporter extends Reporter {
constructor(private _log: any[] = []) { constructor(private _log: any[] = []) {
super(); super();
} }
reportMeasureValues(values: MeasureValues): Promise<any> { override reportMeasureValues(values: MeasureValues): Promise<any> {
this._log.push(['reportMeasureValues', values]); this._log.push(['reportMeasureValues', values]);
return Promise.resolve(null); return Promise.resolve(null);
} }
reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]): Promise<any> { override reportSample(completeSample: MeasureValues[], validSample: MeasureValues[]):
Promise<any> {
this._log.push(['reportSample', completeSample, validSample]); this._log.push(['reportSample', completeSample, validSample]);
return Promise.resolve(null); return Promise.resolve(null);
} }

View File

@ -47,7 +47,7 @@ class MockExtension extends WebDriverExtension {
super(); super();
} }
supports(capabilities: {[key: string]: any}): boolean { override supports(capabilities: {[key: string]: any}): boolean {
return capabilities['browser'] === this.id; return capabilities['browser'] === this.id;
} }
} }

View File

@ -384,12 +384,12 @@ class MockDriverAdapter extends WebDriverAdapter {
super(); super();
} }
executeScript(script: string) { override executeScript(script: string) {
this._log.push(['executeScript', script]); this._log.push(['executeScript', script]);
return Promise.resolve(null); return Promise.resolve(null);
} }
logs(type: string): Promise<any[]> { override logs(type: string): Promise<any[]> {
this._log.push(['logs', type]); this._log.push(['logs', type]);
if (type === 'performance') { if (type === 'performance') {
return Promise.resolve(this._events.map( return Promise.resolve(this._events.map(

View File

@ -160,12 +160,12 @@ class MockDriverAdapter extends WebDriverAdapter {
super(); super();
} }
executeScript(script: string) { override executeScript(script: string) {
this._log.push(['executeScript', script]); this._log.push(['executeScript', script]);
return Promise.resolve(null); return Promise.resolve(null);
} }
logs(type: string): Promise<any[]> { override logs(type: string): Promise<any[]> {
this._log.push(['logs', type]); this._log.push(['logs', type]);
if (type === 'performance') { if (type === 'performance') {
return Promise.resolve(this._perfRecords.map(function(record) { return Promise.resolve(this._perfRecords.map(function(record) {