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

Unified Diff: tests/html/native_gc_test.dart

Issue 12040059: Converting tests over to using event streams. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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: tests/html/native_gc_test.dart
diff --git a/tests/html/native_gc_test.dart b/tests/html/native_gc_test.dart
index e85acfb7bc0c27d5289c522d90f190e9a455088f..45a89e996cdaf871774781139f8bd0d544c586f9 100644
--- a/tests/html/native_gc_test.dart
+++ b/tests/html/native_gc_test.dart
@@ -3,6 +3,8 @@ import '../../pkg/unittest/lib/unittest.dart';
import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
+var testEvent = new EventStreamProvider<Event>('test');
+
main() {
useHtmlConfiguration();
@@ -20,15 +22,15 @@ main() {
l[N - 1] = i;
div = new Element.tag('div');
- div.on['test'].add((_) {
+ testEvent.forTarget(div).listen((_) {
// Only the final iteration's listener should be invoked.
// Note: the reference to l keeps the entire list alive.
expect(l[N - 1], M - 1);
- }, false);
+ });
}
final event = new Event('test');
- div.on['test'].dispatch(event);
+ div.dispatchEvent(event);
});
test('WindowEventListener', () {
@@ -37,7 +39,7 @@ main() {
Element testDiv = new DivElement();
testDiv.id = '#TestDiv';
document.body.nodes.add(testDiv);
- window.on.message.add((e) {
+ window.onMessage.listen((e) {
if (e.data == message) testDiv.click();
});
@@ -45,7 +47,7 @@ main() {
triggerMajorGC();
}
- testDiv.on.click.add(expectAsync1((e) {}));
+ testDiv.onClick.listen(expectAsync1((e) {}));
window.postMessage(message, '*');
});
}
@@ -53,5 +55,5 @@ main() {
void triggerMajorGC() {
List list = new List.fixedLength(1000000);
Element div = new DivElement();
- div.on.click.add((e) => print(list[0]));
+ div.onClick.listen((e) => print(list[0]));
}

Powered by Google App Engine
This is Rietveld 408576698