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 isolate_library_test; | 5 library isolate_library_test; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 | 10 |
11 class LibraryTest extends VmServiceRequestHelper { | 11 class LibraryTest extends VmServiceRequestHelper { |
12 LibraryTest(port, id, libId) : | 12 LibraryTest(port, id, libId) : |
13 super('http://127.0.0.1:$port/isolates/$id/objects/$libId'); | 13 super('http://127.0.0.1:$port/$id/$libId'); |
14 | 14 |
15 onRequestCompleted(Map reply) { | 15 onRequestCompleted(Map reply) { |
16 Expect.equals('Library', reply['type']); | 16 Expect.equals('Library', reply['type']); |
17 Expect.equals('isolate_stacktrace_command_script', reply['name']); | 17 Expect.equals('isolate_stacktrace_command_script', reply['name']); |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 class RootLibraryTest extends VmServiceRequestHelper { | 21 class RootLibraryTest extends VmServiceRequestHelper { |
22 RootLibraryTest(port, id) : | 22 RootLibraryTest(port, id) : |
23 super('http://127.0.0.1:$port/isolates/$id/library'); | 23 super('http://127.0.0.1:$port/$id/library'); |
24 | 24 |
25 int _libId; | 25 String _libId; |
26 onRequestCompleted(Map reply) { | 26 onRequestCompleted(Map reply) { |
27 Expect.equals('Library', reply['type']); | 27 Expect.equals('Library', reply['type']); |
28 Expect.equals('isolate_stacktrace_command_script', reply['name']); | 28 Expect.equals('isolate_stacktrace_command_script', reply['name']); |
29 _libId = reply['id']; | 29 _libId = reply['id']; |
30 } | 30 } |
31 } | 31 } |
32 | 32 |
33 class IsolateListTest extends VmServiceRequestHelper { | 33 class IsolateListTest extends VmServiceRequestHelper { |
34 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); | 34 IsolateListTest(port) : super('http://127.0.0.1:$port/isolates'); |
35 | 35 |
36 int _isolateId; | 36 String _isolateId; |
37 onRequestCompleted(Map reply) { | 37 onRequestCompleted(Map reply) { |
38 IsolateListTester tester = new IsolateListTester(reply); | 38 IsolateListTester tester = new IsolateListTester(reply); |
39 tester.checkIsolateCount(2); | 39 tester.checkIsolateCount(2); |
40 tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart'); | 40 tester.checkIsolateNameContains('isolate_stacktrace_command_script.dart'); |
41 _isolateId = tester.checkIsolateNameContains('myIsolateName'); | 41 _isolateId = tester.checkIsolateNameContains('myIsolateName'); |
42 } | 42 } |
43 } | 43 } |
44 | 44 |
45 main() { | 45 main() { |
46 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); | 46 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); |
47 process.launch().then((port) { | 47 process.launch().then((port) { |
48 var test = new IsolateListTest(port); | 48 var test = new IsolateListTest(port); |
49 test.makeRequest().then((_) { | 49 test.makeRequest().then((_) { |
50 var rootLibraryTest = | 50 var rootLibraryTest = |
51 new RootLibraryTest(port, test._isolateId); | 51 new RootLibraryTest(port, test._isolateId); |
52 rootLibraryTest.makeRequest().then((_) { | 52 rootLibraryTest.makeRequest().then((_) { |
53 var libraryTest = new LibraryTest(port, test._isolateId, | 53 var libraryTest = new LibraryTest(port, test._isolateId, |
54 rootLibraryTest._libId); | 54 rootLibraryTest._libId); |
55 libraryTest.makeRequest().then((_) { | 55 libraryTest.makeRequest().then((_) { |
56 process.requestExit(); | 56 process.requestExit(); |
57 }); | 57 }); |
58 }); | 58 }); |
59 }); | 59 }); |
60 }); | 60 }); |
61 } | 61 } |
OLD | NEW |