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

Unified Diff: lib/src/backend/metadata.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 | « lib/src/backend/invoker.dart ('k') | lib/src/frontend/timeout.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/metadata.dart
diff --git a/lib/src/backend/metadata.dart b/lib/src/backend/metadata.dart
index 811a84a20429f855a08ae2cb1263299dd66eb366..bf58b3f5d2e984420b0f55874f294d5973bdb351 100644
--- a/lib/src/backend/metadata.dart
+++ b/lib/src/backend/metadata.dart
@@ -4,6 +4,7 @@
library test.backend.metadata;
+import '../frontend/timeout.dart';
import 'platform_selector.dart';
/// Metadata for a test or test suite.
@@ -14,32 +15,51 @@ class Metadata {
/// The selector indicating which platforms the suite supports.
final PlatformSelector testOn;
+ /// The modification to the timeout for the test or suite.
+ final Timeout timeout;
+
/// Creates new Metadata.
///
/// [testOn] defaults to [PlatformSelector.all].
- Metadata({PlatformSelector testOn})
- : testOn = testOn == null ? PlatformSelector.all : testOn;
+ Metadata({PlatformSelector testOn, Timeout timeout})
+ : testOn = testOn == null ? PlatformSelector.all : testOn,
+ timeout = timeout == null ? new Timeout.factor(1) : timeout;
- /// Parses metadata fields from strings.
+ /// Creates a new Metadata, but with fields parsed from strings where
+ /// applicable.
///
/// Throws a [FormatException] if any field is invalid.
- Metadata.parse({String testOn})
+ Metadata.parse({String testOn, Timeout timeout})
: this(
- testOn: testOn == null ? null : new PlatformSelector.parse(testOn));
+ testOn: testOn == null ? null : new PlatformSelector.parse(testOn),
+ timeout: timeout);
/// Dezerializes the result of [Metadata.serialize] into a new [Metadata].
Metadata.deserialize(serialized)
- : this.parse(testOn: serialized['testOn']);
+ : this.parse(
+ testOn: serialized['testOn'],
+ timeout: serialized['timeout']['duration'] == null
+ ? new Timeout.factor(serialized['timeout']['scaleFactor'])
+ : new Timeout(new Duration(
+ microseconds: serialized['timeout']['duration'])));
/// Return a new [Metadata] that merges [this] with [other].
///
/// If the two [Metadata]s have conflicting properties, [other] wins.
Metadata merge(Metadata other) =>
- new Metadata(testOn: testOn.intersect(other.testOn));
+ new Metadata(
+ testOn: testOn.intersect(other.testOn),
+ timeout: timeout.merge(other.timeout));
/// Serializes [this] into a JSON-safe object that can be deserialized using
/// [new Metadata.deserialize].
serialize() => {
- 'testOn': testOn == PlatformSelector.all ? null : testOn.toString()
+ 'testOn': testOn == PlatformSelector.all ? null : testOn.toString(),
+ 'timeout': {
+ 'duration': timeout.duration == null
+ ? null
+ : timeout.duration.inMicroseconds,
+ 'scaleFactor': timeout.scaleFactor
+ }
};
}
« no previous file with comments | « lib/src/backend/invoker.dart ('k') | lib/src/frontend/timeout.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698