| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * *Warning*: this library is **internal**, and APIs are subject to change. | 6 * *Warning*: this library is **internal**, and APIs are subject to change. |
| 7 * | 7 * |
| 8 * Wraps a callback using [wrapMicrotask] and provides the ability to pump all | 8 * Wraps a callback using [wrapMicrotask] and provides the ability to pump all |
| 9 * observable objects and [runAsync] calls via [performMicrotaskCheckpoint]. | 9 * observable objects and [runAsync] calls via [performMicrotaskCheckpoint]. |
| 10 */ | 10 */ |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 Observable.dirtyCheck(); | 42 Observable.dirtyCheck(); |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 List<Function> _pending = []; | 46 List<Function> _pending = []; |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Wraps the [testCase] in a zone that supports [performMicrotaskCheckpoint], | 49 * Wraps the [testCase] in a zone that supports [performMicrotaskCheckpoint], |
| 50 * and returns the test case. | 50 * and returns the test case. |
| 51 */ | 51 */ |
| 52 wrapMicrotask(void testCase()) { | 52 wrapMicrotask(testCase()) { |
| 53 return () { | 53 return () { |
| 54 runZonedExperimental(() { | 54 return runZonedExperimental(() { |
| 55 try { | 55 try { |
| 56 testCase(); | 56 return testCase(); |
| 57 } finally { | 57 } finally { |
| 58 performMicrotaskCheckpoint(); | 58 performMicrotaskCheckpoint(); |
| 59 } | 59 } |
| 60 }, onRunAsync: (callback) => _pending.add(callback)); | 60 }, onRunAsync: (callback) => _pending.add(callback)); |
| 61 }; | 61 }; |
| 62 } | 62 } |
| OLD | NEW |