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

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

Issue 1361303002: Get rid of LocalTest.tearDown. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 3 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 | « no previous file | lib/src/backend/invoker.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.declarer; 5 library test.backend.declarer;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../frontend/timeout.dart'; 9 import '../frontend/timeout.dart';
10 import 'group.dart'; 10 import 'group.dart';
(...skipping 27 matching lines...) Expand all
38 testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform)); 38 testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform));
39 39
40 var group = _group; 40 var group = _group;
41 _tests.add(new LocalTest(description, metadata, () { 41 _tests.add(new LocalTest(description, metadata, () {
42 // TODO(nweiz): It might be useful to throw an error here if a test starts 42 // TODO(nweiz): It might be useful to throw an error here if a test starts
43 // running while other tests from the same declarer are also running, 43 // running while other tests from the same declarer are also running,
44 // since they might share closurized state. 44 // since they might share closurized state.
45 45
46 // TODO(nweiz): Use async/await here once issue 23497 has been fixed in 46 // TODO(nweiz): Use async/await here once issue 23497 has been fixed in
47 // two stable versions. 47 // two stable versions.
48 return group.runSetUp().then((_) => body()); 48 return Invoker.current.waitForOutstandingCallbacks(() {
49 }, tearDown: group.runTearDown)); 49 return group.runSetUp().then((_) => body());
50 }).then((_) => group.runTearDown());
51 }));
50 } 52 }
51 53
52 /// Creates a group of tests. 54 /// Creates a group of tests.
53 void group(String description, void body(), {String testOn, 55 void group(String description, void body(), {String testOn,
54 Timeout timeout, skip, Map<String, dynamic> onPlatform}) { 56 Timeout timeout, skip, Map<String, dynamic> onPlatform}) {
55 var oldGroup = _group; 57 var oldGroup = _group;
56 58
57 var metadata = new Metadata.parse( 59 var metadata = new Metadata.parse(
58 testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform); 60 testOn: testOn, timeout: timeout, skip: skip, onPlatform: onPlatform);
59 61
(...skipping 24 matching lines...) Expand all
84 /// Registers a function to be run after tests. 86 /// Registers a function to be run after tests.
85 void tearDown(callback()) { 87 void tearDown(callback()) {
86 if (_group.tearDown != null) { 88 if (_group.tearDown != null) {
87 throw new StateError("tearDown() may not be called multiple times for " 89 throw new StateError("tearDown() may not be called multiple times for "
88 "the same group."); 90 "the same group.");
89 } 91 }
90 92
91 _group.tearDown = callback; 93 _group.tearDown = callback;
92 } 94 }
93 } 95 }
OLDNEW
« 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