| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 // VMOptions=--short_socket_read | 4 // VMOptions=--short_socket_read |
| 5 // VMOptions=--short_socket_write | 5 // VMOptions=--short_socket_write |
| 6 // VMOptions=--short_socket_read --short_socket_write | 6 // VMOptions=--short_socket_read --short_socket_write |
| 7 // | 7 // |
| 8 // Test: | 8 // Test: |
| 9 // *) Connect to VM Service and obtain list of running isolates. | 9 // *) Connect to VM Service and obtain list of running isolates. |
| 10 | 10 |
| 11 library isolate_list_test; | 11 library unknown_isolate_command_test; |
| 12 | 12 |
| 13 import 'test_helper.dart'; | 13 import 'test_helper.dart'; |
| 14 import 'package:expect/expect.dart'; | 14 import 'package:expect/expect.dart'; |
| 15 | 15 |
| 16 class UnknownRequestTest extends VmServiceRequestHelper { |
| 17 UnknownRequestTest(port, id) : |
| 18 super('http://127.0.0.1:$port/isolates/$id/badrequest'); |
| 19 |
| 20 onRequestCompleted(Map reply) { |
| 21 Expect.equals('error', reply['type']); |
| 22 } |
| 23 } |
| 16 | 24 |
| 17 class IsolateListTest extends VmServiceRequestHelper { | 25 class IsolateListTest extends VmServiceRequestHelper { |
| 18 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); | 26 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
| 19 | 27 |
| 28 int _isolateId; |
| 20 onRequestCompleted(Map reply) { | 29 onRequestCompleted(Map reply) { |
| 21 IsolateListTester tester = new IsolateListTester(reply); | 30 IsolateListTester tester = new IsolateListTester(reply); |
| 22 tester.checkIsolateCount(1); | 31 tester.checkIsolateCount(1); |
| 23 tester.checkIsolateNameContains('isolate_list_script.dart'); | 32 tester.checkIsolateNameContains('unknown_isolate_command_script.dart'); |
| 33 _isolateId = reply['members'][0]['id']; |
| 24 } | 34 } |
| 25 } | 35 } |
| 26 | 36 |
| 27 | 37 |
| 28 main() { | 38 main() { |
| 29 var process = new TestLauncher('isolate_list_script.dart'); | 39 var process = new TestLauncher('unknown_isolate_command_script.dart'); |
| 30 process.launch().then((port) { | 40 process.launch().then((port) { |
| 31 var test = new IsolateListTest(port); | 41 var test = new IsolateListTest(port); |
| 32 test.makeRequest().then((_) { | 42 test.makeRequest().then((_) { |
| 33 process.requestExit(); | 43 var unknownRequestTest = new UnknownRequestTest(port, test._isolateId); |
| 44 unknownRequestTest.makeRequest().then((_) { |
| 45 process.requestExit(); |
| 46 }); |
| 34 }); | 47 }); |
| 35 }); | 48 }); |
| 36 } | 49 } |
| OLD | NEW |