| 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 test_helper; | 5 library test_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'package:observatory/service_io.dart'; | 10 import 'package:observatory/service_io.dart'; |
| 11 import 'package:stack_trace/stack_trace.dart'; |
| 11 import 'service_test_common.dart'; | 12 import 'service_test_common.dart'; |
| 12 | 13 |
| 13 /// Will be set to the http address of the VM's service protocol before | 14 /// Will be set to the http address of the VM's service protocol before |
| 14 /// any tests are invoked. | 15 /// any tests are invoked. |
| 15 String serviceHttpAddress; | 16 String serviceHttpAddress; |
| 16 String serviceWebsocketAddress; | 17 String serviceWebsocketAddress; |
| 17 | 18 |
| 18 bool _isWebSocketDisconnect(e) { | 19 bool _isWebSocketDisconnect(e) { |
| 19 return e is NetworkRpcException; | 20 return e is NetworkRpcException; |
| 20 } | 21 } |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 bool pause_on_start: false, | 265 bool pause_on_start: false, |
| 265 bool pause_on_exit: false, | 266 bool pause_on_exit: false, |
| 266 bool trace_service: false, | 267 bool trace_service: false, |
| 267 bool trace_compiler: false, | 268 bool trace_compiler: false, |
| 268 bool verbose_vm: false, | 269 bool verbose_vm: false, |
| 269 bool pause_on_unhandled_exceptions: false}) { | 270 bool pause_on_unhandled_exceptions: false}) { |
| 270 var port = 8100; | 271 var port = 8100; |
| 271 serviceWebsocketAddress = 'ws://localhost:$port/ws'; | 272 serviceWebsocketAddress = 'ws://localhost:$port/ws'; |
| 272 serviceHttpAddress = 'http://localhost:$port'; | 273 serviceHttpAddress = 'http://localhost:$port'; |
| 273 var name = Platform.script.pathSegments.last; | 274 var name = Platform.script.pathSegments.last; |
| 274 runZoned(() async { | 275 Chain.capture(() async { |
| 275 var vm = | 276 var vm = |
| 276 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); | 277 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); |
| 277 print('Loading VM...'); | 278 print('Loading VM...'); |
| 278 await vm.load(); | 279 await vm.load(); |
| 279 print('Done loading VM'); | 280 print('Done loading VM'); |
| 280 | 281 |
| 281 // Run vm tests. | 282 // Run vm tests. |
| 282 if (vmTests != null) { | 283 if (vmTests != null) { |
| 283 var testIndex = 1; | 284 var testIndex = 1; |
| 284 var totalTests = vmTests.length; | 285 var totalTests = vmTests.length; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 trace_service, trace_compiler).then((port) async { | 332 trace_service, trace_compiler).then((port) async { |
| 332 if (mainArgs.contains("--gdb")) { | 333 if (mainArgs.contains("--gdb")) { |
| 333 var pid = process.process.pid; | 334 var pid = process.process.pid; |
| 334 var wait = new Duration(seconds: 10); | 335 var wait = new Duration(seconds: 10); |
| 335 print("Testee has pid $pid, waiting $wait before continuing"); | 336 print("Testee has pid $pid, waiting $wait before continuing"); |
| 336 sleep(wait); | 337 sleep(wait); |
| 337 } | 338 } |
| 338 serviceWebsocketAddress = 'ws://localhost:$port/ws'; | 339 serviceWebsocketAddress = 'ws://localhost:$port/ws'; |
| 339 serviceHttpAddress = 'http://localhost:$port'; | 340 serviceHttpAddress = 'http://localhost:$port'; |
| 340 var name = Platform.script.pathSegments.last; | 341 var name = Platform.script.pathSegments.last; |
| 341 runZoned(() async { | 342 Chain.capture(() async { |
| 342 var vm = | 343 var vm = |
| 343 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); | 344 new WebSocketVM(new WebSocketVMTarget(serviceWebsocketAddress)); |
| 344 print('Loading VM...'); | 345 print('Loading VM...'); |
| 345 await vm.load(); | 346 await vm.load(); |
| 346 print('Done loading VM'); | 347 print('Done loading VM'); |
| 347 | 348 |
| 348 // Run vm tests. | 349 // Run vm tests. |
| 349 if (vmTests != null) { | 350 if (vmTests != null) { |
| 350 var testIndex = 1; | 351 var testIndex = 1; |
| 351 var totalTests = vmTests.length; | 352 var totalTests = vmTests.length; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 mainArgs: mainArgs, | 486 mainArgs: mainArgs, |
| 486 vmTests: tests, | 487 vmTests: tests, |
| 487 pause_on_start: pause_on_start, | 488 pause_on_start: pause_on_start, |
| 488 pause_on_exit: pause_on_exit, | 489 pause_on_exit: pause_on_exit, |
| 489 trace_service: trace_service, | 490 trace_service: trace_service, |
| 490 trace_compiler: trace_compiler, | 491 trace_compiler: trace_compiler, |
| 491 verbose_vm: verbose_vm, | 492 verbose_vm: verbose_vm, |
| 492 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); | 493 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); |
| 493 } | 494 } |
| 494 } | 495 } |
| OLD | NEW |