refactor(chore): Replace all 'bindings' with 'providers'

BREAKING CHANGE

Deprecated `bindings:` and `viewBindings:` are replaced with
`providers:` and `viewProviders:`

Closes #7687
This commit is contained in:
Vamsi Varikuti
2016-03-21 16:27:17 +05:30
committed by Misko Hevery
parent 49fb7ef421
commit 0795dd307b
36 changed files with 97 additions and 142 deletions

View File

@ -25,7 +25,7 @@ describe('deep tree baseline', function() {
id: 'baseline',
execute: function() { $('button')
.click(); },
bindings: [benchpress.bind(benchpress.Options.SAMPLE_DESCRIPTION).toValue({depth: 9})]
providers: [benchpress.bind(benchpress.Options.SAMPLE_DESCRIPTION).toValue({depth: 9})]
})
.then(done, done.fail);
});

View File

@ -48,9 +48,9 @@ export function main() {
if (isBlank(microMetrics)) {
microMetrics = StringMapWrapper.create();
}
var bindings = [
var providers = [
Options.DEFAULT_PROVIDERS,
PerflogMetric.BINDINGS,
PerflogMetric.PROVIDERS,
bind(Options.MICRO_METRICS).toValue(microMetrics),
bind(PerflogMetric.SET_TIMEOUT)
.toValue((fn, millis) => {
@ -61,18 +61,18 @@ export function main() {
.toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures))
];
if (isPresent(forceGc)) {
bindings.push(bind(Options.FORCE_GC).toValue(forceGc));
providers.push(bind(Options.FORCE_GC).toValue(forceGc));
}
if (isPresent(captureFrames)) {
bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
providers.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames));
}
if (isPresent(receivedData)) {
bindings.push(bind(Options.RECEIVED_DATA).toValue(receivedData));
providers.push(bind(Options.RECEIVED_DATA).toValue(receivedData));
}
if (isPresent(requestCount)) {
bindings.push(bind(Options.REQUEST_COUNT).toValue(requestCount));
providers.push(bind(Options.REQUEST_COUNT).toValue(requestCount));
}
return ReflectiveInjector.resolveAndCreate(bindings).get(PerflogMetric);
return ReflectiveInjector.resolveAndCreate(providers).get(PerflogMetric);
}
describe('perflog metric', () => {

View File

@ -37,7 +37,7 @@ export function main() {
sampleId = 'null';
}
var bindings = [
ConsoleReporter.BINDINGS,
ConsoleReporter.PROVIDERS,
provide(SampleDescription,
{useValue: new SampleDescription(sampleId, descriptions, metrics)}),
bind(ConsoleReporter.PRINT).toValue((line) => log.push(line))

View File

@ -32,7 +32,7 @@ export function main() {
function createReporter({sampleId, descriptions, metrics, path}) {
var bindings = [
JsonFileReporter.BINDINGS,
JsonFileReporter.PROVIDERS,
provide(SampleDescription,
{useValue: new SampleDescription(sampleId, descriptions, metrics)}),
bind(JsonFileReporter.PATH).toValue(path),

View File

@ -63,7 +63,7 @@ export function main() {
it('should merge SampleDescription.description', inject([AsyncTestCompleter], (async) => {
createRunner([bind(Options.DEFAULT_DESCRIPTION).toValue({'a': 1})])
.sample({id: 'someId', bindings: [bind(Options.SAMPLE_DESCRIPTION).toValue({'b': 2})]})
.sample({id: 'someId', providers: [bind(Options.SAMPLE_DESCRIPTION).toValue({'b': 2})]})
.then((_) => injector.get(SampleDescription))
.then((desc) => {
expect(desc.description)
@ -121,7 +121,7 @@ export function main() {
])
.sample({
id: 'someId',
bindings: [
providers: [
bind(Options.DEFAULT_DESCRIPTION)
.toValue({'a': 2}),
]

View File

@ -51,9 +51,9 @@ export function main() {
if (isBlank(driver)) {
driver = new MockDriverAdapter([]);
}
var bindings = [
var providers = [
Options.DEFAULT_PROVIDERS,
Sampler.BINDINGS,
Sampler.PROVIDERS,
provide(Metric, {useValue: metric}),
provide(Reporter, {useValue: reporter}),
provide(WebDriverAdapter, {useValue: driver}),
@ -62,10 +62,10 @@ export function main() {
bind(Options.NOW).toValue(() => DateWrapper.fromMillis(time++))
];
if (isPresent(prepare)) {
bindings.push(bind(Options.PREPARE).toValue(prepare));
providers.push(bind(Options.PREPARE).toValue(prepare));
}
sampler = ReflectiveInjector.resolveAndCreate(bindings).get(Sampler);
sampler = ReflectiveInjector.resolveAndCreate(providers).get(Sampler);
}
it('should call the prepare and execute callbacks using WebDriverAdapter.waitFor',

View File

@ -26,9 +26,9 @@ export function main() {
function createValidator({size, metric}) {
validator = ReflectiveInjector.resolveAndCreate([
RegressionSlopeValidator.BINDINGS,
bind(RegressionSlopeValidator.METRIC).toValue(metric),
bind(RegressionSlopeValidator.SAMPLE_SIZE).toValue(size)
RegressionSlopeValidator.PROVIDERS,
provide(RegressionSlopeValidator.METRIC).toValue(metric),
provide(RegressionSlopeValidator.SAMPLE_SIZE).toValue(size)
])
.get(RegressionSlopeValidator);
}

View File

@ -26,8 +26,8 @@ export function main() {
function createValidator(size) {
validator = ReflectiveInjector.resolveAndCreate([
SizeValidator.BINDINGS,
bind(SizeValidator.SAMPLE_SIZE).toValue(size)
SizeValidator.PROVIDERS,
provide(SizeValidator.SAMPLE_SIZE).toValue(size)
])
.get(SizeValidator);
}

View File

@ -59,10 +59,10 @@ export function main() {
log = [];
extension =
ReflectiveInjector.resolveAndCreate([
ChromeDriverExtension.BINDINGS,
bind(WebDriverAdapter)
ChromeDriverExtension.PROVIDERS,
provide(WebDriverAdapter)
.toValue(new MockDriverAdapter(log, perfRecords, messageMethod)),
bind(Options.USER_AGENT).toValue(userAgent)
provide(Options.USER_AGENT).toValue(userAgent)
])
.get(ChromeDriverExtension);
return extension;

View File

@ -38,7 +38,7 @@ export function main() {
}
log = [];
extension = ReflectiveInjector.resolveAndCreate([
IOsDriverExtension.BINDINGS,
IOsDriverExtension.PROVIDERS,
provide(WebDriverAdapter,
{useValue: new MockDriverAdapter(log, perfRecords)})
])