OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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 library test.integration.analysis.error; | 5 library test.integration.analysis.error; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 | 11 |
| 12 import '../utils.dart'; |
12 import 'integration_tests.dart'; | 13 import 'integration_tests.dart'; |
13 | 14 |
14 main() { | 15 main() { |
| 16 initializeTestEnvironment(); |
15 // defineReflectiveTests(AsynchronyIntegrationTest); | 17 // defineReflectiveTests(AsynchronyIntegrationTest); |
16 } | 18 } |
17 | 19 |
18 /** | 20 /** |
19 * Verify that the server's input and output streams are asynchronous by | 21 * Verify that the server's input and output streams are asynchronous by |
20 * attempting to flood its input buffer with commands without listening to | 22 * attempting to flood its input buffer with commands without listening to |
21 * its output buffer for responses. The server should continue to train its | 23 * its output buffer for responses. The server should continue to train its |
22 * input buffer even though its output buffer is full. | 24 * input buffer even though its output buffer is full. |
23 * | 25 * |
24 * Once enough commands have been sent, we begin reading from the server's | 26 * Once enough commands have been sent, we begin reading from the server's |
(...skipping 26 matching lines...) Expand all Loading... |
51 // responses. | 53 // responses. |
52 Future lastMessageResult; | 54 Future lastMessageResult; |
53 for (int i = 0; i < MESSAGE_COUNT; i++) { | 55 for (int i = 0; i < MESSAGE_COUNT; i++) { |
54 lastMessageResult = server.send('server.getVersion', null); | 56 lastMessageResult = server.send('server.getVersion', null); |
55 } | 57 } |
56 | 58 |
57 // Flush the server's standard input stream to verify that it has really | 59 // Flush the server's standard input stream to verify that it has really |
58 // received them all. If the server is blocked waiting for us to read | 60 // received them all. If the server is blocked waiting for us to read |
59 // its responses, the flush will never complete. | 61 // its responses, the flush will never complete. |
60 return server.flushCommands().then((_) { | 62 return server.flushCommands().then((_) { |
61 | |
62 // Begin processing responses from the server. | 63 // Begin processing responses from the server. |
63 server.listenToOutput((String event, params) { | 64 server.listenToOutput((String event, params) { |
64 // The only expected notification is server.connected. | 65 // The only expected notification is server.connected. |
65 if (event != 'server.connected') { | 66 if (event != 'server.connected') { |
66 fail('Unexpected notification: $event'); | 67 fail('Unexpected notification: $event'); |
67 } | 68 } |
68 }); | 69 }); |
69 | 70 |
70 // Terminate the test when the response to the last message is received. | 71 // Terminate the test when the response to the last message is received. |
71 return lastMessageResult.then((_) { | 72 return lastMessageResult.then((_) { |
72 server.send("server.shutdown", null).then((_) { | 73 server.send("server.shutdown", null).then((_) { |
73 return server.exitCode; | 74 return server.exitCode; |
74 }); | 75 }); |
75 }); | 76 }); |
76 }); | 77 }); |
77 } | 78 } |
78 } | 79 } |
OLD | NEW |