Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: pkg/analysis_server/test/integration/integration_tests.dart

Issue 651243005: Add support for attaching observatory to the server (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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().then((_) { 153 return server.start(null).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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 String parent = dirname(pathname); 672 String parent = dirname(pathname);
673 if (parent.length >= pathname.length) { 673 if (parent.length >= pathname.length) {
674 throw new Exception("Can't find root directory"); 674 throw new Exception("Can't find root directory");
675 } 675 }
676 pathname = parent; 676 pathname = parent;
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. 683 * with "--debug", allowing a debugger to be attached. If [profileServer] is
684 * `true`, the server will be started with "--observe" and
685 * "--pause-isolates-on-exit", allowing the observatory to be used.
684 */ 686 */
685 Future start({bool debugServer: false}) { 687 Future start(NotificationProcessor notificationProcessor, {bool debugServer:
688 false, bool profileServer: true}) {
686 if (_process != null) { 689 if (_process != null) {
687 throw new Exception('Process already started'); 690 throw new Exception('Process already started');
688 } 691 }
689 _time.start(); 692 _time.start();
690 String dartBinary = Platform.executable; 693 String dartBinary = Platform.executable;
691 String rootDir = 694 String rootDir =
692 findRoot(Platform.script.toFilePath(windows: Platform.isWindows)); 695 findRoot(Platform.script.toFilePath(windows: Platform.isWindows));
693 String serverPath = normalize(join(rootDir, 'bin', 'server.dart')); 696 String serverPath = normalize(join(rootDir, 'bin', 'server.dart'));
694 List<String> arguments = []; 697 List<String> arguments = [];
695 if (debugServer) { 698 if (debugServer) {
696 arguments.add('--debug'); 699 arguments.add('--debug');
697 } 700 }
701 if (profileServer) {
702 // arguments.add('--enable-vm-service');
Paul Berry 2014/10/23 18:02:11 Were these commented-out lines left in on purpose
Brian Wilkerson 2014/10/23 18:56:19 Sort of on purpose in that when I first uploaded I
703 arguments.add('--observe');
704 // arguments.add('--profile');
705 arguments.add('--pause-isolates-on-exit');
706 }
698 if (Platform.packageRoot.isNotEmpty) { 707 if (Platform.packageRoot.isNotEmpty) {
699 arguments.add('--package-root=${Platform.packageRoot}'); 708 arguments.add('--package-root=${Platform.packageRoot}');
700 } 709 }
701 arguments.add('--checked'); 710 arguments.add('--checked');
702 arguments.add(serverPath); 711 arguments.add(serverPath);
703 return Process.start(dartBinary, arguments).then((Process process) { 712 return Process.start(dartBinary, arguments).then((Process process) {
704 _process = process; 713 _process = process;
705 process.exitCode.then((int code) { 714 process.exitCode.then((int code) {
706 _recordStdio('TERMINATED WITH EXIT CODE $code'); 715 _recordStdio('TERMINATED WITH EXIT CODE $code');
707 if (code != 0) { 716 if (code != 0) {
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 */ 867 */
859 void _recordStdio(String line) { 868 void _recordStdio(String line) {
860 double elapsedTime = _time.elapsedTicks / _time.frequency; 869 double elapsedTime = _time.elapsedTicks / _time.frequency;
861 line = "$elapsedTime: $line"; 870 line = "$elapsedTime: $line";
862 if (_debuggingStdio) { 871 if (_debuggingStdio) {
863 print(line); 872 print(line);
864 } 873 }
865 _recordedStdio.add(line); 874 _recordedStdio.add(line);
866 } 875 }
867 } 876 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698