| 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'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 const String _SKY_SHELL_ENV_KEY = 'SERVICE_TEST_SKY_SHELL'; | 31 const String _SKY_SHELL_ENV_KEY = 'SERVICE_TEST_SKY_SHELL'; |
| 32 bool _shouldLaunchSkyShell() { | 32 bool _shouldLaunchSkyShell() { |
| 33 return Platform.environment.containsKey(_SKY_SHELL_ENV_KEY); | 33 return Platform.environment.containsKey(_SKY_SHELL_ENV_KEY); |
| 34 } | 34 } |
| 35 String _skyShellPath() { | 35 String _skyShellPath() { |
| 36 return Platform.environment[_SKY_SHELL_ENV_KEY]; | 36 return Platform.environment[_SKY_SHELL_ENV_KEY]; |
| 37 } | 37 } |
| 38 | 38 |
| 39 class _SerivceTesteeRunner { | 39 class _ServiceTesteeRunner { |
| 40 Future run({testeeBefore(): null, | 40 Future run({testeeBefore(): null, |
| 41 testeeConcurrent(): null, | 41 testeeConcurrent(): null, |
| 42 bool pause_on_start: false, | 42 bool pause_on_start: false, |
| 43 bool pause_on_exit: false}) async { | 43 bool pause_on_exit: false}) async { |
| 44 if (!pause_on_start) { | 44 if (!pause_on_start) { |
| 45 if (testeeBefore != null) { | 45 if (testeeBefore != null) { |
| 46 var result = testeeBefore(); | 46 var result = testeeBefore(); |
| 47 if (result is Future) { | 47 if (result is Future) { |
| 48 await result; | 48 await result; |
| 49 } | 49 } |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 {testeeBefore(), | 328 {testeeBefore(), |
| 329 testeeConcurrent(), | 329 testeeConcurrent(), |
| 330 bool pause_on_start: false, | 330 bool pause_on_start: false, |
| 331 bool pause_on_exit: false, | 331 bool pause_on_exit: false, |
| 332 bool trace_service: false, | 332 bool trace_service: false, |
| 333 bool trace_compiler: false, | 333 bool trace_compiler: false, |
| 334 bool verbose_vm: false, | 334 bool verbose_vm: false, |
| 335 bool pause_on_unhandled_exceptions: false}) async { | 335 bool pause_on_unhandled_exceptions: false}) async { |
| 336 assert(!pause_on_start || testeeBefore == null); | 336 assert(!pause_on_start || testeeBefore == null); |
| 337 if (_isTestee()) { | 337 if (_isTestee()) { |
| 338 new _SerivceTesteeRunner().run(testeeBefore: testeeBefore, | 338 new _ServiceTesteeRunner().run(testeeBefore: testeeBefore, |
| 339 testeeConcurrent: testeeConcurrent, | 339 testeeConcurrent: testeeConcurrent, |
| 340 pause_on_start: pause_on_start, | 340 pause_on_start: pause_on_start, |
| 341 pause_on_exit: pause_on_exit); | 341 pause_on_exit: pause_on_exit); |
| 342 } else { | 342 } else { |
| 343 new _ServiceTesterRunner().run( | 343 new _ServiceTesterRunner().run( |
| 344 mainArgs: mainArgs, | 344 mainArgs: mainArgs, |
| 345 isolateTests: tests, | 345 isolateTests: tests, |
| 346 pause_on_start: pause_on_start, | 346 pause_on_start: pause_on_start, |
| 347 pause_on_exit: pause_on_exit, | 347 pause_on_exit: pause_on_exit, |
| 348 trace_service: trace_service, | 348 trace_service: trace_service, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 366 {void testeeBefore(), | 366 {void testeeBefore(), |
| 367 void testeeConcurrent(), | 367 void testeeConcurrent(), |
| 368 bool pause_on_start: false, | 368 bool pause_on_start: false, |
| 369 bool pause_on_exit: false, | 369 bool pause_on_exit: false, |
| 370 bool trace_service: false, | 370 bool trace_service: false, |
| 371 bool trace_compiler: false, | 371 bool trace_compiler: false, |
| 372 bool verbose_vm: false, | 372 bool verbose_vm: false, |
| 373 bool pause_on_unhandled_exceptions: false}) { | 373 bool pause_on_unhandled_exceptions: false}) { |
| 374 assert(!pause_on_start || testeeBefore == null); | 374 assert(!pause_on_start || testeeBefore == null); |
| 375 if (_isTestee()) { | 375 if (_isTestee()) { |
| 376 new _SerivceTesteeRunner().runSync(testeeBeforeSync: testeeBefore, | 376 new _ServiceTesteeRunner().runSync(testeeBeforeSync: testeeBefore, |
| 377 testeeConcurrentSync: testeeConcurrent, | 377 testeeConcurrentSync: testeeConcurrent, |
| 378 pause_on_start: pause_on_start, | 378 pause_on_start: pause_on_start, |
| 379 pause_on_exit: pause_on_exit); | 379 pause_on_exit: pause_on_exit); |
| 380 } else { | 380 } else { |
| 381 new _ServiceTesterRunner().run( | 381 new _ServiceTesterRunner().run( |
| 382 mainArgs: mainArgs, | 382 mainArgs: mainArgs, |
| 383 isolateTests: tests, | 383 isolateTests: tests, |
| 384 pause_on_start: pause_on_start, | 384 pause_on_start: pause_on_start, |
| 385 pause_on_exit: pause_on_exit, | 385 pause_on_exit: pause_on_exit, |
| 386 trace_service: trace_service, | 386 trace_service: trace_service, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 399 List<VMTest> tests, | 399 List<VMTest> tests, |
| 400 {testeeBefore(), | 400 {testeeBefore(), |
| 401 testeeConcurrent(), | 401 testeeConcurrent(), |
| 402 bool pause_on_start: false, | 402 bool pause_on_start: false, |
| 403 bool pause_on_exit: false, | 403 bool pause_on_exit: false, |
| 404 bool trace_service: false, | 404 bool trace_service: false, |
| 405 bool trace_compiler: false, | 405 bool trace_compiler: false, |
| 406 bool verbose_vm: false, | 406 bool verbose_vm: false, |
| 407 bool pause_on_unhandled_exceptions: false}) async { | 407 bool pause_on_unhandled_exceptions: false}) async { |
| 408 if (_isTestee()) { | 408 if (_isTestee()) { |
| 409 new _SerivceTesteeRunner().run(testeeBefore: testeeBefore, | 409 new _ServiceTesteeRunner().run(testeeBefore: testeeBefore, |
| 410 testeeConcurrent: testeeConcurrent, | 410 testeeConcurrent: testeeConcurrent, |
| 411 pause_on_start: pause_on_start, | 411 pause_on_start: pause_on_start, |
| 412 pause_on_exit: pause_on_exit); | 412 pause_on_exit: pause_on_exit); |
| 413 } else { | 413 } else { |
| 414 new _ServiceTesterRunner().run( | 414 new _ServiceTesterRunner().run( |
| 415 mainArgs: mainArgs, | 415 mainArgs: mainArgs, |
| 416 vmTests: tests, | 416 vmTests: tests, |
| 417 pause_on_start: pause_on_start, | 417 pause_on_start: pause_on_start, |
| 418 pause_on_exit: pause_on_exit, | 418 pause_on_exit: pause_on_exit, |
| 419 trace_service: trace_service, | 419 trace_service: trace_service, |
| 420 trace_compiler: trace_compiler, | 420 trace_compiler: trace_compiler, |
| 421 verbose_vm: verbose_vm, | 421 verbose_vm: verbose_vm, |
| 422 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); | 422 pause_on_unhandled_exceptions: pause_on_unhandled_exceptions); |
| 423 } | 423 } |
| 424 } | 424 } |
| OLD | NEW |