| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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.integration.analysis; | 5 library test.integration.analysis; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:convert'; | 9 import 'dart:convert'; |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 if (subscribeStatus) { | 198 if (subscribeStatus) { |
| 199 futures.add(sendServerSetSubscriptions([ServerService.STATUS])); | 199 futures.add(sendServerSetSubscriptions([ServerService.STATUS])); |
| 200 } | 200 } |
| 201 futures.add(sendAnalysisSetAnalysisRoots([sourceDirectory.path], [])); | 201 futures.add(sendAnalysisSetAnalysisRoots([sourceDirectory.path], [])); |
| 202 return Future.wait(futures); | 202 return Future.wait(futures); |
| 203 } | 203 } |
| 204 | 204 |
| 205 /** | 205 /** |
| 206 * Start [server]. | 206 * Start [server]. |
| 207 */ | 207 */ |
| 208 Future startServer({int servicesPort}) => | 208 Future startServer({int servicesPort, bool checked: true}) => |
| 209 server.start(servicesPort: servicesPort); | 209 server.start(servicesPort: servicesPort, checked: checked); |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * After every test, the server is stopped and [sourceDirectory] is deleted. | 212 * After every test, the server is stopped and [sourceDirectory] is deleted. |
| 213 */ | 213 */ |
| 214 Future tearDown() { | 214 Future tearDown() { |
| 215 return shutdownIfNeeded().then((_) { | 215 return shutdownIfNeeded().then((_) { |
| 216 sourceDirectory.deleteSync(recursive: true); | 216 sourceDirectory.deleteSync(recursive: true); |
| 217 }); | 217 }); |
| 218 } | 218 } |
| 219 | 219 |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 * Start the server. If [debugServer] is `true`, the server will be started | 594 * Start the server. If [debugServer] is `true`, the server will be started |
| 595 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 595 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 596 * `true`, the server will be started with "--observe" and | 596 * `true`, the server will be started with "--observe" and |
| 597 * "--pause-isolates-on-exit", allowing the observatory to be used. | 597 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 598 */ | 598 */ |
| 599 Future start( | 599 Future start( |
| 600 {bool debugServer: false, | 600 {bool debugServer: false, |
| 601 int diagnosticPort, | 601 int diagnosticPort, |
| 602 bool profileServer: false, | 602 bool profileServer: false, |
| 603 int servicesPort, | 603 int servicesPort, |
| 604 bool checked: true, |
| 604 bool useAnalysisHighlight2: false}) { | 605 bool useAnalysisHighlight2: false}) { |
| 605 if (_process != null) { | 606 if (_process != null) { |
| 606 throw new Exception('Process already started'); | 607 throw new Exception('Process already started'); |
| 607 } | 608 } |
| 608 _time.start(); | 609 _time.start(); |
| 609 String dartBinary = Platform.executable; | 610 String dartBinary = Platform.executable; |
| 610 String rootDir = | 611 String rootDir = |
| 611 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); | 612 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); |
| 612 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); | 613 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
| 613 List<String> arguments = []; | 614 List<String> arguments = []; |
| 614 if (debugServer) { | 615 if (debugServer) { |
| 615 arguments.add('--debug'); | 616 arguments.add('--debug'); |
| 616 } | 617 } |
| 617 if (profileServer) { | 618 if (profileServer) { |
| 618 if (servicesPort == null) { | 619 if (servicesPort == null) { |
| 619 arguments.add('--observe'); | 620 arguments.add('--observe'); |
| 620 } else { | 621 } else { |
| 621 arguments.add('--observe=$servicesPort'); | 622 arguments.add('--observe=$servicesPort'); |
| 622 } | 623 } |
| 623 arguments.add('--pause-isolates-on-exit'); | 624 arguments.add('--pause-isolates-on-exit'); |
| 624 } else if (servicesPort != null) { | 625 } else if (servicesPort != null) { |
| 625 arguments.add('--enable-vm-service=$servicesPort'); | 626 arguments.add('--enable-vm-service=$servicesPort'); |
| 626 } | 627 } |
| 627 if (Platform.packageRoot != null) { | 628 if (Platform.packageRoot != null) { |
| 628 arguments.add('--package-root=${Platform.packageRoot}'); | 629 arguments.add('--package-root=${Platform.packageRoot}'); |
| 629 } | 630 } |
| 630 arguments.add('--checked'); | 631 if (checked) { |
| 632 arguments.add('--checked'); |
| 633 } |
| 631 arguments.add(serverPath); | 634 arguments.add(serverPath); |
| 632 if (diagnosticPort != null) { | 635 if (diagnosticPort != null) { |
| 633 arguments.add('--port'); | 636 arguments.add('--port'); |
| 634 arguments.add(diagnosticPort.toString()); | 637 arguments.add(diagnosticPort.toString()); |
| 635 } | 638 } |
| 636 if (useAnalysisHighlight2) { | 639 if (useAnalysisHighlight2) { |
| 637 arguments.add('--useAnalysisHighlight2'); | 640 arguments.add('--useAnalysisHighlight2'); |
| 638 } | 641 } |
| 639 // print('Launching $serverPath'); | 642 // print('Launching $serverPath'); |
| 640 // print('$dartBinary ${arguments.join(' ')}'); | 643 // print('$dartBinary ${arguments.join(' ')}'); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 void populateMismatches(item, List<MismatchDescriber> mismatches); | 900 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 898 | 901 |
| 899 /** | 902 /** |
| 900 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 903 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 901 */ | 904 */ |
| 902 MismatchDescriber simpleDescription(String description) => | 905 MismatchDescriber simpleDescription(String description) => |
| 903 (Description mismatchDescription) { | 906 (Description mismatchDescription) { |
| 904 mismatchDescription.add(description); | 907 mismatchDescription.add(description); |
| 905 }; | 908 }; |
| 906 } | 909 } |
| OLD | NEW |