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

Unified Diff: lib/src/backend/declarer.dart

Issue 1090513002: Support configuring timeouts per-test and -group. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 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 | « no previous file | lib/src/backend/invoker.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/declarer.dart
diff --git a/lib/src/backend/declarer.dart b/lib/src/backend/declarer.dart
index 9983754c3af93a7894737313b6d16ad6ddea16f6..01e814072b0021cda70bb44126a5f560c674130f 100644
--- a/lib/src/backend/declarer.dart
+++ b/lib/src/backend/declarer.dart
@@ -6,6 +6,7 @@ library test.backend.declarer;
import 'dart:collection';
+import '../frontend/timeout.dart';
import 'group.dart';
import 'invoker.dart';
import 'metadata.dart';
@@ -32,13 +33,19 @@ class Declarer {
///
/// If [testOn] is passed, it's parsed as a [PlatformSelector], and the test
/// will only be run on matching platforms.
- void test(String description, body(), {String testOn}) {
+ ///
+ /// If [timeout] is passed, it's used to modify or replace the default timeout
+ /// of 30 seconds. Timeout modifications take precedence in suite-group-test
+ /// order, so [timeout] will also modify any timeouts set on the group or
+ /// suite.
+ void test(String description, body(), {String testOn, Timeout timeout}) {
// TODO(nweiz): Once tests have begun running, throw an error if [test] is
// called.
var prefix = _group.description;
if (prefix != null) description = "$prefix $description";
- var metadata = _group.metadata.merge(new Metadata.parse(testOn: testOn));
+ var metadata = _group.metadata.merge(
+ new Metadata.parse(testOn: testOn, timeout: timeout));
var group = _group;
_tests.add(new LocalTest(description, metadata, () {
// TODO(nweiz): It might be useful to throw an error here if a test starts
@@ -56,11 +63,17 @@ class Declarer {
///
/// If [testOn] is passed, it's parsed as a [PlatformSelector], and any tests
/// in the group will only be run on matching platforms.
- void group(String description, void body(), {String testOn}) {
+ ///
+ /// If [timeout] is passed, it's used to modify or replace the default timeout
+ /// of 30 seconds. Timeout modifications take precedence in suite-group-test
+ /// order, so [timeout] will also modify any timeouts set on the group or
+ /// suite.
+ void group(String description, void body(), {String testOn,
+ Timeout timeout}) {
var oldGroup = _group;
- _group = new Group(
- oldGroup, description, new Metadata.parse(testOn: testOn));
+ var metadata = new Metadata.parse(testOn: testOn, timeout: timeout);
+ _group = new Group(oldGroup, description, metadata);
try {
body();
} finally {
« no previous file with comments | « no previous file | lib/src/backend/invoker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698