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

Unified Diff: tests/isolate/global_error_handler2_test.dart

Issue 12919011: Remove streamSpawnUri and mangler. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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/isolate/global_error_handler2_test.dart
diff --git a/tests/lib/async/run_async4_test.dart b/tests/isolate/global_error_handler2_test.dart
similarity index 50%
copy from tests/lib/async/run_async4_test.dart
copy to tests/isolate/global_error_handler2_test.dart
index 46967dfcf1ec9b15556cd4c3c84e62569eccd2c2..014dcffd068561deb198e7be93f014db8b9f1fe3 100644
--- a/tests/lib/async/run_async4_test.dart
+++ b/tests/isolate/global_error_handler2_test.dart
@@ -2,25 +2,21 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library run_async_test;
-
import 'dart:async';
import 'dart:isolate';
-void startTest(SendPort finishPort, replyPort) {
- int invokedCallbacks = 0;
-
- for (int i = 0; i < 100; i++) {
- runAsync(() {
- invokedCallbacks++;
- if (invokedCallbacks == 100) finishPort.send("done");
- if (i == 50) throw new RuntimeError("ignore exception");
- });
- }
-}
-
runTest() {
- port.receive(startTest);
+ SendPort mainIsolate;
+ bool isFirst = true;
+ port.receive((msg, replyTo) {
+ if (isFirst) {
+ mainIsolate = msg;
+ isFirst = false;
+ throw new RuntimeError("ignore exception");
+ }
+ Expect.equals("message 2", msg);
+ mainIsolate.send("received");
+ });
}
bool globalErrorHandler(IsolateUnhandledException e) {
@@ -28,10 +24,16 @@ bool globalErrorHandler(IsolateUnhandledException e) {
}
main() {
+ // Make sure this test doesn't last longer than 2 seconds.
+ var timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
+
var port = new ReceivePort();
- var timer;
SendPort otherIsolate = spawnFunction(runTest, globalErrorHandler);
otherIsolate.send(port.toSendPort());
- port.receive((msg, replyPort) { port.close(); timer.cancel(); });
- timer = new Timer(const Duration(seconds: 2), () { throw "failed"; });
+ otherIsolate.send("message 2");
+ port.receive((msg, replyPort) {
+ Expect.equals("received", msg);
+ port.close();
+ timer.cancel();
+ });
}
« no previous file with comments | « tests/isolate/cross_isolate_message_stream_test.dart ('k') | tests/isolate/global_error_handler_stream2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698