@ -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