OLD | NEW |
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 scheduled_test.scheduled_server; | 5 library scheduled_test.scheduled_server; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'dart:uri'; | |
11 | 10 |
12 import 'scheduled_test.dart'; | 11 import 'scheduled_test.dart'; |
13 import 'src/utils.dart'; | 12 import 'src/utils.dart'; |
14 import 'src/scheduled_server/handler.dart'; | 13 import 'src/scheduled_server/handler.dart'; |
15 import 'src/scheduled_server/safe_http_server.dart'; | 14 import 'src/scheduled_server/safe_http_server.dart'; |
16 | 15 |
17 typedef Future ScheduledHandler(HttpRequest request); | 16 typedef Future ScheduledHandler(HttpRequest request); |
18 | 17 |
19 /// A class representing an [HttpServer] that's scheduled to run in the course | 18 /// A class representing an [HttpServer] that's scheduled to run in the course |
20 /// of the test. This class allows the server's request handling to be scheduled | 19 /// of the test. This class allows the server's request handling to be scheduled |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 "when no more requests were expected."; | 96 "when no more requests were expected."; |
98 } | 97 } |
99 return _handlers.removeFirst().fn(request); | 98 return _handlers.removeFirst().fn(request); |
100 }).catchError((e) { | 99 }).catchError((e) { |
101 // Close the server so that we don't leave a dangling request. | 100 // Close the server so that we don't leave a dangling request. |
102 _server.then((s) => s.close()); | 101 _server.then((s) => s.close()); |
103 throw e; | 102 throw e; |
104 }), 'receiving ${request.method} ${request.uri}'); | 103 }), 'receiving ${request.method} ${request.uri}'); |
105 } | 104 } |
106 } | 105 } |
OLD | NEW |