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

Side by Side Diff: lib/test.dart

Issue 1379203002: Refactor groups to pipe them through to the runner. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 2 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/runner/vm/isolate_test.dart ('k') | test/backend/declarer_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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; 5 library test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 10
(...skipping 23 matching lines...) Expand all
34 /// 34 ///
35 /// This is used if a test file is run directly, rather than through the runner. 35 /// This is used if a test file is run directly, rather than through the runner.
36 Declarer _globalDeclarer; 36 Declarer _globalDeclarer;
37 37
38 /// Gets the declarer for the current scope. 38 /// Gets the declarer for the current scope.
39 /// 39 ///
40 /// When using the runner, this returns the [Zone]-scoped declarer that's set by 40 /// When using the runner, this returns the [Zone]-scoped declarer that's set by
41 /// [IsolateListener] or [IframeListener]. If the test file is run directly, 41 /// [IsolateListener] or [IframeListener]. If the test file is run directly,
42 /// this returns [_globalDeclarer] (and sets it up on the first call). 42 /// this returns [_globalDeclarer] (and sets it up on the first call).
43 Declarer get _declarer { 43 Declarer get _declarer {
44 var declarer = Zone.current[#test.declarer]; 44 var declarer = Declarer.current;
45 if (declarer != null) return declarer; 45 if (declarer != null) return declarer;
46 if (_globalDeclarer != null) return _globalDeclarer; 46 if (_globalDeclarer != null) return _globalDeclarer;
47 47
48 // Since there's no Zone-scoped declarer, the test file is being run directly. 48 // Since there's no Zone-scoped declarer, the test file is being run directly.
49 // In order to run the tests, we set up our own Declarer via 49 // In order to run the tests, we set up our own Declarer via
50 // [_globalDeclarer], and schedule a microtask to run the tests once they're 50 // [_globalDeclarer], and schedule a microtask to run the tests once they're
51 // finished being defined. 51 // finished being defined.
52 _globalDeclarer = new Declarer(); 52 _globalDeclarer = new Declarer();
53 scheduleMicrotask(() async { 53 scheduleMicrotask(() async {
54 var suite = new RunnerSuite( 54 var suite = new RunnerSuite(
55 // TODO(nweiz): Use a different environment if VM environment starts 55 // TODO(nweiz): Use a different environment if VM environment starts
56 // import dart:io before cross-platform libraries exist. 56 // import dart:io before cross-platform libraries exist.
57 const VMEnvironment(), 57 const VMEnvironment(),
58 _globalDeclarer.tests, 58 _globalDeclarer.build(),
59 path: p.prettyUri(Uri.base), 59 path: p.prettyUri(Uri.base),
60 platform: TestPlatform.vm, 60 platform: TestPlatform.vm,
61 os: currentOSGuess); 61 os: currentOSGuess);
62 62
63 var engine = new Engine(); 63 var engine = new Engine();
64 engine.suiteSink.add(suite); 64 engine.suiteSink.add(suite);
65 engine.suiteSink.close(); 65 engine.suiteSink.close();
66 ExpandedReporter.watch(engine, 66 ExpandedReporter.watch(engine,
67 color: true, printPath: false, printPlatform: false); 67 color: true, printPath: false, printPlatform: false);
68 68
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 /// Each callback at the top level or in a given group will be run in the 186 /// Each callback at the top level or in a given group will be run in the
187 /// reverse of the order they were declared. 187 /// reverse of the order they were declared.
188 void tearDown(callback()) => _declarer.tearDown(callback); 188 void tearDown(callback()) => _declarer.tearDown(callback);
189 189
190 /// Registers an exception that was caught for the current test. 190 /// Registers an exception that was caught for the current test.
191 void registerException(error, [StackTrace stackTrace]) { 191 void registerException(error, [StackTrace stackTrace]) {
192 // This will usually forward directly to [Invoker.current.handleError], but 192 // This will usually forward directly to [Invoker.current.handleError], but
193 // going through the zone API allows other zones to consistently see errors. 193 // going through the zone API allows other zones to consistently see errors.
194 Zone.current.handleUncaughtError(error, stackTrace); 194 Zone.current.handleUncaughtError(error, stackTrace);
195 } 195 }
OLDNEW
« no previous file with comments | « lib/src/runner/vm/isolate_test.dart ('k') | test/backend/declarer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698