| 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_stacktrace_command_test; | |
| 6 | |
| 7 import 'test_helper.dart'; | |
| 8 import 'package:expect/expect.dart'; | |
| 9 | |
| 10 class StacktraceTest extends VmServiceRequestHelper { | |
| 11 StacktraceTest(port, id) : | |
| 12 super('http://127.0.0.1:$port/$id/stacktrace'); | |
| 13 | |
| 14 onRequestCompleted(Map reply) { | |
| 15 Expect.equals('StackTrace', reply['type'], 'Not a StackTrace message.'); | |
| 16 Expect.isTrue(4 <= reply['members'].length, 'Stacktrace is wrong length.'); | |
| 17 // The number of frames involved in isolate message dispatch is an | |
| 18 // implementation detail. Only check that we got all the frames for user | |
| 19 // code. | |
| 20 Expect.equals('a', reply['members'][0]['function']['name']); | |
| 21 Expect.equals('b', reply['members'][1]['function']['name']); | |
| 22 Expect.equals('c', reply['members'][2]['function']['name']); | |
| 23 Expect.equals('myIsolateName', reply['members'][3]['function']['name']); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 class VMTest extends VmServiceRequestHelper { | |
| 28 VMTest(port) : super('http://127.0.0.1:$port/vm'); | |
| 29 | |
| 30 String _isolateId; | |
| 31 onRequestCompleted(Map reply) { | |
| 32 VMTester tester = new VMTester(reply); | |
| 33 tester.checkIsolateCount(2); | |
| 34 // TODO(turnidge): Fragile. Relies on isolate order in response. | |
| 35 _isolateId = tester.getIsolateId(0); | |
| 36 } | |
| 37 } | |
| 38 | |
| 39 | |
| 40 main() { | |
| 41 var process = new TestLauncher('isolate_stacktrace_command_script.dart'); | |
| 42 process.launch().then((port) { | |
| 43 var test = new VMTest(port); | |
| 44 test.makeRequest().then((_) { | |
| 45 var stacktraceTest = new StacktraceTest(port, test._isolateId); | |
| 46 stacktraceTest.makeRequest().then((_) { | |
| 47 process.requestExit(); | |
| 48 }); | |
| 49 }); | |
| 50 }); | |
| 51 } | |
| OLD | NEW |