OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 | 6 |
7 import 'package:fake_async/fake_async.dart'; | 7 import 'package:fake_async/fake_async.dart'; |
8 import 'package:test/src/backend/invoker.dart'; | 8 import 'package:test/src/backend/invoker.dart'; |
9 import 'package:test/src/backend/metadata.dart'; | 9 import 'package:test/src/backend/metadata.dart'; |
10 import 'package:test/src/backend/state.dart'; | 10 import 'package:test/src/backend/state.dart'; |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 634 |
635 expectErrors(liveTest, [(error) { | 635 expectErrors(liveTest, [(error) { |
636 expect(lastState.status, equals(Status.complete)); | 636 expect(lastState.status, equals(Status.complete)); |
637 expect(error, new isInstanceOf<TimeoutException>()); | 637 expect(error, new isInstanceOf<TimeoutException>()); |
638 }]); | 638 }]); |
639 | 639 |
640 liveTest.run(); | 640 liveTest.run(); |
641 async.elapse(new Duration(seconds: 15)); | 641 async.elapse(new Duration(seconds: 15)); |
642 }); | 642 }); |
643 }); | 643 }); |
| 644 |
| 645 test("a test with Timeout.none never times out", () { |
| 646 new FakeAsync().run((async) { |
| 647 var liveTest = _localTest(() { |
| 648 Invoker.current.addOutstandingCallback(); |
| 649 }, metadata: new Metadata(timeout: Timeout.none)).load(suite); |
| 650 |
| 651 expectStates(liveTest, [const State(Status.running, Result.success)]); |
| 652 |
| 653 liveTest.run(); |
| 654 async.elapse(new Duration(hours: 10)); |
| 655 expect(liveTest.state.status, equals(Status.running)); |
| 656 }); |
| 657 }); |
644 }); | 658 }); |
645 | 659 |
646 group("waitForOutstandingCallbacks:", () { | 660 group("waitForOutstandingCallbacks:", () { |
647 test("waits for the wrapped function to complete", () async { | 661 test("waits for the wrapped function to complete", () async { |
648 var functionCompleted = false; | 662 var functionCompleted = false; |
649 await Invoker.current.waitForOutstandingCallbacks(() async { | 663 await Invoker.current.waitForOutstandingCallbacks(() async { |
650 await pumpEventQueue(); | 664 await pumpEventQueue(); |
651 functionCompleted = true; | 665 functionCompleted = true; |
652 }); | 666 }); |
653 | 667 |
(...skipping 23 matching lines...) Expand all Loading... |
677 | 691 |
678 expect(innerFunctionCompleted, isFalse); | 692 expect(innerFunctionCompleted, isFalse); |
679 }); | 693 }); |
680 }); | 694 }); |
681 } | 695 } |
682 | 696 |
683 LocalTest _localTest(body(), {tearDown(), Metadata metadata}) { | 697 LocalTest _localTest(body(), {tearDown(), Metadata metadata}) { |
684 if (metadata == null) metadata = new Metadata(); | 698 if (metadata == null) metadata = new Metadata(); |
685 return new LocalTest("test", metadata, body, tearDown: tearDown); | 699 return new LocalTest("test", metadata, body, tearDown: tearDown); |
686 } | 700 } |
OLD | NEW |