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

Side by Side Diff: lib/src/runner/loader.dart

Issue 1400743002: Add support for setUpAll and tearDownAll. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: 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/engine.dart ('k') | lib/src/runner/vm/isolate_listener.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.runner.loader; 5 library test.runner.loader;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 10
11 import 'package:analyzer/analyzer.dart'; 11 import 'package:analyzer/analyzer.dart';
12 import 'package:async/async.dart'; 12 import 'package:async/async.dart';
13 import 'package:path/path.dart' as p; 13 import 'package:path/path.dart' as p;
14 import 'package:stack_trace/stack_trace.dart'; 14 import 'package:stack_trace/stack_trace.dart';
15 15
16 import '../backend/group.dart'; 16 import '../backend/group.dart';
17 import '../backend/metadata.dart'; 17 import '../backend/metadata.dart';
18 import '../backend/test.dart';
18 import '../backend/test_platform.dart'; 19 import '../backend/test_platform.dart';
19 import '../util/dart.dart' as dart; 20 import '../util/dart.dart' as dart;
20 import '../util/io.dart'; 21 import '../util/io.dart';
21 import '../util/remote_exception.dart'; 22 import '../util/remote_exception.dart';
22 import '../utils.dart'; 23 import '../utils.dart';
23 import 'browser/server.dart'; 24 import 'browser/server.dart';
24 import 'configuration.dart'; 25 import 'configuration.dart';
25 import 'hack_load_vm_file_hook.dart'; 26 import 'hack_load_vm_file_hook.dart';
26 import 'load_exception.dart'; 27 import 'load_exception.dart';
27 import 'load_suite.dart'; 28 import 'load_suite.dart';
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } finally { 238 } finally {
238 subscription.cancel(); 239 subscription.cancel();
239 } 240 }
240 } 241 }
241 242
242 /// Deserializes [group] into a concrete [Group] class. 243 /// Deserializes [group] into a concrete [Group] class.
243 Group _deserializeGroup(Map group) { 244 Group _deserializeGroup(Map group) {
244 var metadata = new Metadata.deserialize(group['metadata']); 245 var metadata = new Metadata.deserialize(group['metadata']);
245 return new Group(group['name'], group['entries'].map((entry) { 246 return new Group(group['name'], group['entries'].map((entry) {
246 if (entry['type'] == 'group') return _deserializeGroup(entry); 247 if (entry['type'] == 'group') return _deserializeGroup(entry);
247 var testMetadata = new Metadata.deserialize(entry['metadata']); 248 return _deserializeTest(entry);
248 return new IsolateTest(entry['name'], testMetadata, entry['sendPort']); 249 }),
249 }), metadata: metadata); 250 metadata: metadata,
251 setUpAll: _deserializeTest(group['setUpAll']),
252 tearDownAll: _deserializeTest(group['tearDownAll']));
253 }
254
255 /// Deserializes [test] into a concrete [Test] class.
256 ///
257 /// Returns `null` if [test] is `null`.
258 Test _deserializeTest(Map test) {
259 if (test == null) return null;
260
261 var metadata = new Metadata.deserialize(test['metadata']);
262 return new IsolateTest(test['name'], metadata, test['sendPort']);
250 } 263 }
251 264
252 /// Closes the loader and releases all resources allocated by it. 265 /// Closes the loader and releases all resources allocated by it.
253 Future close() { 266 Future close() {
254 return _closeMemo.runOnce(() async { 267 return _closeMemo.runOnce(() async {
255 await Future.wait(_suites.map((suite) => suite.close())); 268 await Future.wait(_suites.map((suite) => suite.close()));
256 _suites.clear(); 269 _suites.clear();
257 270
258 if (!_browserServerMemo.hasRun) return; 271 if (!_browserServerMemo.hasRun) return;
259 await (await _browserServer).close(); 272 await (await _browserServer).close();
260 }); 273 });
261 } 274 }
262 } 275 }
OLDNEW
« no previous file with comments | « lib/src/runner/engine.dart ('k') | lib/src/runner/vm/isolate_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698