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

Side by Side Diff: lib/src/backend/metadata.dart

Issue 1086213002: Support a @Timeout annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: CHANGELOG + README 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 unified diff | Download patch
« no previous file with comments | « lib/src/backend/invoker.dart ('k') | lib/src/runner/browser/browser_manager.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 library test.backend.metadata; 5 library test.backend.metadata;
6 6
7 import '../frontend/timeout.dart'; 7 import '../frontend/timeout.dart';
8 import 'platform_selector.dart'; 8 import 'platform_selector.dart';
9 9
10 /// Metadata for a test or test suite. 10 /// Metadata for a test or test suite.
11 /// 11 ///
12 /// This metadata comes from declarations on the test itself; it doesn't include 12 /// This metadata comes from declarations on the test itself; it doesn't include
13 /// configuration from the user. 13 /// configuration from the user.
14 class Metadata { 14 class Metadata {
15 /// The selector indicating which platforms the suite supports. 15 /// The selector indicating which platforms the suite supports.
16 final PlatformSelector testOn; 16 final PlatformSelector testOn;
17 17
18 /// The modification to the timeout for the test or suite. 18 /// The modification to the timeout for the test or suite.
19 final Timeout timeout; 19 final Timeout timeout;
20 20
21 /// Creates new Metadata. 21 /// Creates new Metadata.
22 /// 22 ///
23 /// [testOn] defaults to [PlatformSelector.all]. 23 /// [testOn] defaults to [PlatformSelector.all].
24 Metadata({PlatformSelector testOn, Timeout timeout}) 24 Metadata({PlatformSelector testOn, Timeout timeout})
25 : testOn = testOn == null ? PlatformSelector.all : testOn, 25 : testOn = testOn == null ? PlatformSelector.all : testOn,
26 timeout = timeout == null ? new Timeout.factor(1) : timeout; 26 timeout = timeout == null ? const Timeout.factor(1) : timeout;
27 27
28 /// Creates a new Metadata, but with fields parsed from strings where 28 /// Creates a new Metadata, but with fields parsed from strings where
29 /// applicable. 29 /// applicable.
30 /// 30 ///
31 /// Throws a [FormatException] if any field is invalid. 31 /// Throws a [FormatException] if any field is invalid.
32 Metadata.parse({String testOn, Timeout timeout}) 32 Metadata.parse({String testOn, Timeout timeout})
33 : this( 33 : this(
34 testOn: testOn == null ? null : new PlatformSelector.parse(testOn), 34 testOn: testOn == null ? null : new PlatformSelector.parse(testOn),
35 timeout: timeout); 35 timeout: timeout);
36 36
(...skipping 19 matching lines...) Expand all
56 serialize() => { 56 serialize() => {
57 'testOn': testOn == PlatformSelector.all ? null : testOn.toString(), 57 'testOn': testOn == PlatformSelector.all ? null : testOn.toString(),
58 'timeout': { 58 'timeout': {
59 'duration': timeout.duration == null 59 'duration': timeout.duration == null
60 ? null 60 ? null
61 : timeout.duration.inMicroseconds, 61 : timeout.duration.inMicroseconds,
62 'scaleFactor': timeout.scaleFactor 62 'scaleFactor': timeout.scaleFactor
63 } 63 }
64 }; 64 };
65 } 65 }
OLDNEW
« no previous file with comments | « lib/src/backend/invoker.dart ('k') | lib/src/runner/browser/browser_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698