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 | 4 |
5 library unknown_isolate_command_test; | 5 library isolate_bad_library_test; |
6 | 6 |
| 7 import 'dart:async'; |
7 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
8 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
9 | 10 |
10 class UnknownRequestTest extends VmServiceRequestHelper { | 11 class NullCollectionTest extends VmServiceRequestHelper { |
11 UnknownRequestTest(port, id) : | 12 NullCollectionTest(port, id, collection) : |
12 super('http://127.0.0.1:$port/isolates/$id/badrequest'); | 13 super('http://127.0.0.1:$port/isolates/$id/$collection/-100'); |
| 14 |
| 15 onRequestCompleted(Map reply) { |
| 16 Expect.equals('null', reply['type']); |
| 17 } |
| 18 } |
| 19 |
| 20 class BadCollectionTest extends VmServiceRequestHelper { |
| 21 BadCollectionTest(port, id, collection) : |
| 22 super('http://127.0.0.1:$port/isolates/$id/$collection'); |
13 | 23 |
14 onRequestCompleted(Map reply) { | 24 onRequestCompleted(Map reply) { |
15 Expect.equals('error', reply['type']); | 25 Expect.equals('error', reply['type']); |
16 } | 26 } |
17 } | 27 } |
18 | 28 |
19 class IsolateListTest extends VmServiceRequestHelper { | 29 class IsolateListTest extends VmServiceRequestHelper { |
20 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); | 30 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
21 | 31 |
22 int _isolateId; | 32 int _isolateId; |
23 onRequestCompleted(Map reply) { | 33 onRequestCompleted(Map reply) { |
24 IsolateListTester tester = new IsolateListTester(reply); | 34 IsolateListTester tester = new IsolateListTester(reply); |
25 tester.checkIsolateCount(1); | 35 tester.checkIsolateCount(1); |
26 tester.checkIsolateNameContains('unknown_isolate_command_script.dart'); | 36 tester.checkIsolateNameContains('unknown_isolate_command_script.dart'); |
27 _isolateId = reply['members'][0]['id']; | 37 _isolateId = reply['members'][0]['id']; |
28 } | 38 } |
29 } | 39 } |
30 | 40 |
31 | |
32 main() { | 41 main() { |
33 var process = new TestLauncher('unknown_isolate_command_script.dart'); | 42 var process = new TestLauncher('unknown_isolate_command_script.dart'); |
34 process.launch().then((port) { | 43 process.launch().then((port) { |
35 var test = new IsolateListTest(port); | 44 var test = new IsolateListTest(port); |
36 test.makeRequest().then((_) { | 45 test.makeRequest().then((_) { |
37 var unknownRequestTest = new UnknownRequestTest(port, test._isolateId); | 46 var nullCollectionRequest = |
38 unknownRequestTest.makeRequest().then((_) { | 47 new NullCollectionTest(port, test._isolateId, |
| 48 'libraries').makeRequest(); |
| 49 var requests = Future.wait([nullCollectionRequest]); |
| 50 requests.then((_) { |
39 process.requestExit(); | 51 process.requestExit(); |
40 }); | 52 }); |
41 }); | 53 }); |
42 }); | 54 }); |
43 } | 55 } |
OLD | NEW |