| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 sourceDirectory = Directory.systemTemp.createTempSync('analysisServer'); | 143 sourceDirectory = Directory.systemTemp.createTempSync('analysisServer'); |
| 144 | 144 |
| 145 onAnalysisErrors.listen((AnalysisErrorsParams params) { | 145 onAnalysisErrors.listen((AnalysisErrorsParams params) { |
| 146 currentAnalysisErrors[params.file] = params.errors; | 146 currentAnalysisErrors[params.file] = params.errors; |
| 147 }); | 147 }); |
| 148 Completer serverConnected = new Completer(); | 148 Completer serverConnected = new Completer(); |
| 149 onServerConnected.listen((_) { | 149 onServerConnected.listen((_) { |
| 150 expect(serverConnected.isCompleted, isFalse); | 150 expect(serverConnected.isCompleted, isFalse); |
| 151 serverConnected.complete(); | 151 serverConnected.complete(); |
| 152 }); | 152 }); |
| 153 return server.start(null).then((_) { | 153 return server.start().then((_) { |
| 154 server.listenToOutput(dispatchNotification); | 154 server.listenToOutput(dispatchNotification); |
| 155 server.exitCode.then((_) { | 155 server.exitCode.then((_) { |
| 156 skipShutdown = true; | 156 skipShutdown = true; |
| 157 }); | 157 }); |
| 158 return serverConnected.future; | 158 return serverConnected.future; |
| 159 }); | 159 }); |
| 160 } | 160 } |
| 161 | 161 |
| 162 /** | 162 /** |
| 163 * After every test, the server is stopped and [sourceDirectory] is deleted. | 163 * After every test, the server is stopped and [sourceDirectory] is deleted. |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 } | 677 } |
| 678 return dirname(pathname); | 678 return dirname(pathname); |
| 679 } | 679 } |
| 680 | 680 |
| 681 /** | 681 /** |
| 682 * Start the server. If [debugServer] is `true`, the server will be started | 682 * Start the server. If [debugServer] is `true`, the server will be started |
| 683 * with "--debug", allowing a debugger to be attached. If [profileServer] is | 683 * with "--debug", allowing a debugger to be attached. If [profileServer] is |
| 684 * `true`, the server will be started with "--observe" and | 684 * `true`, the server will be started with "--observe" and |
| 685 * "--pause-isolates-on-exit", allowing the observatory to be used. | 685 * "--pause-isolates-on-exit", allowing the observatory to be used. |
| 686 */ | 686 */ |
| 687 Future start(NotificationProcessor notificationProcessor, {bool debugServer: | 687 Future start({bool debugServer: false, bool profileServer: false}) { |
| 688 false, bool profileServer: false}) { | |
| 689 if (_process != null) { | 688 if (_process != null) { |
| 690 throw new Exception('Process already started'); | 689 throw new Exception('Process already started'); |
| 691 } | 690 } |
| 692 _time.start(); | 691 _time.start(); |
| 693 String dartBinary = Platform.executable; | 692 String dartBinary = Platform.executable; |
| 694 String rootDir = | 693 String rootDir = |
| 695 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); | 694 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); |
| 696 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); | 695 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); |
| 697 List<String> arguments = []; | 696 List<String> arguments = []; |
| 698 if (debugServer) { | 697 if (debugServer) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 */ | 864 */ |
| 866 void _recordStdio(String line) { | 865 void _recordStdio(String line) { |
| 867 double elapsedTime = _time.elapsedTicks / _time.frequency; | 866 double elapsedTime = _time.elapsedTicks / _time.frequency; |
| 868 line = "$elapsedTime: $line"; | 867 line = "$elapsedTime: $line"; |
| 869 if (_debuggingStdio) { | 868 if (_debuggingStdio) { |
| 870 print(line); | 869 print(line); |
| 871 } | 870 } |
| 872 _recordedStdio.add(line); | 871 _recordedStdio.add(line); |
| 873 } | 872 } |
| 874 } | 873 } |
| OLD | NEW |