| 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_server_test; | 5 library scheduled_server_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:http/http.dart' as http; | 10 import 'package:http/http.dart' as http; |
| 11 import 'package:scheduled_test/scheduled_server.dart'; | 11 import 'package:scheduled_test/scheduled_server.dart'; |
| 12 import 'package:scheduled_test/scheduled_test.dart'; | 12 import 'package:scheduled_test/scheduled_test.dart'; |
| 13 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock; | 13 import 'package:scheduled_test/src/mock_clock.dart' as mock_clock; |
| 14 | 14 |
| 15 import 'metatest.dart'; | 15 import 'metatest.dart'; |
| 16 import 'utils.dart'; | 16 import 'utils.dart'; |
| 17 | 17 |
| 18 void main() { | 18 void main() { |
| 19 metaSetUp(() { | 19 setUpTimeout(); |
| 20 // TODO(nweiz): Only increase the timeout length for the Windows bots once | |
| 21 // we track down the cause of >5s HTTP requests on the Linux and Mac bots. | |
| 22 currentSchedule.timeout = new Duration(seconds: 10); | |
| 23 }); | |
| 24 | 20 |
| 25 expectTestsPass("a server with no handlers does nothing", () { | 21 expectTestsPass("a server with no handlers does nothing", () { |
| 26 test('test', () => new ScheduledServer()); | 22 test('test', () => new ScheduledServer()); |
| 27 }); | 23 }); |
| 28 | 24 |
| 29 expectTestsPass("a server with no handlers that receives a request throws an " | 25 expectTestsPass("a server with no handlers that receives a request throws an " |
| 30 "error", () { | 26 "error", () { |
| 31 var errors; | 27 var errors; |
| 32 test('test 1', () { | 28 test('test 1', () { |
| 33 currentSchedule.onException.schedule(() { | 29 currentSchedule.onException.schedule(() { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // issue 9151 is fixed. | 342 // issue 9151 is fixed. |
| 347 expect(errors.length, inInclusiveRange(2, 3)); | 343 expect(errors.length, inInclusiveRange(2, 3)); |
| 348 expect(errors[0].error, equals('oh no')); | 344 expect(errors[0].error, equals('oh no')); |
| 349 expect(errors[1].error, new isInstanceOf<HttpParserException>()); | 345 expect(errors[1].error, new isInstanceOf<HttpParserException>()); |
| 350 if (errors.length > 2) { | 346 if (errors.length > 2) { |
| 351 expect(errors[2].error, new isInstanceOf<HttpParserException>()); | 347 expect(errors[2].error, new isInstanceOf<HttpParserException>()); |
| 352 } | 348 } |
| 353 }); | 349 }); |
| 354 }, passing: ['test 2']); | 350 }, passing: ['test 2']); |
| 355 } | 351 } |
| OLD | NEW |