| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS d.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 pub_tests; | 5 library pub_tests; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | |
| 9 | 8 |
| 10 import 'package:http/http.dart' as http; | 9 import 'package:http/http.dart' as http; |
| 11 import 'package:scheduled_test/scheduled_process.dart'; | 10 import 'package:scheduled_test/scheduled_process.dart'; |
| 12 import 'package:scheduled_test/scheduled_test.dart'; | 11 import 'package:scheduled_test/scheduled_test.dart'; |
| 13 | 12 |
| 14 import '../descriptor.dart' as d; | |
| 15 import '../test_pub.dart'; | 13 import '../test_pub.dart'; |
| 16 | 14 |
| 17 /// The pub process running "pub serve". | 15 /// The pub process running "pub serve". |
| 18 ScheduledProcess _pubServer; | 16 ScheduledProcess _pubServer; |
| 19 | 17 |
| 20 /// The ephemeral port assigned to the running server. | 18 /// The ephemeral port assigned to the running server. |
| 21 int _port; | 19 int _port; |
| 22 | 20 |
| 23 /// Schedules starting the "pub serve" process. | 21 /// Schedules starting the "pub serve" process. |
| 24 /// | 22 /// |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 61 |
| 64 /// Schedules an HTTP request to the running pub server with [urlPath] and | 62 /// Schedules an HTTP request to the running pub server with [urlPath] and |
| 65 /// verifies that it responds with a 404. | 63 /// verifies that it responds with a 404. |
| 66 void requestShould404(String urlPath) { | 64 void requestShould404(String urlPath) { |
| 67 schedule(() { | 65 schedule(() { |
| 68 return http.get("http://localhost:$_port/$urlPath").then((response) { | 66 return http.get("http://localhost:$_port/$urlPath").then((response) { |
| 69 expect(response.statusCode, equals(404)); | 67 expect(response.statusCode, equals(404)); |
| 70 }); | 68 }); |
| 71 }, "request $urlPath"); | 69 }, "request $urlPath"); |
| 72 } | 70 } |
| OLD | NEW |