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

Unified Diff: tests/html/dom_isolates_test.dart

Issue 13238003: Add a test for spawning DOM isolate from a pure one. (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
« 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/dom_isolates_test.dart
diff --git a/tests/html/dom_isolates_test.dart b/tests/html/dom_isolates_test.dart
index ed36360ef066c0b5cce7d4adda7953ebfc305f9b..7ce1386c25aa2ef3d63fe9509a02c81375602c4b 100644
--- a/tests/html/dom_isolates_test.dart
+++ b/tests/html/dom_isolates_test.dart
@@ -8,7 +8,7 @@ import '../../pkg/unittest/lib/html_config.dart';
import 'dart:html';
import 'dart:isolate';
-isolateMain() {
+childDomIsolate() {
port.receive((msg, replyTo) {
if (msg != 'check') {
replyTo.send('wrong msg: $msg');
@@ -18,8 +18,8 @@ isolateMain() {
});
}
-isolateMainTrampoline() {
- final future = spawnDomFunction(isolateMain);
+trampolineIsolate() {
+ final future = spawnDomFunction(childDomIsolate);
port.receive((msg, parentPort) {
future.then((childPort) {
childPort.call(msg).then((response) {
@@ -30,29 +30,28 @@ isolateMainTrampoline() {
});
}
-dummy() => print("Bad invocation of top-level function");
+dummy() => print('Bad invocation of top-level function');
main() {
useHtmlConfiguration();
test('Simple DOM isolate test', () {
- spawnDomFunction(isolateMain).then((sendPort) {
- sendPort.call('check').then(
- expectAsync1((msg) {
- expect(msg, equals('${window.location}'));
- }));
+ spawnDomFunction(childDomIsolate).then((sendPort) {
+ expect(sendPort.call('check'), completion('${window.location}'));
});
});
test('Nested DOM isolates test', () {
- spawnDomFunction(isolateMainTrampoline).then((sendPort) {
- sendPort.call('check').then(
- expectAsync1((msg) {
- expect(msg, equals('${window.location}'));
- }));
+ spawnDomFunction(trampolineIsolate).then((sendPort) {
+ expect(sendPort.call('check'), completion('${window.location}'));
});
});
+ test('Spawn DOM isolate from pure', () {
+ expect(spawnFunction(trampolineIsolate).call('check'),
+ completion('${window.location}'));
+ });
+
test('Not function', () {
expect(() => spawnDomFunction(42), throws);
});
@@ -64,7 +63,7 @@ main() {
test('Masked local function', () {
var local = 42;
- dummy() => print("Bad invocation of local function: $local");
+ dummy() => print('Bad invocation of local function: $local');
expect(() => spawnDomFunction(dummy), throws);
});
}
« 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