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 @TestOn("vm") | 5 @TestOn("vm") |
6 | 6 |
7 import 'package:scheduled_test/descriptor.dart' as d; | 7 import 'package:scheduled_test/descriptor.dart' as d; |
8 import 'package:scheduled_test/scheduled_stream.dart'; | 8 import 'package:scheduled_test/scheduled_stream.dart'; |
9 import 'package:scheduled_test/scheduled_test.dart'; | 9 import 'package:scheduled_test/scheduled_test.dart'; |
10 import 'package:test/src/runner/browser/phantom_js.dart'; | 10 import 'package:test/src/runner/browser/phantom_js.dart'; |
(...skipping 17 matching lines...) Expand all Loading... |
28 server.handleJavaScript(''' | 28 server.handleJavaScript(''' |
29 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://")); | 29 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://")); |
30 webSocket.addEventListener("open", function() { | 30 webSocket.addEventListener("open", function() { |
31 webSocket.send("loaded!"); | 31 webSocket.send("loaded!"); |
32 }); | 32 }); |
33 '''); | 33 '''); |
34 | 34 |
35 var webSocket = server.handleWebSocket(); | 35 var webSocket = server.handleWebSocket(); |
36 | 36 |
37 schedule(() async { | 37 schedule(() async { |
38 expect(await (await webSocket).first, equals("loaded!")); | 38 expect(await (await webSocket).stream.first, equals("loaded!")); |
39 }); | 39 }); |
40 }); | 40 }); |
41 | 41 |
42 test("a process can be killed synchronously after it's started", () async { | 42 test("a process can be killed synchronously after it's started", () async { |
43 var server = new CodeServer(); | 43 var server = new CodeServer(); |
44 | 44 |
45 schedule(() async { | 45 schedule(() async { |
46 var phantomJS = new PhantomJS(await server.url); | 46 var phantomJS = new PhantomJS(await server.url); |
47 await phantomJS.close(); | 47 await phantomJS.close(); |
48 }); | 48 }); |
(...skipping 27 matching lines...) Expand all Loading... |
76 void main() { | 76 void main() { |
77 test("failure", () => throw new TestFailure("oh no")); | 77 test("failure", () => throw new TestFailure("oh no")); |
78 } | 78 } |
79 """).create(); | 79 """).create(); |
80 | 80 |
81 var test = runTest(["-p", "phantomjs", "test.dart"]); | 81 var test = runTest(["-p", "phantomjs", "test.dart"]); |
82 test.stdout.expect(consumeThrough(contains("-1: Some tests failed."))); | 82 test.stdout.expect(consumeThrough(contains("-1: Some tests failed."))); |
83 test.shouldExit(1); | 83 test.shouldExit(1); |
84 }); | 84 }); |
85 } | 85 } |
OLD | NEW |