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

Unified Diff: pkg/observe/test/observe_test_utils.dart

Issue 22253002: fix packages for latest SDK changes (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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 | « pkg/observe/lib/src/microtask.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/observe/test/observe_test_utils.dart
diff --git a/pkg/observe/test/observe_test_utils.dart b/pkg/observe/test/observe_test_utils.dart
index 2d4e7cbf63af2cf0de0cc797a7ecfccc39e66bf2..fe3e8694635cb69f5a8e717a3fd2037245adf47c 100644
--- a/pkg/observe/test/observe_test_utils.dart
+++ b/pkg/observe/test/observe_test_utils.dart
@@ -8,57 +8,15 @@ import 'dart:async';
import 'package:observe/observe.dart';
import 'package:unittest/unittest.dart';
+import 'package:observe/src/microtask.dart';
+export 'package:observe/src/microtask.dart';
+
// TODO(jmesserly): use matchers when we have a way to compare ChangeRecords.
// For now just use the toString.
expectChanges(actual, expected, {reason}) =>
expect('$actual', '$expected', reason: reason);
/**
- * This change pumps events relevant to observers and data-binding tests.
- * This must be used inside an [observeTest].
- *
- * Executes all pending [runAsync] calls on the event loop, as well as
- * performing [Observable.dirtyCheck], until there are no more pending events.
- * It will always dirty check at least once.
- */
-void performMicrotaskCheckpoint() {
- Observable.dirtyCheck();
-
- while (_pending.length > 0) {
- var pending = _pending;
- _pending = [];
-
- for (var callback in pending) {
- try {
- callback();
- } catch (e, s) {
- new Completer().completeError(e, s);
- }
- }
-
- Observable.dirtyCheck();
- }
-}
-
-List<Function> _pending = [];
-
-/**
- * Wraps the [testCase] in a zone that supports [performMicrotaskCheckpoint],
- * and returns the test case.
- */
-wrapMicrotask(void testCase()) {
- return () {
- runZonedExperimental(() {
- try {
- testCase();
- } finally {
- performMicrotaskCheckpoint();
- }
- }, onRunAsync: (callback) => _pending.add(callback));
- };
-}
-
-/**
* This is a special kind of unit [test], that supports
* calling [performMicrotaskCheckpoint] during the test to pump events
* that original from observable objects.
« no previous file with comments | « pkg/observe/lib/src/microtask.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698