Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: dart/pkg/unittest/lib/unittest.dart

Issue 22849010: TestCase times out after 20 seconds. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add copyright and TODO. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/pkg/unittest/lib/test_controller.js ('k') | dart/pkg/unittest/test/missing_tick_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « dart/pkg/unittest/lib/test_controller.js ('k') | dart/pkg/unittest/test/missing_tick_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698