| Index: dart/pkg/unittest/lib/unittest.dart
|
| diff --git a/dart/pkg/unittest/lib/unittest.dart b/dart/pkg/unittest/lib/unittest.dart
|
| index eb186bd51716d679f21bd52fc75eb9f79a17b6fb..9aa514ad27bf1d24c2435f5f4bb4fbd53cdd90e8 100644
|
| --- a/dart/pkg/unittest/lib/unittest.dart
|
| +++ b/dart/pkg/unittest/lib/unittest.dart
|
| @@ -752,7 +752,18 @@ void _runTest() {
|
| } else {
|
| final testCase = testCases[_currentTestCaseIndex];
|
| var f = _guardAsync(testCase._run, null, testCase);
|
| + Timer timer;
|
| + try {
|
| + final Duration timeout = unittestConfiguration.timeout;
|
| + timer = new Timer(timeout, () {
|
| + testCase.error("Test timed out after ${timeout.inSeconds} seconds.");
|
| + });
|
| + } on UnsupportedError catch (e) {
|
| + if (e.message != "Timer greater than 0.") rethrow;
|
| + // Support running on d8 and jsshell which don't support timers.
|
| + }
|
| f.whenComplete(() {
|
| + if (timer != null) timer.cancel();
|
| var now = new DateTime.now().millisecondsSinceEpoch;
|
| if ((now - _lastBreath) >= BREATH_INTERVAL) {
|
| _lastBreath = now;
|
|
|