Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Unified Diff: third_party/pkg/angular/lib/mock/test_injection.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/pkg/angular/lib/mock/test_bed.dart ('k') | third_party/pkg/angular/lib/mock/zone.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/pkg/angular/lib/mock/test_injection.dart
===================================================================
--- third_party/pkg/angular/lib/mock/test_injection.dart (revision 33054)
+++ third_party/pkg/angular/lib/mock/test_injection.dart (working copy)
@@ -5,9 +5,8 @@
class _SpecInjector {
DynamicInjector moduleInjector;
DynamicInjector injector;
- dynamic injectiorCreateLocation;
- final modules = <Module>[];
- final initFns = <Function>[];
+ List<Module> modules = [];
+ List<Function> initFns = [];
_SpecInjector() {
var moduleModule = new Module()
@@ -24,13 +23,12 @@
}
module(fnOrModule, [declarationStack]) {
- if (injectiorCreateLocation != null) {
- throw "Injector already created at:\n$injectiorCreateLocation";
- }
try {
if (fnOrModule is Function) {
var initFn = moduleInjector.invoke(fnOrModule);
- if (initFn is Function) initFns.add(initFn);
+ if (initFn is Function) {
+ initFns.add(initFn);
+ }
} else if (fnOrModule is Module) {
addModule(fnOrModule);
} else {
@@ -44,7 +42,6 @@
inject(Function fn, [declarationStack]) {
try {
if (injector == null) {
- injectiorCreateLocation = declarationStack;
injector = new DynamicInjector(modules: modules); // Implicit injection is disabled.
initFns.forEach((fn) {
injector.invoke(fn);
@@ -58,7 +55,6 @@
reset() {
injector = null;
- injectiorCreateLocation = null;
}
}
@@ -85,12 +81,12 @@
*
*/
inject(Function fn) {
- try {
- throw '';
- } catch (e, stack) {
- return _currentSpecInjector == null
- ? () => _currentSpecInjector.inject(fn, stack)
- : _currentSpecInjector.inject(fn, stack);
+ try { throw ''; } catch (e, stack) {
+ if (_currentSpecInjector == null ) {
+ return () => _currentSpecInjector.inject(fn, stack);
+ } else {
+ return _currentSpecInjector.inject(fn, stack);
+ }
}
}
@@ -112,28 +108,27 @@
* });
*/
module(fnOrModule) {
- try {
- throw '';
- } catch(e, stack) {
- return _currentSpecInjector == null
- ? () => _currentSpecInjector.module(fnOrModule, stack)
- : _currentSpecInjector.module(fnOrModule, stack);
+ try { throw ''; } catch(e, stack) {
+ if (_currentSpecInjector == null ) {
+ return () => _currentSpecInjector.module(fnOrModule, stack);
+ } else {
+ return _currentSpecInjector.module(fnOrModule, stack);
+ }
}
}
/**
* Call this method in your test harness [setUp] method to setup the injector.
*/
-void setUpInjector() {
+setUpInjector() {
_currentSpecInjector = new _SpecInjector();
_currentSpecInjector.module((Module m) {
- m..install(new AngularModule())..install(new AngularMockModule());
+ m.install(new AngularModule());
+ m.install(new AngularMockModule());
});
}
/**
* Call this method in your test harness [tearDown] method to cleanup the injector.
*/
-void tearDownInjector() {
- _currentSpecInjector = null;
-}
+tearDownInjector() => _currentSpecInjector = null;
« no previous file with comments | « third_party/pkg/angular/lib/mock/test_bed.dart ('k') | third_party/pkg/angular/lib/mock/zone.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698