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

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

Issue 256553002: Revert "Update all Angular libs (run update_all.sh)." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
Index: third_party/pkg/angular/lib/mock/zone.dart
diff --git a/third_party/pkg/angular/lib/mock/zone.dart b/third_party/pkg/angular/lib/mock/zone.dart
index ab8c3868c8a3f860d6ea11b2eeb433d9740800bc..862d42014be740c2b0403cbb29426da913affa23 100644
--- a/third_party/pkg/angular/lib/mock/zone.dart
+++ b/third_party/pkg/angular/lib/mock/zone.dart
@@ -2,31 +2,14 @@ library angular.mock_zone;
import 'dart:async' as dart_async;
-// async and sync are function compositions.
-class FunctionComposition {
- Function outer;
- Function inner;
-
- FunctionComposition(this.outer, this.inner);
-
- call() => outer(inner)();
-}
-
final _asyncQueue = <Function>[];
final _timerQueue = <_TimerSpec>[];
final _asyncErrors = [];
bool _noMoreAsync = false;
/**
- * Processes the asynchronous queue established by [async].
- *
- * [microLeap] will process all items in the asynchronous queue,
- * including new items queued during its execution. It will re-raise
- * any exceptions that occur.
- *
- * NOTE: [microLeap] can only be used in [async] tests.
- *
- * Example:
+ * Runs any queued up async calls and any async calls queued with
+ * running microLeap. Example:
*
* it('should run async code', async(() {
* var thenRan = false;
@@ -48,7 +31,7 @@ bool _noMoreAsync = false;
*
*/
microLeap() {
- while (_asyncQueue.isNotEmpty) {
+ while (!_asyncQueue.isEmpty) {
// copy the queue as it may change.
var toRun = new List.from(_asyncQueue);
_asyncQueue.clear();
@@ -64,11 +47,6 @@ microLeap() {
}
/**
- * Returns whether the async queue is empty.
- */
-isAsyncQueueEmpty() => _asyncQueue.isEmpty;
-
-/**
* Simulates a clock tick by running any scheduled timers. Can only be used
* in [async] tests.Clock tick will call [microLeap] to process the microtask
* queue before each timer callback.
@@ -153,16 +131,7 @@ noMoreAsync() {
}
/**
- * Captures all scheduleMicrotask calls and newly created Timers
- * inside of a function.
- *
- * [async] will raise an exception if there are still active Timers
- * when the function completes.
- *
- * Use [clockTick] to process timers, and [microLeap] to process
- * scheduleMicrotask calls.
- *
- * NOTE: [async] will not return the result of [fn].
+ * Captures all scheduleMicrotask calls inside of a function.
*
* Typically used within a test:
*
@@ -170,9 +139,7 @@ noMoreAsync() {
* ...
* }));
*/
-async(Function fn) => new FunctionComposition(_asyncOuter, fn);
-
-_asyncOuter(Function fn) => () {
+async(Function fn) => () {
_noMoreAsync = false;
_asyncErrors.clear();
_timerQueue.clear();
@@ -219,11 +186,7 @@ _createTimer(Function fn, Duration duration, bool periodic) {
* Enforces synchronous code. Any calls to scheduleMicrotask inside of 'sync'
* will throw an exception.
*/
-sync(Function fn) => new FunctionComposition(_syncOuter, fn);
-
-_syncOuter(Function fn) => () {
- _asyncErrors.clear();
-
+sync(Function fn) => () {
dart_async.runZoned(fn, zoneSpecification: new dart_async.ZoneSpecification(
scheduleMicrotask: (_, __, ___, asyncFn) {
throw ['scheduleMicrotask called from sync function.'];
@@ -234,13 +197,8 @@ _syncOuter(Function fn) => () {
createPeriodicTimer:
(_, __, ___, Duration period, void f(dart_async.Timer timer)) {
throw ['periodic Timer created from sync function.'];
- },
- handleUncaughtError: (_, __, ___, e, s) => _asyncErrors.add([e, s])
+ }
));
-
- _asyncErrors.forEach((e) {
- throw "During runZoned: ${e[0]}. Stack:\n${e[1]}";
- });
};
class _TimerSpec implements dart_async.Timer {
« no previous file with comments | « third_party/pkg/angular/lib/mock/test_injection.dart ('k') | third_party/pkg/angular/lib/perf/dev_tools_timeline.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698