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

Unified Diff: tests/isolate/global_error_handler_stream2_test.dart

Issue 12720015: Fix and improve isolate tests. (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 | tests/isolate/global_error_handler_stream_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/isolate/global_error_handler_stream2_test.dart
diff --git a/tests/isolate/global_error_handler_stream2_test.dart b/tests/isolate/global_error_handler_stream2_test.dart
index 8083763d97a685cb67117df74d438960338e3e65..db07be7969ffb0c804b56fe969e46b08bcae8e94 100644
--- a/tests/isolate/global_error_handler_stream2_test.dart
+++ b/tests/isolate/global_error_handler_stream2_test.dart
@@ -27,15 +27,22 @@ bool globalErrorHandler(IsolateUnhandledException e) {
}
main() {
+ var keepRunningBox = new MessageBox();
// Make sure this test doesn't last longer than 2 seconds.
var timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
var box = new MessageBox();
IsolateSink otherIsolate = streamSpawnFunction(runTest, globalErrorHandler);
otherIsolate.add(box.sink);
- otherIsolate.close();
+ // The previous event should have been handled entirely, but the current
+ // implementations don't guarantee that and might mix the done event with
+ // the handling of the previous event. We therefore delay the closing.
+ // Note: if the done is sent too early it won't lead to failing tests, but
+ // just won't make sure that the globalErrorHandler works.
+ new Timer(const Duration(milliseconds: 10), otherIsolate.close);
box.stream.single.then((msg) {
Expect.equals("received done", msg);
timer.cancel();
+ keepRunningBox.stream.close();
});
}
« no previous file with comments | « no previous file | tests/isolate/global_error_handler_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698