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

Side by Side Diff: pkg/http/test/utils.dart

Issue 14052008: Only stop HTTP server if it was actually started. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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_utils; 5 library test_utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 response.contentLength = body.length; 101 response.contentLength = body.length;
102 response.write(body); 102 response.write(body);
103 response.close(); 103 response.close();
104 }); 104 });
105 }); 105 });
106 }); 106 });
107 } 107 }
108 108
109 /// Stops the current HTTP server. 109 /// Stops the current HTTP server.
110 void stopServer() { 110 void stopServer() {
111 _server.close(); 111 if (_server != null) {
112 _server = null; 112 _server.close();
113 _server = null;
114 }
113 } 115 }
114 116
115 /// Removes eight spaces of leading indentation from a multiline string. 117 /// Removes eight spaces of leading indentation from a multiline string.
116 /// 118 ///
117 /// Note that this is very sensitive to how the literals are styled. They should 119 /// Note that this is very sensitive to how the literals are styled. They should
118 /// be: 120 /// be:
119 /// ''' 121 /// '''
120 /// Text starts on own line. Lines up with subsequent lines. 122 /// Text starts on own line. Lines up with subsequent lines.
121 /// Lines are indented exactly 8 characters from the left margin. 123 /// Lines are indented exactly 8 characters from the left margin.
122 /// Close is on the same line.''' 124 /// Close is on the same line.'''
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 const isSocketIOException = const _SocketIOException(); 201 const isSocketIOException = const _SocketIOException();
200 202
201 /// A matcher for functions that throw SocketIOException. 203 /// A matcher for functions that throw SocketIOException.
202 const Matcher throwsSocketIOException = 204 const Matcher throwsSocketIOException =
203 const Throws(isSocketIOException); 205 const Throws(isSocketIOException);
204 206
205 class _SocketIOException extends TypeMatcher { 207 class _SocketIOException extends TypeMatcher {
206 const _SocketIOException() : super("SocketIOException"); 208 const _SocketIOException() : super("SocketIOException");
207 bool matches(item, MatchState matchState) => item is SocketIOException; 209 bool matches(item, MatchState matchState) => item is SocketIOException;
208 } 210 }
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