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

Side by Side Diff: tests/isolate/issue_24243_parent_isolate_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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // Note: the following comment is used by test.dart to additionally compile the 5 // Note: the following comment is used by test.dart to additionally compile the
6 // other isolate's code. 6 // other isolate's code.
7 // OtherScripts=issue_24243_child1_isolate.dart 7 // OtherScripts=issue_24243_child1_isolate.dart
8 // OtherScripts=issue_24243_child2_isolate.dart 8 // OtherScripts=issue_24243_child2_isolate.dart
9 // OtherScripts=issue_24243_child3_isolate.dart 9 // OtherScripts=issue_24243_child3_isolate.dart
10 // VMOptions=--checked 10 // VMOptions=--checked
11 11
12 import 'dart:collection'; 12 import 'dart:collection';
13 import 'dart:isolate'; 13 import 'dart:isolate';
14 14
15 import "package:expect/expect.dart"; 15 import "package:expect/expect.dart";
16 16
17 main() { 17 main() {
18 // First spawn an isolate using spawnURI and have it 18 // First spawn an isolate using spawnURI and have it
19 // send back a "literal" like list object. 19 // send back a "literal" like list object.
20 var receive1 = new ReceivePort(); 20 var receive1 = new ReceivePort();
21 Isolate.spawnUri(Uri.parse('issue_24243_child1_isolate.dart'), 21 Isolate
22 [], 22 .spawnUri(
23 receive1.sendPort).then( 23 Uri.parse('issue_24243_child1_isolate.dart'), [], receive1.sendPort)
24 (isolate) { 24 .then((isolate) {
25 receive1.listen( 25 receive1.listen((msg) {
26 (msg) { 26 var list0 = <int>[1, 2, 3];
27 var list0 = <int>[1, 2, 3]; 27 var list1 = <int>[4, 5, 6];
28 var list1 = <int>[4, 5, 6]; 28 var list2 = <int>[7, 8, 9];
29 var list2 = <int>[7, 8, 9]; 29 Expect.isTrue(msg is List<List<int>>);
30 Expect.isTrue(msg is List<List<int>>); 30 Expect.listEquals(msg[0], list0);
31 Expect.listEquals(msg[0], list0); 31 Expect.listEquals(msg[1], list1);
32 Expect.listEquals(msg[1], list1); 32 Expect.listEquals(msg[2], list2);
33 Expect.listEquals(msg[2], list2); 33 Expect.throws(() => msg[0] = "throw an exception");
34 Expect.throws(() => msg[0] = "throw an exception"); 34 receive1.close();
35 receive1.close(); 35 }, onError: (e) => print('$e'));
36 }, 36 });
37 onError: (e) => print('$e')
38 );
39 }
40 );
41 37
42 // Now spawn an isolate using spawnURI and have it 38 // Now spawn an isolate using spawnURI and have it
43 // send back a "literal" like map object. 39 // send back a "literal" like map object.
44 var receive2 = new ReceivePort(); 40 var receive2 = new ReceivePort();
45 Isolate.spawnUri(Uri.parse('issue_24243_child2_isolate.dart'), 41 Isolate
46 [], 42 .spawnUri(
47 receive2.sendPort).then( 43 Uri.parse('issue_24243_child2_isolate.dart'), [], receive2.sendPort)
48 (isolate) { 44 .then((isolate) {
49 receive2.listen( 45 receive2.listen((msg) {
50 (msg) { 46 var map0 = <int, String>{1: 'one', 2: 'two', 3: 'three'};
51 var map0 = <int, String>{1:'one', 2:'two', 3:'three'}; 47 var map1 = <int, String>{4: 'four', 5: 'five', 6: 'six'};
52 var map1 = <int, String>{4:'four', 5:'five', 6:'six'}; 48 var map2 = <int, String>{7: 'seven', 8: 'eight', 9: 'nine'};
53 var map2 = <int, String>{7:'seven', 8:'eight', 9:'nine'}; 49 Expect.isTrue(msg is Map<int, Map<int, String>>);
54 Expect.isTrue(msg is Map<int, Map<int, String>>); 50 Expect.mapEquals(msg[0], map0);
55 Expect.mapEquals(msg[0], map0); 51 Expect.mapEquals(msg[1], map1);
56 Expect.mapEquals(msg[1], map1); 52 Expect.mapEquals(msg[2], map2);
57 Expect.mapEquals(msg[2], map2); 53 Expect.throws(() => msg[0] = "throw an exception");
58 Expect.throws(() => msg[0] = "throw an exception"); 54 receive2.close();
59 receive2.close(); 55 }, onError: (e) => print('$e'));
60 }, 56 });
61 onError: (e) => print('$e')
62 );
63 }
64 );
65 57
66 // Now spawn an isolate using spawnURI and have it 58 // Now spawn an isolate using spawnURI and have it
67 // send back a "literal" like LinkedHashMap object. 59 // send back a "literal" like LinkedHashMap object.
68 var receive3 = new ReceivePort(); 60 var receive3 = new ReceivePort();
69 Isolate.spawnUri(Uri.parse('issue_24243_child3_isolate.dart'), 61 Isolate
70 [], 62 .spawnUri(
71 receive3.sendPort).then( 63 Uri.parse('issue_24243_child3_isolate.dart'), [], receive3.sendPort)
72 (isolate) { 64 .then((isolate) {
73 receive3.listen( 65 receive3.listen((msg) {
74 (msg) { 66 var map0 = new LinkedHashMap<int, String>();
75 var map0 = new LinkedHashMap<int, String>(); 67 map0[1] = 'one';
76 map0[1] = 'one'; 68 map0[2] = 'two';
77 map0[2] = 'two'; 69 map0[3] = 'three';
78 map0[3] = 'three'; 70 var map1 = new LinkedHashMap<int, String>();
79 var map1 = new LinkedHashMap<int, String>(); 71 map1[4] = 'four';
80 map1[4] = 'four'; 72 map1[5] = 'five';
81 map1[5] = 'five'; 73 map1[6] = 'size';
82 map1[6] = 'size'; 74 var map2 = new LinkedHashMap<int, String>();
83 var map2 = new LinkedHashMap<int, String>(); 75 map2[7] = 'seven';
84 map2[7] = 'seven'; 76 map2[8] = 'eight';
85 map2[8] = 'eight'; 77 map2[9] = 'nine';
86 map2[9] = 'nine'; 78 Expect.isTrue(msg is Map<int, LinkedHashMap<int, String>>);
87 Expect.isTrue(msg is Map<int, LinkedHashMap<int, String>>); 79 Expect.mapEquals(msg[0], map0);
88 Expect.mapEquals(msg[0], map0); 80 Expect.mapEquals(msg[1], map1);
89 Expect.mapEquals(msg[1], map1); 81 Expect.mapEquals(msg[2], map2);
90 Expect.mapEquals(msg[2], map2); 82 Expect.throws(() => msg[0] = "throw an exception");
91 Expect.throws(() => msg[0] = "throw an exception"); 83 receive3.close();
92 receive3.close(); 84 }, onError: (e) => print('$e'));
93 }, 85 });
94 onError: (e) => print('$e')
95 );
96 }
97 );
98
99 } 86 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698