OLD | NEW |
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 // Windows doesn't support sending signals. | 5 // Windows doesn't support sending signals. |
6 @TestOn("vm && !windows") | 6 @TestOn("vm && !windows") |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 }); | 43 }); |
44 | 44 |
45 test("cleans up if killed while loading a browser test", () { | 45 test("cleans up if killed while loading a browser test", () { |
46 d.file("test.dart", "void main() {}").create(); | 46 d.file("test.dart", "void main() {}").create(); |
47 | 47 |
48 var test = _runTest(["-p", "chrome", "test.dart"]); | 48 var test = _runTest(["-p", "chrome", "test.dart"]); |
49 test.stdout.expect(consumeThrough(endsWith("compiling test.dart"))); | 49 test.stdout.expect(consumeThrough(endsWith("compiling test.dart"))); |
50 signalAndQuit(test); | 50 signalAndQuit(test); |
51 | 51 |
52 expectTempDirEmpty(); | 52 expectTempDirEmpty(); |
53 }); | 53 }, tags: "chrome"); |
54 | 54 |
55 test("exits immediately if ^C is sent twice", () { | 55 test("exits immediately if ^C is sent twice", () { |
56 d.file("test.dart", """ | 56 d.file("test.dart", """ |
57 void main() { | 57 void main() { |
58 print("in test.dart"); | 58 print("in test.dart"); |
59 while (true) {} | 59 while (true) {} |
60 } | 60 } |
61 """).create(); | 61 """).create(); |
62 | 62 |
63 var test = _runTest(["test.dart"]); | 63 var test = _runTest(["test.dart"]); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 }); | 148 }); |
149 }); | 149 }); |
150 } | 150 } |
151 """).create(); | 151 """).create(); |
152 | 152 |
153 var test = _runTest(["-p", "content-shell", "test.dart"]); | 153 var test = _runTest(["-p", "content-shell", "test.dart"]); |
154 test.stdout.expect(consumeThrough("running test")); | 154 test.stdout.expect(consumeThrough("running test")); |
155 signalAndQuit(test); | 155 signalAndQuit(test); |
156 | 156 |
157 expectTempDirEmpty(); | 157 expectTempDirEmpty(); |
158 }); | 158 }, tags: "content-shell"); |
159 | 159 |
160 test("kills a VM test immediately if ^C is sent twice", () { | 160 test("kills a VM test immediately if ^C is sent twice", () { |
161 d.file("test.dart", """ | 161 d.file("test.dart", """ |
162 import 'package:test/test.dart'; | 162 import 'package:test/test.dart'; |
163 | 163 |
164 void main() { | 164 void main() { |
165 test("test", () { | 165 test("test", () { |
166 print("running test"); | 166 print("running test"); |
167 while (true) {} | 167 while (true) {} |
168 }); | 168 }); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 | 259 |
260 void signalAndQuit(ScheduledProcess test) { | 260 void signalAndQuit(ScheduledProcess test) { |
261 test.signal(ProcessSignal.SIGTERM); | 261 test.signal(ProcessSignal.SIGTERM); |
262 test.shouldExit(); | 262 test.shouldExit(); |
263 test.stderr.expect(isDone); | 263 test.stderr.expect(isDone); |
264 } | 264 } |
265 | 265 |
266 void expectTempDirEmpty() { | 266 void expectTempDirEmpty() { |
267 schedule(() => expect(new Directory(_tempDir).listSync(), isEmpty)); | 267 schedule(() => expect(new Directory(_tempDir).listSync(), isEmpty)); |
268 } | 268 } |
OLD | NEW |