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

Unified Diff: tests/isolate/issue_21398_parent_isolate1_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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/issue_21398_parent_isolate1_test.dart
diff --git a/tests/isolate/issue_21398_parent_isolate1_test.dart b/tests/isolate/issue_21398_parent_isolate1_test.dart
index 6f036bd771abfb3d8e0fe84cc1490a60f0c16c1c..5681cf3b27b86cb68c6fdb6393203b27d4242433 100644
--- a/tests/isolate/issue_21398_parent_isolate1_test.dart
+++ b/tests/isolate/issue_21398_parent_isolate1_test.dart
@@ -21,33 +21,25 @@ func1Child(args) {
var receivePort = new ReceivePort();
var sendPort = args[0];
sendPort.send(receivePort.sendPort);
- receivePort.listen(
- (msg) {
- Expect.isTrue(msg is FromMainIsolate);
- Expect.equals(10, msg.fld);
- receivePort.close();
- sendPort.send("done");
- },
- onError: (e) => print('$e')
- );
+ receivePort.listen((msg) {
+ Expect.isTrue(msg is FromMainIsolate);
+ Expect.equals(10, msg.fld);
+ receivePort.close();
+ sendPort.send("done");
+ }, onError: (e) => print('$e'));
}
-
func2Child(args) {
var receivePort = new ReceivePort();
var sendPort = args[0];
sendPort.send(receivePort.sendPort);
- receivePort.listen(
- (msg) {
- Expect.isTrue(msg is SendPort);
- msg.send(new FromMainIsolate());
- receivePort.close();
- },
- onError: (e) => print('$e')
- );
+ receivePort.listen((msg) {
+ Expect.isTrue(msg is SendPort);
+ msg.send(new FromMainIsolate());
+ receivePort.close();
+ }, onError: (e) => print('$e'));
}
-
spawnFuncTest() {
var receive1 = new ReceivePort();
var receive2 = new ReceivePort();
@@ -60,67 +52,52 @@ spawnFuncTest() {
// sit there listening for a message from the second isolate spawned
// using spawnFunction.
asyncStart();
- return Isolate.spawn(func1Child, [receive1.sendPort]).then(
- (isolate) {
- receive1.listen(
- (msg) {
- if (msg is SendPort) {
- spawnFunctionIsolate1SendPort = msg;
-
- // Now spawn the second isolate using spawnFunction, this isolate
- // will create a receivePort and send it's sendPort back and then
- // wait for the third isolate spawned using spawnUri to send it
- // a sendPort to which it will try and send a non "literal-like"
- // object.
- Isolate.spawn(func2Child, [receive2.sendPort]).then(
- (isolate) {
- receive2.listen(
- (msg) {
- spawnFunctionIsolate2SendPort = msg;
- receive2.close();
-
- // Now spawn an isolate using spawnUri and send these send
- // ports over to it. This isolate will send one of the
- // sendports over to the other.
- Isolate
- .spawnUri(Uri.parse('issue_21398_child_isolate1.dart'),
- [spawnFunctionIsolate1SendPort,
- spawnFunctionIsolate2SendPort], "no-msg");
- },
- onError: (e) => print('$e')
- );
- }
- );
- } else if (msg == "done") {
- receive1.close();
- asyncEnd();
- } else {
- Expect.fail("Invalid message received: $msg");
- }
- },
- onError: (e) => print('$e')
- );
- }
- );
+ return Isolate.spawn(func1Child, [receive1.sendPort]).then((isolate) {
+ receive1.listen((msg) {
+ if (msg is SendPort) {
+ spawnFunctionIsolate1SendPort = msg;
+
+ // Now spawn the second isolate using spawnFunction, this isolate
+ // will create a receivePort and send it's sendPort back and then
+ // wait for the third isolate spawned using spawnUri to send it
+ // a sendPort to which it will try and send a non "literal-like"
+ // object.
+ Isolate.spawn(func2Child, [receive2.sendPort]).then((isolate) {
+ receive2.listen((msg) {
+ spawnFunctionIsolate2SendPort = msg;
+ receive2.close();
+
+ // Now spawn an isolate using spawnUri and send these send
+ // ports over to it. This isolate will send one of the
+ // sendports over to the other.
+ Isolate.spawnUri(
+ Uri.parse('issue_21398_child_isolate1.dart'),
+ [spawnFunctionIsolate1SendPort, spawnFunctionIsolate2SendPort],
+ "no-msg");
+ }, onError: (e) => print('$e'));
+ });
+ } else if (msg == "done") {
+ receive1.close();
+ asyncEnd();
+ } else {
+ Expect.fail("Invalid message received: $msg");
+ }
+ }, onError: (e) => print('$e'));
+ });
}
-
uriChild(args) {
var receivePort = new ReceivePort();
var sendPort = args[0];
sendPort.send(receivePort.sendPort);
- receivePort.listen(
- (msg) {
- Expect.isTrue(msg is String);
- Expect.equals("Invalid Argument(s).", msg);
- receivePort.close();
- sendPort.send("done");
- },
- onError: (e) => print('$e')
- );
+ receivePort.listen((msg) {
+ Expect.isTrue(msg is String);
+ Expect.equals("Invalid Argument(s).", msg);
+ receivePort.close();
+ sendPort.send("done");
+ }, onError: (e) => print('$e'));
}
-
spawnUriTest() {
var receive1 = new ReceivePort();
var receive2 = new ReceivePort();
@@ -133,52 +110,43 @@ spawnUriTest() {
// sit there listening for a message from the second isolate spawned
// using spawnFunction.
asyncStart();
- Isolate.spawn(uriChild, [receive1.sendPort]).then(
- (isolate) {
- receive1.listen(
- (msg) {
- if (msg is SendPort) {
- spawnFunctionIsolateSendPort = msg;
-
- // Now spawn the second isolate using spawnUri, this isolate
- // will create a receivePort and send it's sendPort back and then
- // wait for the third isolate spawned using spawnUri to send it
- // a sendPort to which it will try and send a non "literal-like"
- // object.
- Isolate.spawnUri(Uri.parse('issue_21398_child_isolate11.dart'),
- [],
- receive2.sendPort).then(
- (isolate) {
- receive2.listen(
- (msg) {
- spawnUriIsolateSendPort = msg;
- receive2.close();
-
- // Now spawn an isolate using spawnUri and send these send
- // ports over to it. This isolate will send one of the
- // sendports over to the other.
- Isolate.spawnUri(Uri.parse('issue_21398_child_isolate1.dart'),
- [spawnFunctionIsolateSendPort,
- spawnUriIsolateSendPort], "no-msg");
- },
- onError: (e) => print('$e')
- );
- }
- );
- } else if (msg == "done") {
- receive1.close();
- asyncEnd();
- } else {
- Expect.fail("Invalid message received: $msg");
- }
- },
- onError: (e) => print('$e')
- );
- }
- );
+ Isolate.spawn(uriChild, [receive1.sendPort]).then((isolate) {
+ receive1.listen((msg) {
+ if (msg is SendPort) {
+ spawnFunctionIsolateSendPort = msg;
+
+ // Now spawn the second isolate using spawnUri, this isolate
+ // will create a receivePort and send it's sendPort back and then
+ // wait for the third isolate spawned using spawnUri to send it
+ // a sendPort to which it will try and send a non "literal-like"
+ // object.
+ Isolate
+ .spawnUri(Uri.parse('issue_21398_child_isolate11.dart'), [],
+ receive2.sendPort)
+ .then((isolate) {
+ receive2.listen((msg) {
+ spawnUriIsolateSendPort = msg;
+ receive2.close();
+
+ // Now spawn an isolate using spawnUri and send these send
+ // ports over to it. This isolate will send one of the
+ // sendports over to the other.
+ Isolate.spawnUri(
+ Uri.parse('issue_21398_child_isolate1.dart'),
+ [spawnFunctionIsolateSendPort, spawnUriIsolateSendPort],
+ "no-msg");
+ }, onError: (e) => print('$e'));
+ });
+ } else if (msg == "done") {
+ receive1.close();
+ asyncEnd();
+ } else {
+ Expect.fail("Invalid message received: $msg");
+ }
+ }, onError: (e) => print('$e'));
+ });
}
-
main() {
spawnFuncTest();
spawnUriTest();

Powered by Google App Engine
This is Rietveld 408576698