OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:io'; | 7 import 'dart:io'; |
8 import 'dart:json'; | 8 import 'dart:json'; |
9 import 'dart:uri'; | 9 import 'dart:uri'; |
10 | 10 |
11 import '../../unittest/lib/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 import '../lib/http.dart' as http; | 12 import 'package:http/http.dart' as http; |
13 import '../lib/src/utils.dart'; | 13 import 'package:http/src/utils.dart'; |
14 | 14 |
15 /// The current server instance. | 15 /// The current server instance. |
16 HttpServer _server; | 16 HttpServer _server; |
17 | 17 |
18 /// The URL for the current server instance. | 18 /// The URL for the current server instance. |
19 Uri get serverUrl => new Uri.fromString('http://localhost:${_server.port}'); | 19 Uri get serverUrl => new Uri.fromString('http://localhost:${_server.port}'); |
20 | 20 |
21 /// A dummy URL for constructing requests that won't be sent. | 21 /// A dummy URL for constructing requests that won't be sent. |
22 Uri get dummyUrl => new Uri.fromString('http://dartlang.org/'); | 22 Uri get dummyUrl => new Uri.fromString('http://dartlang.org/'); |
23 | 23 |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 const Matcher throwsRedirectLimitExceededException = | 165 const Matcher throwsRedirectLimitExceededException = |
166 const Throws(isRedirectLimitExceededException); | 166 const Throws(isRedirectLimitExceededException); |
167 | 167 |
168 class _RedirectLimitExceededException extends TypeMatcher { | 168 class _RedirectLimitExceededException extends TypeMatcher { |
169 const _RedirectLimitExceededException() : | 169 const _RedirectLimitExceededException() : |
170 super("RedirectLimitExceededException"); | 170 super("RedirectLimitExceededException"); |
171 | 171 |
172 bool matches(item, MatchState matchState) => | 172 bool matches(item, MatchState matchState) => |
173 item is RedirectLimitExceededException; | 173 item is RedirectLimitExceededException; |
174 } | 174 } |
OLD | NEW |