| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 subscription = onServerStatus.listen((ServerStatusParams params) { | 147 subscription = onServerStatus.listen((ServerStatusParams params) { |
| 148 if (params.analysis != null && !params.analysis.isAnalyzing) { | 148 if (params.analysis != null && !params.analysis.isAnalyzing) { |
| 149 completer.complete(params); | 149 completer.complete(params); |
| 150 subscription.cancel(); | 150 subscription.cancel(); |
| 151 } | 151 } |
| 152 }); | 152 }); |
| 153 return completer.future; | 153 return completer.future; |
| 154 } | 154 } |
| 155 | 155 |
| 156 /** | 156 /** |
| 157 * Return `true` if the new analysis driver should be used by these tests. |
| 158 */ |
| 159 bool get enableNewAnalysisDriver => false; |
| 160 |
| 161 /** |
| 157 * Print out any messages exchanged with the server. If some messages have | 162 * Print out any messages exchanged with the server. If some messages have |
| 158 * already been exchanged with the server, they are printed out immediately. | 163 * already been exchanged with the server, they are printed out immediately. |
| 159 */ | 164 */ |
| 160 void debugStdio() { | 165 void debugStdio() { |
| 161 server.debugStdio(); | 166 server.debugStdio(); |
| 162 } | 167 } |
| 163 | 168 |
| 164 @override | 169 @override |
| 165 Future sendServerSetSubscriptions(List<ServerService> subscriptions) { | 170 Future sendServerSetSubscriptions(List<ServerService> subscriptions) { |
| 166 _subscribedToServerStatus = subscriptions.contains(ServerService.STATUS); | 171 _subscribedToServerStatus = subscriptions.contains(ServerService.STATUS); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 240 } |
| 236 | 241 |
| 237 /** | 242 /** |
| 238 * Start [server]. | 243 * Start [server]. |
| 239 */ | 244 */ |
| 240 Future startServer( | 245 Future startServer( |
| 241 {bool checked: true, int diagnosticPort, int servicesPort}) => | 246 {bool checked: true, int diagnosticPort, int servicesPort}) => |
| 242 server.start( | 247 server.start( |
| 243 checked: checked, | 248 checked: checked, |
| 244 diagnosticPort: diagnosticPort, | 249 diagnosticPort: diagnosticPort, |
| 250 enableNewAnalysisDriver: enableNewAnalysisDriver, |
| 245 servicesPort: servicesPort); | 251 servicesPort: servicesPort); |
| 246 | 252 |
| 247 /** | 253 /** |
| 248 * After every test, the server is stopped and [sourceDirectory] is deleted. | 254 * After every test, the server is stopped and [sourceDirectory] is deleted. |
| 249 */ | 255 */ |
| 250 Future tearDown() { | 256 Future tearDown() { |
| 251 return shutdownIfNeeded().then((_) { | 257 return shutdownIfNeeded().then((_) { |
| 252 sourceDirectory.deleteSync(recursive: true); | 258 sourceDirectory.deleteSync(recursive: true); |
| 253 }); | 259 }); |
| 254 } | 260 } |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 /** | 635 /** |
| 630 * Start the server. If [debugServer] is `true`, the server will be started | 636 * Start the server. If [debugServer] is `true`, the server will be started |
| 631 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 637 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 632 * `true`, the server will be started with "--observe" and | 638 * `true`, the server will be started with "--observe" and |
| 633 * "--pause-isolates-on-exit", allowing the observatory to be used. | 639 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 634 */ | 640 */ |
| 635 Future start( | 641 Future start( |
| 636 {bool checked: true, | 642 {bool checked: true, |
| 637 bool debugServer: false, | 643 bool debugServer: false, |
| 638 int diagnosticPort, | 644 int diagnosticPort, |
| 645 bool enableNewAnalysisDriver: false, |
| 639 bool profileServer: false, | 646 bool profileServer: false, |
| 640 String sdkPath, | 647 String sdkPath, |
| 641 int servicesPort, | 648 int servicesPort, |
| 642 bool useAnalysisHighlight2: false}) { | 649 bool useAnalysisHighlight2: false}) { |
| 643 if (_process != null) { | 650 if (_process != null) { |
| 644 throw new Exception('Process already started'); | 651 throw new Exception('Process already started'); |
| 645 } | 652 } |
| 646 _time.start(); | 653 _time.start(); |
| 647 String dartBinary = Platform.executable; | 654 String dartBinary = Platform.executable; |
| 648 String rootDir = | 655 String rootDir = |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 if (diagnosticPort != null) { | 691 if (diagnosticPort != null) { |
| 685 arguments.add('--port'); | 692 arguments.add('--port'); |
| 686 arguments.add(diagnosticPort.toString()); | 693 arguments.add(diagnosticPort.toString()); |
| 687 } | 694 } |
| 688 if (sdkPath != null) { | 695 if (sdkPath != null) { |
| 689 arguments.add('--sdk=$sdkPath'); | 696 arguments.add('--sdk=$sdkPath'); |
| 690 } | 697 } |
| 691 if (useAnalysisHighlight2) { | 698 if (useAnalysisHighlight2) { |
| 692 arguments.add('--useAnalysisHighlight2'); | 699 arguments.add('--useAnalysisHighlight2'); |
| 693 } | 700 } |
| 701 if (enableNewAnalysisDriver) { |
| 702 arguments.add('--enable-new-analysis-driver'); |
| 703 } |
| 694 // print('Launching $serverPath'); | 704 // print('Launching $serverPath'); |
| 695 // print('$dartBinary ${arguments.join(' ')}'); | 705 // print('$dartBinary ${arguments.join(' ')}'); |
| 696 return Process.start(dartBinary, arguments).then((Process process) { | 706 return Process.start(dartBinary, arguments).then((Process process) { |
| 697 _process = process; | 707 _process = process; |
| 698 process.exitCode.then((int code) { | 708 process.exitCode.then((int code) { |
| 699 if (code != 0) { | 709 if (code != 0) { |
| 700 _badDataFromServer('server terminated with exit code $code'); | 710 _badDataFromServer('server terminated with exit code $code'); |
| 701 } | 711 } |
| 702 }); | 712 }); |
| 703 }); | 713 }); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 void populateMismatches(item, List<MismatchDescriber> mismatches); | 962 void populateMismatches(item, List<MismatchDescriber> mismatches); |
| 953 | 963 |
| 954 /** | 964 /** |
| 955 * Create a [MismatchDescriber] describing a mismatch with a simple string. | 965 * Create a [MismatchDescriber] describing a mismatch with a simple string. |
| 956 */ | 966 */ |
| 957 MismatchDescriber simpleDescription(String description) => | 967 MismatchDescriber simpleDescription(String description) => |
| 958 (Description mismatchDescription) { | 968 (Description mismatchDescription) { |
| 959 mismatchDescription.add(description); | 969 mismatchDescription.add(description); |
| 960 }; | 970 }; |
| 961 } | 971 } |
| OLD | NEW |