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

Unified Diff: tests/html/custom/attribute_changed_callback_test.dart

Issue 1061403002: Better way of fixing attribute_changed_callback_test, doesn't require a timer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ... and leftover timer Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/custom/attribute_changed_callback_test.dart
diff --git a/tests/html/custom/attribute_changed_callback_test.dart b/tests/html/custom/attribute_changed_callback_test.dart
index 07abbf3e0af10637bb38f6d2d5c42cf131670bc3..d0c0e322e2a97564f915748cd21c09a7b28d414e 100644
--- a/tests/html/custom/attribute_changed_callback_test.dart
+++ b/tests/html/custom/attribute_changed_callback_test.dart
@@ -32,8 +32,14 @@ class B extends HtmlElement {
static var invocations = [];
+ Completer completer;
+
void attributeChanged(name, oldValue, newValue) {
invocations.add('$name: $oldValue => $newValue');
+ if (completer != null) {
+ completer.complete('value changed to $newValue');
+ completer = null;
+ }
}
}
@@ -90,16 +96,19 @@ main() {
B.invocations = [];
var b = new B();
+ var completer = new Completer();
+ b.completer = completer;
b.id = 'x';
-
- return new Future.delayed(new Duration(milliseconds: 1))
+ return completer.future
.then((_) => expect(B.invocations, ['created', 'id: null => x']))
.then((_) {
- B.invocations = [];
- b.attributes.remove('id');
- })
- .then((_) => new Future.delayed(new Duration(milliseconds: 1)))
- .then((_) => expect(B.invocations, ['id: x => null']));
+ B.invocations = [];
+ var secondCompleter = new Completer();
+ b.completer = secondCompleter;
+ b.attributes.remove('id');
+ return secondCompleter.future;
+ })
+ .then((_) => expect(B.invocations, ['id: x => null']));
});
});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698