@ -1,6 +1,6 @@
|
||||
/// <reference path="../angular2/typings/node/node.d.ts" />
|
||||
|
||||
import {bind} from 'angular2/src/core/di';
|
||||
import {bind, provide} from 'angular2/src/core/di';
|
||||
import {Options} from './common';
|
||||
|
||||
export * from './common';
|
||||
@ -13,7 +13,7 @@ var fs = require('fs');
|
||||
// find another way...
|
||||
// Note: Can't do the `require` call in a facade as it can't be loaded into the browser
|
||||
// for our unit tests via karma.
|
||||
Options.DEFAULT_BINDINGS.push(bind(Options.WRITE_FILE).toValue(writeFile));
|
||||
Options.DEFAULT_PROVIDERS.push(bind(Options.WRITE_FILE).toValue(writeFile));
|
||||
|
||||
function writeFile(filename, content): Promise<any> {
|
||||
return new Promise(function(resolve, reject) {
|
||||
|
@ -19,4 +19,4 @@ export {MeasureValues} from './src/measure_values';
|
||||
export {MultiMetric} from './src/metric/multi_metric';
|
||||
export {MultiReporter} from './src/reporter/multi_reporter';
|
||||
|
||||
export {bind, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
export {bind, provide, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
||||
|
||||
export class Options {
|
||||
static get DEFAULT_BINDINGS(): Binding[] { return _DEFAULT_BINDINGS; }
|
||||
static get DEFAULT_PROVIDERS(): Provider[] { return _DEFAULT_PROVIDERS; }
|
||||
// TODO(tbosch): use static initializer when our transpiler supports it
|
||||
static get SAMPLE_ID() { return _SAMPLE_ID; }
|
||||
// TODO(tbosch): use static initializer when our transpiler supports it
|
||||
@ -42,13 +42,13 @@ var _NOW = new OpaqueToken('Options.now');
|
||||
var _WRITE_FILE = new OpaqueToken('Options.writeFile');
|
||||
var _CAPTURE_FRAMES = new OpaqueToken('Options.frameCapture');
|
||||
|
||||
var _DEFAULT_BINDINGS = [
|
||||
var _DEFAULT_PROVIDERS = [
|
||||
bind(_DEFAULT_DESCRIPTION)
|
||||
.toValue({}),
|
||||
bind(_SAMPLE_DESCRIPTION).toValue({}),
|
||||
bind(_FORCE_GC).toValue(false),
|
||||
bind(_PREPARE).toValue(false),
|
||||
bind(_MICRO_METRICS).toValue({}),
|
||||
bind(_NOW).toValue(() => DateWrapper.now()),
|
||||
bind(_CAPTURE_FRAMES).toValue(false)
|
||||
provide(_SAMPLE_DESCRIPTION, {asValue: {}}),
|
||||
provide(_FORCE_GC, {asValue: false}),
|
||||
provide(_PREPARE, {asValue: false}),
|
||||
provide(_MICRO_METRICS, {asValue: {}}),
|
||||
provide(_NOW, {asValue: () => DateWrapper.now()}),
|
||||
provide(_CAPTURE_FRAMES, {asValue: false})
|
||||
];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
|
||||
@ -6,7 +6,7 @@ import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptio
|
||||
* A metric is measures values
|
||||
*/
|
||||
export abstract class Metric {
|
||||
static bindTo(delegateToken): Binding[] {
|
||||
static bindTo(delegateToken): Provider[] {
|
||||
return [bind(Metric).toFactory((delegate) => delegate, [delegateToken])];
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {WebDriverExtension, PerfLogFeatures} from '../web_driver_extension';
|
||||
import {Metric} from '../metric';
|
||||
@ -20,7 +20,7 @@ import {Options} from '../common_options';
|
||||
*/
|
||||
export class PerflogMetric extends Metric {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get SET_TIMEOUT(): OpaqueToken { return _SET_TIMEOUT; }
|
||||
|
||||
@ -331,7 +331,7 @@ var _MARK_NAME_FRAME_CAPUTRE = 'frameCapture';
|
||||
// using 17ms as a somewhat looser threshold, instead of 16.6666ms
|
||||
var _FRAME_TIME_SMOOTH_THRESHOLD = 17;
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(PerflogMetric)
|
||||
.toFactory(
|
||||
(driverExtension, setTimeout, microMetrics, forceGc, captureFrames) =>
|
||||
@ -343,5 +343,5 @@ var _BINDINGS = [
|
||||
Options.FORCE_GC,
|
||||
Options.CAPTURE_FRAMES
|
||||
]),
|
||||
bind(_SET_TIMEOUT).toValue((fn, millis) => TimerWrapper.setTimeout(fn, millis))
|
||||
provide(_SET_TIMEOUT, {asValue: (fn, millis) => TimerWrapper.setTimeout(fn, millis)})
|
||||
];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {MeasureValues} from './measure_values';
|
||||
@ -7,7 +7,7 @@ import {MeasureValues} from './measure_values';
|
||||
* A reporter reports measure values and the valid sample.
|
||||
*/
|
||||
export abstract class Reporter {
|
||||
static bindTo(delegateToken): Binding[] {
|
||||
static bindTo(delegateToken): Provider[] {
|
||||
return [bind(Reporter).toFactory((delegate) => delegate, [delegateToken])];
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@ import {print, isPresent, isBlank, NumberWrapper} from 'angular2/src/core/facade
|
||||
import {StringMapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {Math} from 'angular2/src/core/facade/math';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {Statistic} from '../statistic';
|
||||
import {Reporter} from '../reporter';
|
||||
@ -18,7 +18,7 @@ export class ConsoleReporter extends Reporter {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get COLUMN_WIDTH(): OpaqueToken { return _COLUMN_WIDTH; }
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
|
||||
static _lpad(value, columnWidth, fill = ' ') {
|
||||
@ -93,11 +93,11 @@ export class ConsoleReporter extends Reporter {
|
||||
|
||||
var _PRINT = new OpaqueToken('ConsoleReporter.print');
|
||||
var _COLUMN_WIDTH = new OpaqueToken('ConsoleReporter.columnWidth');
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(ConsoleReporter)
|
||||
.toFactory((columnWidth, sampleDescription, print) =>
|
||||
new ConsoleReporter(columnWidth, sampleDescription, print),
|
||||
[_COLUMN_WIDTH, SampleDescription, _PRINT]),
|
||||
bind(_COLUMN_WIDTH).toValue(18),
|
||||
bind(_PRINT).toValue(print)
|
||||
provide(_COLUMN_WIDTH, {asValue: 18}),
|
||||
provide(_PRINT, {asValue: print})
|
||||
];
|
||||
|
@ -1,7 +1,7 @@
|
||||
import {DateWrapper, isPresent, isBlank, Json} from 'angular2/src/core/facade/lang';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {Reporter} from '../reporter';
|
||||
import {SampleDescription} from '../sample_description';
|
||||
@ -15,7 +15,7 @@ export class JsonFileReporter extends Reporter {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get PATH(): OpaqueToken { return _PATH; }
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
_writeFile: Function;
|
||||
_path: string;
|
||||
@ -47,10 +47,10 @@ export class JsonFileReporter extends Reporter {
|
||||
}
|
||||
|
||||
var _PATH = new OpaqueToken('JsonFileReporter.path');
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(JsonFileReporter)
|
||||
.toFactory((sampleDescription, path, writeFile, now) =>
|
||||
new JsonFileReporter(sampleDescription, path, writeFile, now),
|
||||
[SampleDescription, _PATH, Options.WRITE_FILE, Options.NOW]),
|
||||
bind(_PATH).toValue('.')
|
||||
provide(_PATH, {asValue: '.'})
|
||||
];
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
import {MeasureValues} from '../measure_values';
|
||||
import {Reporter} from '../reporter';
|
||||
|
||||
export class MultiReporter extends Reporter {
|
||||
static createBindings(childTokens: any[]): Binding[] {
|
||||
static createBindings(childTokens: any[]): Provider[] {
|
||||
return [
|
||||
bind(_CHILDREN)
|
||||
.toFactory((injector: Injector) => childTokens.map(token => injector.get(token)),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Injector, bind, Binding} from 'angular2/src/core/di';
|
||||
import {Injector, bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {isPresent, isBlank} from 'angular2/src/core/facade/lang';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
@ -25,8 +25,8 @@ import {Options} from './common_options';
|
||||
* It provides defaults, creates the injector and calls the sampler.
|
||||
*/
|
||||
export class Runner {
|
||||
private _defaultBindings: Binding[];
|
||||
constructor(defaultBindings: Binding[] = null) {
|
||||
private _defaultBindings: Provider[];
|
||||
constructor(defaultBindings: Provider[] = null) {
|
||||
if (isBlank(defaultBindings)) {
|
||||
defaultBindings = [];
|
||||
}
|
||||
@ -35,7 +35,7 @@ export class Runner {
|
||||
|
||||
sample({id, execute, prepare, microMetrics, bindings}): Promise<SampleState> {
|
||||
var sampleBindings = [
|
||||
_DEFAULT_BINDINGS,
|
||||
_DEFAULT_PROVIDERS,
|
||||
this._defaultBindings,
|
||||
bind(Options.SAMPLE_ID).toValue(id),
|
||||
bind(Options.EXECUTE).toValue(execute)
|
||||
@ -60,7 +60,7 @@ export class Runner {
|
||||
var userAgent = args[1];
|
||||
|
||||
// This might still create instances twice. We are creating a new injector with all the
|
||||
// bindings.
|
||||
// providers.
|
||||
// Only WebDriverAdapter is reused.
|
||||
// TODO vsavkin consider changing it when toAsyncFactory is added back or when child
|
||||
// injectors are handled better.
|
||||
@ -68,7 +68,7 @@ export class Runner {
|
||||
sampleBindings,
|
||||
bind(Options.CAPABILITIES).toValue(capabilities),
|
||||
bind(Options.USER_AGENT).toValue(userAgent),
|
||||
bind(WebDriverAdapter).toValue(adapter)
|
||||
provide(WebDriverAdapter, {asValue: adapter})
|
||||
]);
|
||||
|
||||
var sampler = injector.get(Sampler);
|
||||
@ -77,8 +77,8 @@ export class Runner {
|
||||
}
|
||||
}
|
||||
|
||||
var _DEFAULT_BINDINGS = [
|
||||
Options.DEFAULT_BINDINGS,
|
||||
var _DEFAULT_PROVIDERS = [
|
||||
Options.DEFAULT_PROVIDERS,
|
||||
Sampler.BINDINGS,
|
||||
ConsoleReporter.BINDINGS,
|
||||
RegressionSlopeValidator.BINDINGS,
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {Validator} from './validator';
|
||||
import {Metric} from './metric';
|
||||
import {Options} from './common_options';
|
||||
@ -9,7 +9,7 @@ import {Options} from './common_options';
|
||||
*/
|
||||
export class SampleDescription {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
description: {[key: string]: any};
|
||||
|
||||
constructor(public id: string, descriptions: Array<{[key: string]: any}>,
|
||||
@ -23,7 +23,7 @@ export class SampleDescription {
|
||||
toJson() { return {'id': this.id, 'description': this.description, 'metrics': this.metrics}; }
|
||||
}
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(SampleDescription)
|
||||
.toFactory((metric, id, forceGc, userAgent, validator, defaultDesc, userDesc) =>
|
||||
new SampleDescription(id,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {isPresent, isBlank, Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {Metric} from './metric';
|
||||
import {Validator} from './validator';
|
||||
@ -20,7 +20,7 @@ import {MeasureValues} from './measure_values';
|
||||
*/
|
||||
export class Sampler {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
_driver: WebDriverAdapter;
|
||||
_metric: Metric;
|
||||
@ -94,7 +94,7 @@ export class SampleState {
|
||||
constructor(public completeSample: any[], public validSample: any[]) {}
|
||||
}
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(Sampler)
|
||||
.toFactory((driver, metric, reporter, validator, prepare, execute, now) => new Sampler({
|
||||
driver: driver,
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
|
||||
import {MeasureValues} from './measure_values';
|
||||
@ -9,7 +9,7 @@ import {MeasureValues} from './measure_values';
|
||||
* in the correct way.
|
||||
*/
|
||||
export abstract class Validator {
|
||||
static bindTo(delegateToken): Binding[] {
|
||||
static bindTo(delegateToken): Provider[] {
|
||||
return [bind(Validator).toFactory((delegate) => delegate, [delegateToken])];
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {Validator} from '../validator';
|
||||
import {Statistic} from '../statistic';
|
||||
@ -15,7 +15,7 @@ export class RegressionSlopeValidator extends Validator {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get METRIC(): OpaqueToken { return _METRIC; }
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
_sampleSize: number;
|
||||
_metric: string;
|
||||
@ -53,10 +53,10 @@ export class RegressionSlopeValidator extends Validator {
|
||||
|
||||
var _SAMPLE_SIZE = new OpaqueToken('RegressionSlopeValidator.sampleSize');
|
||||
var _METRIC = new OpaqueToken('RegressionSlopeValidator.metric');
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(RegressionSlopeValidator)
|
||||
.toFactory((sampleSize, metric) => new RegressionSlopeValidator(sampleSize, metric),
|
||||
[_SAMPLE_SIZE, _METRIC]),
|
||||
bind(_SAMPLE_SIZE).toValue(10),
|
||||
bind(_METRIC).toValue('scriptTime')
|
||||
provide(_SAMPLE_SIZE, {asValue: 10}),
|
||||
provide(_METRIC, {asValue: 'scriptTime'})
|
||||
];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {bind, Binding, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {Validator} from '../validator';
|
||||
import {MeasureValues} from '../measure_values';
|
||||
@ -9,7 +9,7 @@ import {MeasureValues} from '../measure_values';
|
||||
*/
|
||||
export class SizeValidator extends Validator {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get SAMPLE_SIZE() { return _SAMPLE_SIZE; }
|
||||
|
||||
@ -33,8 +33,8 @@ export class SizeValidator extends Validator {
|
||||
}
|
||||
|
||||
var _SAMPLE_SIZE = new OpaqueToken('SizeValidator.sampleSize');
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(SizeValidator)
|
||||
.toFactory((size) => new SizeValidator(size), [_SAMPLE_SIZE]),
|
||||
bind(_SAMPLE_SIZE).toValue(10)
|
||||
provide(_SAMPLE_SIZE, {asValue: 10})
|
||||
];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {Promise} from 'angular2/src/core/facade/async';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {Map} from 'angular2/src/core/facade/collection';
|
||||
@ -9,7 +9,7 @@ import {Map} from 'angular2/src/core/facade/collection';
|
||||
* Needs one implementation for every supported WebDriver client.
|
||||
*/
|
||||
export abstract class WebDriverAdapter {
|
||||
static bindTo(delegateToken): Binding[] {
|
||||
static bindTo(delegateToken): Provider[] {
|
||||
return [bind(WebDriverAdapter).toFactory((delegate) => delegate, [delegateToken])];
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider, Injector, OpaqueToken} from 'angular2/src/core/di';
|
||||
|
||||
import {isBlank, isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
@ -12,7 +12,7 @@ import {Options} from './common_options';
|
||||
* Needs one implementation for every supported Browser.
|
||||
*/
|
||||
export abstract class WebDriverExtension {
|
||||
static bindTo(childTokens: any[]): Binding[] {
|
||||
static bindTo(childTokens: any[]): Provider[] {
|
||||
var res = [
|
||||
bind(_CHILDREN)
|
||||
.toFactory((injector: Injector) => childTokens.map(token => injector.get(token)),
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {ListWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {
|
||||
Json,
|
||||
@ -24,7 +24,7 @@ import {Options} from '../common_options';
|
||||
*/
|
||||
export class ChromeDriverExtension extends WebDriverExtension {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
private _majorChromeVersion: number;
|
||||
|
||||
@ -241,7 +241,7 @@ function normalizeEvent(chromeEvent: {[key: string]: any}, data: {[key: string]:
|
||||
return result;
|
||||
}
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(ChromeDriverExtension)
|
||||
.toFactory((driver, userAgent) => new ChromeDriverExtension(driver, userAgent),
|
||||
[WebDriverAdapter, Options.USER_AGENT])
|
||||
|
@ -1,11 +1,11 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
||||
import {WebDriverExtension, PerfLogFeatures} from '../web_driver_extension';
|
||||
import {WebDriverAdapter} from '../web_driver_adapter';
|
||||
import {Promise} from 'angular2/src/core/facade/async';
|
||||
|
||||
export class FirefoxDriverExtension extends WebDriverExtension {
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
private _profilerStarted: boolean;
|
||||
|
||||
@ -43,7 +43,7 @@ export class FirefoxDriverExtension extends WebDriverExtension {
|
||||
}
|
||||
}
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(FirefoxDriverExtension)
|
||||
.toFactory((driver) => new FirefoxDriverExtension(driver), [WebDriverAdapter])
|
||||
];
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {
|
||||
Json,
|
||||
isPresent,
|
||||
@ -14,7 +14,7 @@ import {Promise} from 'angular2/src/core/facade/async';
|
||||
|
||||
export class IOsDriverExtension extends WebDriverExtension {
|
||||
// TODO(tbosch): use static values when our transpiler supports them
|
||||
static get BINDINGS(): Binding[] { return _BINDINGS; }
|
||||
static get BINDINGS(): Provider[] { return _PROVIDERS; }
|
||||
|
||||
constructor(private _driver: WebDriverAdapter) { super(); }
|
||||
|
||||
@ -127,7 +127,7 @@ function createMarkEndEvent(name, time) {
|
||||
return createEvent('e', name, time);
|
||||
}
|
||||
|
||||
var _BINDINGS = [
|
||||
var _PROVIDERS = [
|
||||
bind(IOsDriverExtension)
|
||||
.toFactory((driver) => new IOsDriverExtension(driver), [WebDriverAdapter])
|
||||
];
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {Promise, PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
import {bind, Binding} from 'angular2/src/core/di';
|
||||
import {bind, provide, Provider} from 'angular2/src/core/di';
|
||||
import {WebDriverAdapter} from '../web_driver_adapter';
|
||||
|
||||
import * as webdriver from 'selenium-webdriver';
|
||||
@ -8,7 +8,7 @@ import * as webdriver from 'selenium-webdriver';
|
||||
* Adapter for the selenium-webdriver.
|
||||
*/
|
||||
export class SeleniumWebDriverAdapter extends WebDriverAdapter {
|
||||
static get PROTRACTOR_BINDINGS(): Binding[] { return _PROTRACTOR_BINDINGS; }
|
||||
static get PROTRACTOR_BINDINGS(): Provider[] { return _PROTRACTOR_BINDINGS; }
|
||||
|
||||
constructor(private _driver: any) { super(); }
|
||||
|
||||
@ -21,8 +21,9 @@ export class SeleniumWebDriverAdapter extends WebDriverAdapter {
|
||||
(data) => completer.resolve(convertToLocalProcess(data)), completer.reject);
|
||||
return completer.promise;
|
||||
}
|
||||
b
|
||||
|
||||
waitFor(callback): Promise<any> {
|
||||
waitFor(callback): Promise<any> {
|
||||
return this._convertPromise(this._driver.controlFlow().execute(callback));
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,12 @@ import {
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||
|
||||
import {Metric, MultiMetric, bind, Injector} from 'benchpress/common';
|
||||
import {Metric, MultiMetric, bind, provide, Injector} from 'benchpress/common';
|
||||
|
||||
export function main() {
|
||||
function createMetric(ids: any[]) {
|
||||
var m = Injector.resolveAndCreate([
|
||||
ids.map(id => bind(id).toValue(new MockMetric(id))),
|
||||
ids.map(id => provide(id, {asValue: new MockMetric(id)})),
|
||||
MultiMetric.createBindings(ids)
|
||||
])
|
||||
.get(MultiMetric);
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
WebDriverExtension,
|
||||
PerfLogFeatures,
|
||||
bind,
|
||||
provide,
|
||||
Injector,
|
||||
Options
|
||||
} from 'benchpress/common';
|
||||
@ -41,7 +42,7 @@ export function main() {
|
||||
microMetrics = StringMapWrapper.create();
|
||||
}
|
||||
var bindings = [
|
||||
Options.DEFAULT_BINDINGS,
|
||||
Options.DEFAULT_PROVIDERS,
|
||||
PerflogMetric.BINDINGS,
|
||||
bind(Options.MICRO_METRICS).toValue(microMetrics),
|
||||
bind(PerflogMetric.SET_TIMEOUT)
|
||||
|
@ -6,6 +6,7 @@ import {
|
||||
SampleState,
|
||||
Reporter,
|
||||
bind,
|
||||
provide,
|
||||
Injector,
|
||||
ConsoleReporter,
|
||||
SampleDescription,
|
||||
@ -28,7 +29,8 @@ export function main() {
|
||||
}
|
||||
var bindings = [
|
||||
ConsoleReporter.BINDINGS,
|
||||
bind(SampleDescription).toValue(new SampleDescription(sampleId, descriptions, metrics)),
|
||||
provide(SampleDescription,
|
||||
{asValue: new SampleDescription(sampleId, descriptions, metrics)}),
|
||||
bind(ConsoleReporter.PRINT).toValue((line) => log.push(line))
|
||||
];
|
||||
if (isPresent(columnWidth)) {
|
||||
|
@ -14,7 +14,14 @@ import {
|
||||
import {DateWrapper, Json, RegExpWrapper, isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
import {bind, Injector, SampleDescription, MeasureValues, Options} from 'benchpress/common';
|
||||
import {
|
||||
bind,
|
||||
provide,
|
||||
Injector,
|
||||
SampleDescription,
|
||||
MeasureValues,
|
||||
Options
|
||||
} from 'benchpress/common';
|
||||
|
||||
|
||||
import {JsonFileReporter} from 'benchpress/src/reporter/json_file_reporter';
|
||||
@ -26,7 +33,8 @@ export function main() {
|
||||
function createReporter({sampleId, descriptions, metrics, path}) {
|
||||
var bindings = [
|
||||
JsonFileReporter.BINDINGS,
|
||||
bind(SampleDescription).toValue(new SampleDescription(sampleId, descriptions, metrics)),
|
||||
provide(SampleDescription,
|
||||
{asValue: new SampleDescription(sampleId, descriptions, metrics)}),
|
||||
bind(JsonFileReporter.PATH).toValue(path),
|
||||
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(1234)),
|
||||
bind(Options.WRITE_FILE)
|
||||
|
@ -14,12 +14,12 @@ import {
|
||||
import {PromiseWrapper, Promise} from 'angular2/src/core/facade/async';
|
||||
import {DateWrapper} from 'angular2/src/core/facade/lang';
|
||||
|
||||
import {Reporter, MultiReporter, bind, Injector, MeasureValues} from 'benchpress/common';
|
||||
import {Reporter, MultiReporter, bind, provide, Injector, MeasureValues} from 'benchpress/common';
|
||||
|
||||
export function main() {
|
||||
function createReporters(ids: any[]) {
|
||||
var r = Injector.resolveAndCreate([
|
||||
ids.map(id => bind(id).toValue(new MockReporter(id))),
|
||||
ids.map(id => provide(id, {asValue: new MockReporter(id)})),
|
||||
MultiReporter.createBindings(ids)
|
||||
])
|
||||
.get(MultiReporter);
|
||||
|
@ -16,6 +16,7 @@ import {
|
||||
SampleDescription,
|
||||
Validator,
|
||||
bind,
|
||||
provide,
|
||||
Injector,
|
||||
Metric,
|
||||
Options,
|
||||
|
@ -21,6 +21,7 @@ import {
|
||||
Metric,
|
||||
Reporter,
|
||||
bind,
|
||||
provide,
|
||||
Injector,
|
||||
Options,
|
||||
MeasureValues
|
||||
@ -51,13 +52,13 @@ export function main() {
|
||||
driver = new MockDriverAdapter([]);
|
||||
}
|
||||
var bindings = [
|
||||
Options.DEFAULT_BINDINGS,
|
||||
Options.DEFAULT_PROVIDERS,
|
||||
Sampler.BINDINGS,
|
||||
bind(Metric).toValue(metric),
|
||||
bind(Reporter).toValue(reporter),
|
||||
bind(WebDriverAdapter).toValue(driver),
|
||||
provide(Metric, {asValue: metric}),
|
||||
provide(Reporter, {asValue: reporter}),
|
||||
provide(WebDriverAdapter, {asValue: driver}),
|
||||
bind(Options.EXECUTE).toValue(execute),
|
||||
bind(Validator).toValue(validator),
|
||||
provide(Validator, {asValue: validator}),
|
||||
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(time++))
|
||||
];
|
||||
if (isPresent(prepare)) {
|
||||
|
@ -7,6 +7,7 @@ import {
|
||||
RegressionSlopeValidator,
|
||||
Injector,
|
||||
bind,
|
||||
provide,
|
||||
MeasureValues
|
||||
} from 'benchpress/common';
|
||||
|
||||
|
@ -2,7 +2,7 @@ import {describe, ddescribe, it, iit, xit, expect, beforeEach, afterEach} from '
|
||||
import {Date, DateWrapper} from 'angular2/src/core/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
|
||||
import {Validator, SizeValidator, Injector, bind, MeasureValues} from 'benchpress/common';
|
||||
import {Validator, SizeValidator, Injector, bind, provide, MeasureValues} from 'benchpress/common';
|
||||
|
||||
export function main() {
|
||||
describe('size validator', () => {
|
||||
|
@ -14,13 +14,13 @@ import {
|
||||
import {isPresent, StringWrapper} from 'angular2/src/core/facade/lang';
|
||||
import {PromiseWrapper} from 'angular2/src/core/facade/async';
|
||||
|
||||
import {WebDriverExtension, bind, Injector, Options} from 'benchpress/common';
|
||||
import {WebDriverExtension, bind, provide, Injector, Options} from 'benchpress/common';
|
||||
|
||||
export function main() {
|
||||
function createExtension(ids: any[], caps) {
|
||||
return PromiseWrapper.wrap(() => {
|
||||
return Injector.resolveAndCreate([
|
||||
ids.map(id => bind(id).toValue(new MockExtension(id))),
|
||||
ids.map(id => provide(id, {asValue: new MockExtension(id)})),
|
||||
bind(Options.CAPABILITIES).toValue(caps),
|
||||
WebDriverExtension.bindTo(ids)
|
||||
])
|
||||
|
@ -20,6 +20,7 @@ import {
|
||||
WebDriverAdapter,
|
||||
Injector,
|
||||
bind,
|
||||
provide,
|
||||
Options
|
||||
} from 'benchpress/common';
|
||||
|
||||
|
@ -19,7 +19,8 @@ import {
|
||||
IOsDriverExtension,
|
||||
WebDriverAdapter,
|
||||
Injector,
|
||||
bind
|
||||
bind,
|
||||
provide
|
||||
} from 'benchpress/common';
|
||||
|
||||
import {TraceEventFactory} from '../trace_event_factory';
|
||||
@ -36,11 +37,12 @@ export function main() {
|
||||
perfRecords = [];
|
||||
}
|
||||
log = [];
|
||||
extension = Injector.resolveAndCreate([
|
||||
IOsDriverExtension.BINDINGS,
|
||||
bind(WebDriverAdapter).toValue(new MockDriverAdapter(log, perfRecords))
|
||||
])
|
||||
.get(IOsDriverExtension);
|
||||
extension =
|
||||
Injector.resolveAndCreate([
|
||||
IOsDriverExtension.BINDINGS,
|
||||
provide(WebDriverAdapter, {asValue: new MockDriverAdapter(log, perfRecords)})
|
||||
])
|
||||
.get(IOsDriverExtension);
|
||||
return extension;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user