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

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

Issue 1239693002: Pass actual TestPlatform and OperatingSystem values to Suite. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Update pubspec. Created 5 years, 5 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/load_suite.dart ('k') | lib/src/runner/reporter/compact.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
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 for (var platform in _platforms) { 155 for (var platform in _platforms) {
156 if (!suiteMetadata.testOn.evaluate(platform, os: currentOS)) continue; 156 if (!suiteMetadata.testOn.evaluate(platform, os: currentOS)) continue;
157 157
158 var metadata = suiteMetadata.forPlatform(platform, os: currentOS); 158 var metadata = suiteMetadata.forPlatform(platform, os: currentOS);
159 159
160 // Don't load a skipped suite. 160 // Don't load a skipped suite.
161 if (metadata.skip) { 161 if (metadata.skip) {
162 yield new LoadSuite.forSuite(new Suite([ 162 yield new LoadSuite.forSuite(new Suite([
163 new LocalTest(path, metadata, () {}) 163 new LocalTest(path, metadata, () {})
164 ], path: path, platform: platform.name, metadata: metadata)); 164 ], path: path, platform: platform, metadata: metadata));
165 continue; 165 continue;
166 } 166 }
167 167
168 var name = (platform.isJS ? "compiling " : "loading ") + path; 168 var name = (platform.isJS ? "compiling " : "loading ") + path;
169 yield new LoadSuite(name, () { 169 yield new LoadSuite(name, () {
170 return platform == TestPlatform.vm 170 return platform == TestPlatform.vm
171 ? _loadVmFile(path, metadata) 171 ? _loadVmFile(path, metadata)
172 : _loadBrowserFile(path, platform, metadata); 172 : _loadBrowserFile(path, platform, metadata);
173 }, platform: platform.name); 173 }, platform: platform);
174 } 174 }
175 } 175 }
176 176
177 /// Load the test suite at [path] in [platform]. 177 /// Load the test suite at [path] in [platform].
178 /// 178 ///
179 /// [metadata] is the suite-level metadata for the test. 179 /// [metadata] is the suite-level metadata for the test.
180 Future<Suite> _loadBrowserFile(String path, TestPlatform platform, 180 Future<Suite> _loadBrowserFile(String path, TestPlatform platform,
181 Metadata metadata) async => 181 Metadata metadata) async =>
182 (await _browserServer).loadSuite(path, platform, metadata); 182 (await _browserServer).loadSuite(path, platform, metadata);
183 183
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 261 }
262 }); 262 });
263 263
264 try { 264 try {
265 var suite = new Suite((await completer.future).map((test) { 265 var suite = new Suite((await completer.future).map((test) {
266 var testMetadata = new Metadata.deserialize(test['metadata']); 266 var testMetadata = new Metadata.deserialize(test['metadata']);
267 return new IsolateTest(test['name'], testMetadata, test['sendPort']); 267 return new IsolateTest(test['name'], testMetadata, test['sendPort']);
268 }), 268 }),
269 metadata: metadata, 269 metadata: metadata,
270 path: path, 270 path: path,
271 platform: "VM", 271 platform: TestPlatform.vm,
272 os: currentOS,
272 onClose: isolate.kill); 273 onClose: isolate.kill);
273 _suites.add(suite); 274 _suites.add(suite);
274 return suite; 275 return suite;
275 } finally { 276 } finally {
276 subscription.cancel(); 277 subscription.cancel();
277 } 278 }
278 } 279 }
279 280
280 /// Closes the loader and releases all resources allocated by it. 281 /// Closes the loader and releases all resources allocated by it.
281 Future close() { 282 Future close() {
282 return _closeThunk.run(() async { 283 return _closeThunk.run(() async {
283 await Future.wait(_suites.map((suite) => suite.close())); 284 await Future.wait(_suites.map((suite) => suite.close()));
284 _suites.clear(); 285 _suites.clear();
285 286
286 if (!_browserServerThunk.hasRun) return; 287 if (!_browserServerThunk.hasRun) return;
287 await (await _browserServer).close(); 288 await (await _browserServer).close();
288 }); 289 });
289 } 290 }
290 } 291 }
OLDNEW
« no previous file with comments | « lib/src/runner/load_suite.dart ('k') | lib/src/runner/reporter/compact.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698