refactor: remove lang.ts (#14837)
This commit is contained in:

committed by
Chuck Jazdzewski

parent
84a65cf788
commit
8343fb7740
@ -1 +0,0 @@
|
||||
../../facade/src
|
@ -7,7 +7,6 @@
|
||||
*/
|
||||
|
||||
import {Inject, Injectable, InjectionToken} from '@angular/core';
|
||||
import {print} from '../facade/lang';
|
||||
import {MeasureValues} from '../measure_values';
|
||||
import {Reporter} from '../reporter';
|
||||
import {SampleDescription} from '../sample_description';
|
||||
@ -23,8 +22,13 @@ export class ConsoleReporter extends Reporter {
|
||||
static PRINT = new InjectionToken('ConsoleReporter.print');
|
||||
static COLUMN_WIDTH = new InjectionToken('ConsoleReporter.columnWidth');
|
||||
static PROVIDERS = [
|
||||
ConsoleReporter, {provide: ConsoleReporter.COLUMN_WIDTH, useValue: 18},
|
||||
{provide: ConsoleReporter.PRINT, useValue: print}
|
||||
ConsoleReporter, {provide: ConsoleReporter.COLUMN_WIDTH, useValue: 18}, {
|
||||
provide: ConsoleReporter.PRINT,
|
||||
useValue: function(v: any) {
|
||||
// tslint:disable-next-line:no-console
|
||||
console.log(v);
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
private static _lpad(value: string, columnWidth: number, fill = ' ') {
|
||||
|
@ -9,7 +9,6 @@
|
||||
import {Provider, ReflectiveInjector} from '@angular/core';
|
||||
|
||||
import {Options} from './common_options';
|
||||
import {isPresent} from './facade/lang';
|
||||
import {Metric} from './metric';
|
||||
import {MultiMetric} from './metric/multi_metric';
|
||||
import {PerflogMetric} from './metric/perflog_metric';
|
||||
@ -49,16 +48,16 @@ export class Runner {
|
||||
_DEFAULT_PROVIDERS, this._defaultProviders, {provide: Options.SAMPLE_ID, useValue: id},
|
||||
{provide: Options.EXECUTE, useValue: execute}
|
||||
];
|
||||
if (isPresent(prepare)) {
|
||||
if (prepare != null) {
|
||||
sampleProviders.push({provide: Options.PREPARE, useValue: prepare});
|
||||
}
|
||||
if (isPresent(microMetrics)) {
|
||||
if (microMetrics != null) {
|
||||
sampleProviders.push({provide: Options.MICRO_METRICS, useValue: microMetrics});
|
||||
}
|
||||
if (isPresent(userMetrics)) {
|
||||
if (userMetrics != null) {
|
||||
sampleProviders.push({provide: Options.USER_METRICS, useValue: userMetrics});
|
||||
}
|
||||
if (isPresent(providers)) {
|
||||
if (providers != null) {
|
||||
sampleProviders.push(providers);
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
import {Inject, Injectable} from '@angular/core';
|
||||
|
||||
import {Options} from './common_options';
|
||||
import {isPresent} from './facade/lang';
|
||||
import {MeasureValues} from './measure_values';
|
||||
import {Metric} from './metric';
|
||||
import {Reporter} from './reporter';
|
||||
@ -38,7 +37,7 @@ export class Sampler {
|
||||
sample(): Promise<SampleState> {
|
||||
const loop = (lastState: SampleState): Promise<SampleState> => {
|
||||
return this._iterate(lastState).then((newState) => {
|
||||
if (isPresent(newState.validSample)) {
|
||||
if (newState.validSample != null) {
|
||||
return newState;
|
||||
} else {
|
||||
return loop(newState);
|
||||
@ -68,7 +67,7 @@ export class Sampler {
|
||||
const completeSample = state.completeSample.concat([measureValues]);
|
||||
const validSample = this._validator.validate(completeSample);
|
||||
let resultPromise = this._reporter.reportMeasureValues(measureValues);
|
||||
if (isPresent(validSample)) {
|
||||
if (validSample != null) {
|
||||
resultPromise =
|
||||
resultPromise.then((_) => this._reporter.reportSample(completeSample, validSample));
|
||||
}
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {isPresent} from '../facade/lang';
|
||||
import {WebDriverAdapter} from '../web_driver_adapter';
|
||||
import {PerfLogEvent, PerfLogFeatures, WebDriverExtension} from '../web_driver_extension';
|
||||
|
||||
@ -35,7 +34,7 @@ export class FirefoxDriverExtension extends WebDriverExtension {
|
||||
|
||||
timeEnd(name: string, restartName: string = null): Promise<any> {
|
||||
let script = 'window.markEnd("' + name + '");';
|
||||
if (isPresent(restartName)) {
|
||||
if (restartName != null) {
|
||||
script += 'window.markStart("' + restartName + '");';
|
||||
}
|
||||
return this._driver.executeScript(script);
|
||||
|
@ -8,7 +8,6 @@
|
||||
|
||||
import {Injectable} from '@angular/core';
|
||||
|
||||
import {isBlank, isPresent} from '../facade/lang';
|
||||
import {WebDriverAdapter} from '../web_driver_adapter';
|
||||
import {PerfLogEvent, PerfLogFeatures, WebDriverExtension} from '../web_driver_extension';
|
||||
|
||||
@ -26,7 +25,7 @@ export class IOsDriverExtension extends WebDriverExtension {
|
||||
|
||||
timeEnd(name: string, restartName: string = null): Promise<any> {
|
||||
let script = `console.timeEnd('${name}');`;
|
||||
if (isPresent(restartName)) {
|
||||
if (restartName != null) {
|
||||
script += `console.time('${restartName}');`;
|
||||
}
|
||||
return this._driver.executeScript(script);
|
||||
@ -76,10 +75,10 @@ export class IOsDriverExtension extends WebDriverExtension {
|
||||
endEvent = createEndEvent('render', endTime);
|
||||
}
|
||||
// Note: ios used to support GCEvent up until iOS 6 :-(
|
||||
if (isPresent(record['children'])) {
|
||||
if (record['children'] != null) {
|
||||
this._convertPerfRecordsToEvents(record['children'], events);
|
||||
}
|
||||
if (isPresent(endEvent)) {
|
||||
if (endEvent != null) {
|
||||
events.push(endEvent);
|
||||
}
|
||||
});
|
||||
@ -104,7 +103,7 @@ function createEvent(
|
||||
// the perflog...
|
||||
'pid': 'pid0'
|
||||
};
|
||||
if (isPresent(args)) {
|
||||
if (args != null) {
|
||||
result['args'] = args;
|
||||
}
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user