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

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

Issue 425803009: Better implementation of shutdown timeout. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 * If [skipShutdown] is not set, shut down the server. 161 * If [skipShutdown] is not set, shut down the server.
162 */ 162 */
163 Future _shutdownIfNeeded() { 163 Future _shutdownIfNeeded() {
164 if (skipShutdown) { 164 if (skipShutdown) {
165 return new Future.value(); 165 return new Future.value();
166 } 166 }
167 // Give the server a short time to comply with the shutdown request; if it 167 // Give the server a short time to comply with the shutdown request; if it
168 // doesn't exit, then forcibly terminate it. 168 // doesn't exit, then forcibly terminate it.
169 Completer processExited = new Completer(); 169 Completer processExited = new Completer();
170 server.send(SERVER_SHUTDOWN, null); 170 server.send(SERVER_SHUTDOWN, null);
171 server.exitCode.whenComplete(() { 171 return server.exitCode.timeout(SHUTDOWN_TIMEOUT, onTimeout: () {
172 processExited.complete(); 172 return server.kill();
173 }); 173 });
174 new Future.delayed(SHUTDOWN_TIMEOUT).then((_) {
175 if (!processExited.isCompleted) {
176 server.kill();
177 }
178 });
179 return processExited.future;
180 } 174 }
181 } 175 }
182 176
183 // Matchers for data types defined in the analysis server API 177 // Matchers for data types defined in the analysis server API
184 // ========================================================== 178 // ==========================================================
185 // TODO(paulberry): add more matchers. 179 // TODO(paulberry): add more matchers.
186 180
187 // Matchers common to all domains 181 // Matchers common to all domains
188 // ------------------------------ 182 // ------------------------------
189 183
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 void _recordStdio(String line) { 711 void _recordStdio(String line) {
718 double elapsedTime = _time.elapsedTicks.toDouble() / 712 double elapsedTime = _time.elapsedTicks.toDouble() /
719 _time.frequency.toDouble(); 713 _time.frequency.toDouble();
720 line = "$elapsedTime: $line"; 714 line = "$elapsedTime: $line";
721 if (_debuggingStdio) { 715 if (_debuggingStdio) {
722 print(line); 716 print(line);
723 } 717 }
724 _recordedStdio.add(line); 718 _recordedStdio.add(line);
725 } 719 }
726 } 720 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698