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