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

Side by Side Diff: tests/isolate/isolate_create_error_test.dart

Issue 297413002: Ensure that failure to start an isolate all end up in the future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make test file be named *_test.dart Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « tests/isolate/isolate_create_error_helper_syntax_error.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
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.
4
5 library isolate.create.error;
6
7 import "dart:async";
8 import "dart:isolate";
9 import "package:expect/expect.dart";
10 import "package:async_helper/async_helper.dart";
11
12 void main() {
13 asyncStart();
14 isolateBadUriScheme(); /// 01: ok
15 isolateBadServerUri(); /// 02: ok
16 isolate404Uri(); /// 03: ok
17 isolateMissingFileUri(); /// 04: ok
18 isolateBadParse(); /// 05: ok
19 isolateNoMain(); /// 06: ok
20 isolateBadMain(); /// 07: ok
21 isolateBoolMain(); /// 08: ok
22 isolateFuncGetMain(); /// 09: ok
23 isolateFuncConstMain(); /// 10: ok
24 asyncEnd();
25 }
26
27 badSuccess(x) {
28 print("Unexpected non-error: $x");
29 }
30
31 void isolateBadUriScheme() {
32 asyncStart();
33 Future<Isolate> result = Isolate.spawnUri(
34 Uri.parse("wtf://example.com/NOT"), ["A"], null);
35 result.then(badSuccess, onError: (IsolateSpawnException e) {
Søren Gjesse 2014/05/28 12:00:42 Add an expectation for e instead of print (in all
36 print("A: $e");
37 asyncEnd();
38 });
39 }
40
41 void isolateBadServerUri() {
42 asyncStart();
43 Future<Isolate> result = Isolate.spawnUri(
44 Uri.parse("http://nosuchserver-dartlang.org/index.html"), ["B"], null);
45 result.then(badSuccess, onError: (IsolateSpawnException e) {
46 print("B: $e");
47 asyncEnd();
48 });
49 }
50
51 void isolate404Uri() {
52 asyncStart();
53 Future<Isolate> result = Isolate.spawnUri(
54 Uri.parse("http://dartlang.org/THISPAGENOTFOUND"), ["C"], null);
55 result.then(badSuccess, onError: (IsolateSpawnException e) {
56 print("C: $e");
57 asyncEnd();
58 });
59 }
60
61 void isolateMissingFileUri() {
62 asyncStart();
63 Future<Isolate> result = Isolate.spawnUri(
64 Uri.parse("./THISFILENOTFOUND"), ["D"], null);
65 result.then(badSuccess, onError: (IsolateSpawnException e) {
66 print("D: $e");
67 asyncEnd();
68 });
69 }
70
71 void isolateBadParse() {
72 asyncStart();
73 Future<Isolate> result = Isolate.spawnUri(
74 Uri.parse("./isolate_create_error_helper_syntax_error.dart"),
75 ["E"], null);
76 result.then(badSuccess, onError: (IsolateSpawnException e) {
77 print("E: $e");
78 asyncEnd();
79 });
80 }
81
82 void isolateNoMain() {
83 asyncStart();
84 Future<Isolate> result = Isolate.spawnUri(
85 Uri.parse("./isolate_create_error_helper_lib.dart"), ["F"], null);
86 result.then(badSuccess, onError: (IsolateSpawnException e) {
87 print("F: $e");
88 asyncEnd();
89 });
90 }
91
92 void isolateBadMain() {
93 // Spawned library has a main method expecting three arguments.
94 asyncStart();
95 Future<Isolate> result = Isolate.spawnUri(
96 Uri.parse("./isolate_create_error_helper_lib2.dart"), ["G"], null);
97 result.then(badSuccess, onError: (IsolateSpawnException e) {
98 print("G: $e");
99 asyncEnd();
100 });
101 }
102
103 void isolateBoolMain() {
104 // Spawned library has a bool main field.
105 asyncStart();
106 Future<Isolate> result = Isolate.spawnUri(
107 Uri.parse("./isolate_create_error_helper_lib3.dart"), ["H"], null);
108 result.then(badSuccess, onError: (IsolateSpawnException e) {
109 print("H: $e");
110 asyncEnd();
111 });
112 }
113
114 void isolateFuncGetMain() {
115 // Spawned library has a lazy final main field with a function type.
116 asyncStart();
117 Future<Isolate> result = Isolate.spawnUri(
118 Uri.parse("./isolate_create_error_helper_lib4.dart"), ["I"], null);
119 result.then(badSuccess, onError: (IsolateSpawnException e) {
120 print("I: $e");
121 asyncEnd();
122 });
123 }
124
125 void isolateFuncConstMain() {
126 // Spawned library has a const main field with a function type.
127 asyncStart();
128 Future<Isolate> result = Isolate.spawnUri(
129 Uri.parse("./isolate_create_error_helper_lib5.dart"), ["J"], null);
130 result.then(badSuccess, onError: (IsolateSpawnException e) {
131 print("J: $e");
132 asyncEnd();
133 });
134 }
135
136
OLDNEW
« no previous file with comments | « tests/isolate/isolate_create_error_helper_syntax_error.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698