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

Side by Side Diff: test/utils.dart

Issue 1088453004: Move browser tests that require installation into their own files. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: 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 | « test/runner/test_on_test.dart ('k') | no next file » | 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.test.utils; 5 library test.test.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:test/src/backend/invoker.dart'; 10 import 'package:test/src/backend/invoker.dart';
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 /// Returns a local [LiveTest] that runs [body]. 220 /// Returns a local [LiveTest] that runs [body].
221 LiveTest createTest(body()) { 221 LiveTest createTest(body()) {
222 var test = new LocalTest("test", new Metadata(), body); 222 var test = new LocalTest("test", new Metadata(), body);
223 var suite = new Suite([test]); 223 var suite = new Suite([test]);
224 return test.load(suite); 224 return test.load(suite);
225 } 225 }
226 226
227 /// Runs [body] as a test. 227 /// Runs [body] as a test.
228 /// 228 ///
229 /// Once it completes, returns the [LiveTest] used to run it. 229 /// Once it completes, returns the [LiveTest] used to run it.
230 Future<LiveTest> runTest(body()) { 230 Future<LiveTest> runTestBody(body()) {
231 var liveTest = createTest(body); 231 var liveTest = createTest(body);
232 return liveTest.run().then((_) => liveTest); 232 return liveTest.run().then((_) => liveTest);
233 } 233 }
234 234
235 /// Asserts that [liveTest] has completed and passed. 235 /// Asserts that [liveTest] has completed and passed.
236 /// 236 ///
237 /// If the test had any errors, they're surfaced nicely into the outer test. 237 /// If the test had any errors, they're surfaced nicely into the outer test.
238 void expectTestPassed(LiveTest liveTest) { 238 void expectTestPassed(LiveTest liveTest) {
239 // Since the test is expected to pass, we forward any current or future errors 239 // Since the test is expected to pass, we forward any current or future errors
240 // to the outer test, because they're definitely unexpected. 240 // to the outer test, because they're definitely unexpected.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 }); 273 });
274 }); 274 });
275 275
276 return liveTest.run().then((_) { 276 return liveTest.run().then((_) {
277 expectTestPassed(liveTest); 277 expectTestPassed(liveTest);
278 // Ensure that the outer test doesn't complete until the inner future 278 // Ensure that the outer test doesn't complete until the inner future
279 // completes. 279 // completes.
280 return future; 280 return future;
281 }); 281 });
282 } 282 }
OLDNEW
« no previous file with comments | « test/runner/test_on_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698