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

Unified Diff: tests/html/dom_isolates_test.dart

Issue 12887009: Support asynchronuous spawnDomFunction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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/dom_isolates_test.dart
diff --git a/tests/html/dom_isolates_test.dart b/tests/html/dom_isolates_test.dart
index b630f757c39542b8f4ffce524600b7c2642dbfc4..ed36360ef066c0b5cce7d4adda7953ebfc305f9b 100644
--- a/tests/html/dom_isolates_test.dart
+++ b/tests/html/dom_isolates_test.dart
@@ -19,11 +19,13 @@ isolateMain() {
}
isolateMainTrampoline() {
- final childPort = spawnDomFunction(isolateMain);
+ final future = spawnDomFunction(isolateMain);
port.receive((msg, parentPort) {
- childPort.call(msg).then((response) {
- parentPort.send(response);
- port.close();
+ future.then((childPort) {
+ childPort.call(msg).then((response) {
+ parentPort.send(response);
+ port.close();
+ });
});
});
}
@@ -34,17 +36,21 @@ main() {
useHtmlConfiguration();
test('Simple DOM isolate test', () {
- spawnDomFunction(isolateMain).call('check').then(
- expectAsync1((msg) {
- expect(msg, equals('${window.location}'));
- }));
+ spawnDomFunction(isolateMain).then((sendPort) {
+ sendPort.call('check').then(
+ expectAsync1((msg) {
+ expect(msg, equals('${window.location}'));
+ }));
+ });
});
test('Nested DOM isolates test', () {
- spawnDomFunction(isolateMainTrampoline).call('check').then(
- expectAsync1((msg) {
- expect(msg, equals('${window.location}'));
- }));
+ spawnDomFunction(isolateMainTrampoline).then((sendPort) {
+ sendPort.call('check').then(
+ expectAsync1((msg) {
+ expect(msg, equals('${window.location}'));
+ }));
+ });
});
test('Not function', () {

Powered by Google App Engine
This is Rietveld 408576698