| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 library isolate_class_test; | |
| 6 | |
| 7 import 'dart:async'; | |
| 8 import 'test_helper.dart'; | |
| 9 import 'package:expect/expect.dart'; | |
| 10 | |
| 11 class ClassTest extends VmServiceRequestHelper { | |
| 12 ClassTest(port, id, classId) : | |
| 13 super('http://127.0.0.1:$port/$id/$classId'); | |
| 14 | |
| 15 onRequestCompleted(Map reply) { | |
| 16 Expect.equals('Class', reply['type']); | |
| 17 Expect.equals('C', reply['name']); | |
| 18 Expect.equals('isolate_stacktrace_command_script', | |
| 19 reply['library']['name']); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 class LibraryTest extends VmServiceRequestHelper { | |
| 24 LibraryTest(port, id, libId) : | |
| 25 super('http://127.0.0.1:$port/$id/$libId'); | |
| 26 | |
| 27 String _classId; | |
| 28 onRequestCompleted(Map reply) { | |
| 29 Expect.equals('Library', reply['type']); | |
| 30 Expect.equals('isolate_stacktrace_command_script', reply['name']); | |
| 31 Expect.equals(1, reply['classes'].length); | |
| 32 Expect.equals('@Class', reply['classes'][0]['type']); | |
| 33 Expect.equals('C', reply['classes'][0]['name']); | |
| 34 _classId = reply['classes'][0]['id']; | |
| 35 } | |
| 36 } | |
| 37 | |
| 38 class IsolateSummaryTest extends VmServiceRequestHelper { | |
| 39 IsolateSummaryTest(port, id) : | |
| 40 super('http://127.0.0.1:$port/$id/'); | |
| 41 | |
| 42 String _libId; | |
| 43 onRequestCompleted(Map reply) { | |
| 44 Expect.equals('Isolate', reply['type']); | |
| 45 Expect.equals('isolate_stacktrace_command_script', reply['rootLib']['name'])
; | |
| 46 _libId = reply['rootLib']['id']; | |
| 47 } | |
| 48 } | |
| 49 | |
| 50 class VMTest extends VmServiceRequestHelper { | |
| 51 VMTest(port) : super('http://127.0.0.1:$port/vm'); | |
| 52 | |
| 53 String _isolateId; | |
| 54 onRequestCompleted(Map reply) { | |
| 55 VMTester tester = new VMTester(reply); | |
| 56 tester.checkIsolateCount(2); | |
| 57 // TODO(turnidge): Fragile. Relies on isolate order in response. | |
| 58 _isolateId = tester.getIsolateId(1); | |
| 59 } | |
| 60 } | |
| 61 | |
| 62 main() { | |
| 63 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); | |
| 64 process.launch().then((port) { | |
| 65 var test = new VMTest(port); | |
| 66 test.makeRequest().then((_) { | |
| 67 var isolateSummaryTest = | |
| 68 new IsolateSummaryTest(port, test._isolateId); | |
| 69 isolateSummaryTest.makeRequest().then((_) { | |
| 70 var libraryTest = new LibraryTest(port, test._isolateId, | |
| 71 isolateSummaryTest._libId); | |
| 72 libraryTest.makeRequest().then((_) { | |
| 73 var classTest = new ClassTest(port, test._isolateId, | |
| 74 libraryTest._classId); | |
| 75 classTest.makeRequest().then((_) { | |
| 76 process.requestExit(); | |
| 77 }); | |
| 78 }); | |
| 79 }); | |
| 80 }); | |
| 81 }); | |
| 82 } | |
| OLD | NEW |