| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2014, 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 gc_test; | |
| 6 | |
| 7 import 'test_helper.dart'; | |
| 8 import 'package:observatory/service_io.dart'; | |
| 9 import 'package:unittest/unittest.dart'; | |
| 10 | |
| 11 import 'dart:io'; | |
| 12 | |
| 13 // Expect at least this many GC events. | |
| 14 int gcCountdown = 3; | |
| 15 | |
| 16 void onEvent(ServiceEvent event) { | |
| 17 if (event.eventType != 'GC') { | |
| 18 return; | |
| 19 } | |
| 20 if (--gcCountdown == 0) { | |
| 21 exit(0); | |
| 22 } | |
| 23 } | |
| 24 | |
| 25 main() { | |
| 26 String script = 'gc_script.dart'; | |
| 27 var process = new TestLauncher(script); | |
| 28 process.launch().then((port) { | |
| 29 String addr = 'ws://localhost:$port/ws'; | |
| 30 new WebSocketVM(new WebSocketVMTarget(addr)).get('vm') | |
| 31 .then((VM vm) { | |
| 32 vm.events.stream.listen(onEvent); | |
| 33 }); | |
| 34 }); | |
| 35 } | |
| OLD | NEW |